-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add more validation to UBO size and alignment in Compatibility renderer #92568
Conversation
2584a92
to
ea4be9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code and docs look good to me.
Thanks! |
@clayjohn hi, now every time I run Godot in compability mode I get a warning:
godot/drivers/gles3/storage/material_storage.cpp Lines 1110 to 1116 in b75f048
So in line |
This validation is to ensure we don't break the UBO alignment rules which can have disastrous performance implications on some buggy drivers.
This is mostly static checks to ensure we don't accidentally break things with subsequent changes. But it does add a check that the material buffer size does not exceed the max uniform buffer size.
The one substantial change here is that we change the validation for the global uniform buffer size. Previously it was MAXed to be at least 4096 items long and the raw size (number of items) was compared against the maximum UBO size (measured in bytes). So we still ended up requesting a buffer that was 16 times the maximum size supported by the device.
In practice, this hasn't resulted in any issues as Uniform buffers are allowed to be bigger than the device limit. The device limit specifies how much you can use in a draw call and the Compatibility renderer limits the number that can be used in a draw call to 256.
godot/drivers/gles3/rasterizer_canvas_gles3.cpp
Line 2796 in 505da68
At any rate, we need to fix this validation before users run into the problem (at best they will get cryptic driver errors, but they could easily get a crash)
Partially addresses: #85374
Putting on the docket for 4.3 as this is a very safe change and will potentially have benefits for web exports which struggle with large UBOs