-
-
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
Fix integer value for GL_MAX_UNIFORM_BLOCK_SIZE
overflowing
#80909
Fix integer value for GL_MAX_UNIFORM_BLOCK_SIZE
overflowing
#80909
Conversation
Interesting bug. I found possibly related MESA PR's and issues as at least the original bug report happens when on web and Linux MESA. https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18512 and https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/922 |
This is indeed strange bug: There is also a Are there any GL errors being flagged? (i.e. It might be an idea to set all these to the minimum value in the spec if even the 64 bit version returns a negative value, unless we can figure out what is going on. |
I confirm that my workstation use Linux MESA. |
807ea31
to
ac6bd0a
Compare
Since this is an issue on Web platform, it's probably using ANGLE. And ANGLE specify use 64-bit for this value (and some other "size" values): There's also the following comment in the code (actual clamping is done only when using Vulkan as backend, when using desktop GL is seems to be used as it):
|
ac6bd0a
to
c17a49c
Compare
@bruvzg I'm actually using an AMD card. (AMD Radeon™ RX Vega 64) |
For the record, I changed my code to make the config use |
What value does it return as |
It returns for me |
ece4042
to
0ce8cdd
Compare
0ce8cdd
to
9c7db73
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.
Looks great! Good work
GL_MAX_UNIFORM_BLOCK_SIZE
overflowing
Thanks! |
Cherry-picked for 4.1.2. |
This PR fixes the issue of shader compilation on the web platform.
It happens that the following line (on my PC, at least) makes the
int Config::max_uniform_buffer_size
to overflow to-2147483648
, which is exactlyINT_MIN
(orINT_MAX + 1
).godot/drivers/gles3/storage/config.cpp
Line 94 in 6758a7f
Then,
int Config::max_renderable_lights
(defaults to32
) is set to the minimum value of itself or ourConfig::max_uniform_buffer_size
, which we remember is-2147483648
. Then the same thing happens forint Config::max_lights_per_object
(defaults to8
).godot/drivers/gles3/rasterizer_scene_gles3.cpp
Lines 2626 to 2627 in 6758a7f
This makes two scene.glsl "#defines" with
INT_MIN
value. It's pretty easy to understand then why the shader can't compile.godot/drivers/gles3/rasterizer_scene_gles3.cpp
Lines 2664 to 2673 in 6758a7f
My PR is quite simple. If the value ofConfig::max_uniform_buffer_size
is negative, it means that it overflowed. SoINT_MAX
is set as the value.Edit: used
glGetInteger64v()
andint64_t
forConfig
instead.Fixes #68180