Closed Dynamitos closed 4 years ago
Thanks for letting us know about this issue.
The simplest workaround for now would be to not use matrix types in your vertex-to-fragment structure, and instead either use multiple vectors (or an array of vectors).
There are a few other issues around matrix support for the GLSL/SPIR-V targets that are worth noting. In particular, matrixes with integer elements are not supported at this time.
Thanks for the fast response, honestly didnt expect one till monday.
I worked around it using arrays of vectors and replacing direct access with a getter, which constructs a 3x3 matrix in place, so only minimal coding effort was required. As for if this will impact performance, since additional function calls are involved, I'm not sure, but I'm still far away from the point of having to worry about that, so it's definitely no problem for now.
As of 29.06.2024 this issue still persists when compiling from slangc to GLSL / SPIRV
I'm trying to use slang to cross-compile a .slang shader to SPIR-V for Vulkan using the API. I have identified the problem to a struct which contains two 3x3 matrices, which is passed from the vertex to the pixel stage.
The slang compilation works with no problem, but when it is passed to glslang it gives the following error:
glslang: ERROR: shaders/lib/StaticMeshVertexInput.slang:201: 'layout' : matrix or packing qualifiers can only be used on a uniform or buffer
After a bit of debugging and looking through the slang-dump, i found these lines:
When removing the
row_major
qualifier, and rerunning glslangValidator(provided by the Vulkan SDK) manually, it compiles with no problem.For additional context, here is the C++ code used to generate this: