-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shader Uniform Array size limits #55674
Comments
I'm pretty sure on the mobile it's much less. Btw Godot has a function that retrieves that number from the system? |
Yes, most mobile support a size of only 16384. It looks like RenderingDevice has a function godot/drivers/vulkan/rendering_device_vulkan.cpp Line 9174 in 46d3840
godot/drivers/vulkan/rendering_device_vulkan.cpp Lines 9218 to 9219 in 46d3840
|
Closed by #56153 |
Original Report:
I tried to use big (around 500 000 items) uniform arrays but they didn't seem to work. After narrowing down the problem it started to look like the total number of uniform items (including the items inside arrays) was limited to 4096. In addition to this, bigger types like mat4 seem to consume the available space quicker so that 1024 items already use all of it. This happens in both the editor and the running (ran from the editor) project.
Changing the sizes or contents of the arrays through "Shader Param" doesn't seem to affect anything
Tried to change setting "Rendering->Limits->Global Shader Variables->Buffer size" to see if it fixes the issue. Didn't help. Is there some other place to look for limits for these?
See attached video and sample project for more info.
If this is a (new) bug I can make an issue out of this(?)
System: Windows 10, RTX-2060(mobile), Godot v4.0.dev.custom_build [5f9e2fc], Vulkan renderer
(btw: After changing to opengl3-renderer godot stopped showing menus, the "3d-area" was grey, menus disappeared and after selecting a node it crashed so couldn't test the opengl-renderer).
2021-12-06.18-44-36.mp4
UniformArrayTest.zip
Originally posted by @GNSS-Stylist in #54657 (comment)
My response:
Most discrete GPUs have a maximum uniform buffer size of 65536 bytes (including yours) Which translates to 4096 vec4s or 1024 Mat4s (which are essentially 4 vec4s). Your GPU driver will pad most data types to vec4 when used in an array (some GPUs don't add padding, but many do).
There are two things we need to do in response:
Add a warning if a user tries to add more uniforms than can fit in 65536 bytes (long term we could automatically split the uniforms up into multiple UBOs internally, or use a SSBO internally)
add documentation about data padding and size limits to the documentation page.
The text was updated successfully, but these errors were encountered: