Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upDescriptorInit error on unaligned shader uniforms #1197
Comments
This comment has been minimized.
This comment has been minimized.
|
Thanks for filing the issue!
The problem is Rust and GLSL align the data differently. This is kinda expected, although I completely agree that if we can force them to be the same, we totally should (like
I don't think the macros can pad automatically or even warn about this at compile time. |
This comment has been minimized.
This comment has been minimized.
theor
commented
Mar 2, 2017
•
|
Question about that: if I'm not mistaken, alignment and padding is implementation dependent (see Memory Layout section here: https://www.khronos.org/opengl/wiki/Interface_Block_(GLSL)#Layout_query). I think that means macros are not a good fit, as it might work on the build machine but not on another one running the binary, right ? Edit: Looking at the factory.update_sub_buffer gl impl, it uses glBufferSubData to update the whole buffer at once. I think in that case, we should do it field by field if necessary (ie. flag the code/gl mismatch). https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBufferSubData.xhtml |
This comment has been minimized.
This comment has been minimized.
There are defined layouts in GLSL:
Yes, totally agreed. See #1183 for our possible solution to avoid macro-generated structs.
That would be slower. I'd like to avoid calling the API too often. |
icefoxen commentedFeb 21, 2017
When creating a pipeline defined with:
My shader:
When I create a pipeline with
Factory::create_pipeline_simple()I get:DescriptorInit(ConstantBuffer("RectProperties", Some(Offset("u_Dest", 24))))When I move
rotationto the end of the uniform list it works, so I expect this is the driver refusing to handle non-aligned types. Can this either be padded automatically, or at least detected and warned against?Thanks.