-
Notifications
You must be signed in to change notification settings - Fork 172
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
Values for certain types of uniforms within UBOs are shown incorrectly #277
Comments
Yes, looks like it gets ignored (note how the offset is used without respecting Spector.js/src/backend/states/drawCalls/drawCallState.ts Lines 453 to 463 in 35385a5
Edit: This might be part of |
Note Though judging by the implementation of getUboValue it is expected that there are zeroes. Spector.js/src/backend/states/drawCalls/drawCallUboInputState.ts Lines 50 to 75 in 35385a5
In case of float x[3] the layout is the following:
The implementation simply does getBufferSubdata and then seems to do nothing with it. Assuming uboType.lengthMultiplier is 1 and size is 3. It should indeed read the first float and two zero-paddings immediately following it. |
I've tried to fix it, but it's still broken for matrices: https://github.com/JannikGM/Spector.js/tree/strides (and it still needs to be cleaned up). There's also a lack of optimizations still (like auto-reading objects with |
According to the spec https://registry.khronos.org/OpenGL/extensions/ARB/ARB_uniform_buffer_object.txt column-major matrices are treated as arrays of columns regardless of the dimensions. And array elements are vec4-aligned. So mat4x2 is taking as much space as mat4. Row-major matrices are the same except they should be treated as arrays of rows. Although today I discovered that when on NVidia GPUs + Chrome row-major case does something else. As well as Android on Mali G68. So yeah. It seems that this stuff is still implementation-defined to some extent. Or maybe I am using the wrong spec :) |
This is a really interesting one indeed :-) @JannikGM, thanks a lot for your proposal here, this is going in the right direction and yes it was a complete oversight on my side. |
I was using Spector.js Chrome extension to debug our migration to UBOs and stumbled upon this.
We have the following uniform block:
And spector shows the following for frustumSplits
The displayed value is
0.1683, 0, 0
which is wrong. The last two values shouldn't be zeroes.I think Spector is ignoring arrayStride here, because when I put some numbers into the buffer one after another I can actually see them in Spector.
The text was updated successfully, but these errors were encountered: