-
-
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
global_shader_variables/buffer_size set too high in new Compatibility project #85374
Comments
Yes, the |
In version: 4.2.1 the default value is 16384 The warning is probably ok, because the limit is for some reason really small. And that's what I see as the main problem. 3D models need to have a very small polycount. The same device has no problem with the Vulkan renderer. |
Can we define "rendering/limits/global_shader_variables/buffer_size" based on OS and rendering method? If so we can give it seperate definition. |
From my user-usage perspective, I don't think a split limit per platform would be an advantage. The project needs to be tailored to the lowest value to work properly. So the lowest value can be common to all platforms. However, it seems that the core of the problem is that this limit exists at all. For mobile devices, the limit is very restrictive. It is not possible to render even a relatively simple low-poly 3D object. I found a related problem here: #55674 Where @clayjohn suggests:
That's the solution I'd like. I haven't found any open issue for it. |
Yeah that includes more work, and potentially less performant if SSBO is used. |
SSBOs aren't supported in OpenGL 3.3, nor can we use multiple UBOs for the global buffer. So we are kinda stuck with the low limit for compatibility devices. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@Jakub-Doucek Indeed, 3.5 doesn't support global shader uniforms, and you don't appear to be using them in your project anyway, so your issue isn't related at all. |
I just tested this in 4.2.1 to see if it was still an issue and when creating a new Compatibility project and running it I'm no longer getting the warning. However, when checking the project settings Can anyone confirm if this mean the issue is now solved so I can close this issue (that the Compatibility renderer now supports this buffer size?) or is there some other change that just causes the warning not to show even if the limit is still there? |
I think you got this warning 4.2.rc2 because it was using ANGLE by default on macOS, but this is no longer the case. If you edit project settings to use the |
I see, that may be the case. However, it seems I can't use the Angle OpenGL drivers anymore (They used to work). Changing the project setting to used Angle and restarting I get the following error and get switched back to native OpenGL again:
Not sure what's going on there, but it seems unlikely the graphics card doesn't support the required Metal version (unless it's some old outdated Metal version) as it's quite a new M2 mac. And I did use the angle driver briefly back when that was the default on mac. |
It turns out this is an issue with our build scripts. We are using the wrong version of ANGLE in official builds. At any rate, the angle build has a few issues that we are still working on while we fixed several issues in the native opengl backend that make it perform better |
Bad news, while looking into a related issue I realized that our validation here was wrong. The setting sets the total number of uniforms that can be used by the buffer, but we treated the total number of uniforms as if were the total number of bytes. So even after validation, we only reduced the size of the buffer to 16384, which then allocated a buffer with a size of 16384 * 16. The actual limit for mobile devices is 1024 items. :( For desktop devices the limit is 4096. This is unfortunately a huge limitation. If users need more than 1024 items, we will have to use a texture instead of a uniform buffer. If we do so, the limit can be removed, but using the global buffer (and per-instance buffer) will become much more expensive at draw time. |
Considering the size of the values I also guessed these were sizes in bytes rather than number of uniforms. It's probably my lack of imagination, but to me 1024 global shader uniforms (where you can use 256 in a single draw call?) seems like quite a lot to me. So I wouldn't see it as such a big limitation even if the number is much smaller. Considering all projects have a setting for this that is likely using the old |
Just noticed in 4.3beta2 we now get a warning that the setting is too high and that it will fall back to 4096 (running on desktop) after #92568. However, the default value if you go into Project settings and reset it to default is still 65536. So I'm guessing this should be changed to 4096 for desktop projects and 1024 for mobile to avoid this warning for all new projects? |
Not exactly, this same setting is used by all renderers. On the Mobile and Forward+ renderer the default of 65536 is fine. Changing the limit for everyone to 4096 will break compatibility. For the Compatibility renderer its fine because using more than the number supported by the device wouldn't have worked anyway, but for the other backends its a problem. I suspect that we should do the following:
|
Is there some benefit to setting this setting to anything lower than the max allowed? If not, perhaps the setting could just be removed and the max allowed always be used if the engine would instead correctly validate the number of variables actually used and block/warn if there were too many to be supported. |
You would lose the possibility to save GPU memory by manually changing the setting to some small value. Realistically, most (desktop) GPUs will return GL_MAX_UNIFORM_BLOCK_SIZE = 65536, but there are some exceptions: https://stackoverflow.com/questions/47932609/uniform-buffer-size-on-nvidia-gpus
|
Getting similar with no value shown WARNING: Project setting "rendering/limits/global_shader_variables/buffer_size" exceeds maximum uniform buffer size of:. |
For the compatibility renderer (especially on web and low end devices) shader compile time is faster with a lower limit. For the RD renderers, the maximum size can be several mbs, so the limit helps to save memory. |
It looks like we already provide an error when we attempt to use too many. godot/drivers/gles3/storage/material_storage.cpp Line 1791 in 374807f
godot/drivers/gles3/storage/material_storage.cpp Line 2002 in 374807f
We can just improve the error message so that it specifies the hardware maximum |
Godot version
4.2.rc2
System information
macOS 14.1
Issue description
Creating a new Compatibility project the default setting for rendering/limits/global_shader_variables/buffer_size is set to 65536, but apparently this is too high for Compatibility renderer limits, because you get a warning when running:
Steps to reproduce
Create a new blank Compatibility project, with an empty scene and run it and see the warning
Minimal reproduction project
Just create a new project from the project manager as I think the issue is the default value for new Compatibility projects.
The text was updated successfully, but these errors were encountered: