You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
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:
Most discrete GPUs have a maximum uniform buffer size of 65536 bytes
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 limit_get() which will allow you to check the limit using LIMIT_MAX_UNIFORM_BUFFER_SIZE as input
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: