Matrix of the form matCx2
not getting translated properly when in a uniform buffer
#4371
Open
Labels
area: naga back-end
Outputs of naga shader conversion
help required
We need community help to make this happen.
lang: GLSL
OpenGL Shading Language
lang: SPIR-V
Vulkan's Shading Language
naga
Shader Translator
type: bug
Something isn't working
Milestone
WGSL expects a
matCx2
to have a matrix stride of 8 (inner vector components to be aligned to 8 bytes including itself).SPIR-V/GLSL/HLSL expect a
matCx2
to have a matrix stride of 16 (inner vector components to be aligned to 16 bytes including itself).Solution
Replace
matCx2
with a sequence ofC
vec2
's (sincevec2
s alignment is 8) and reconstruct the matrix in the shader.References
WGSL Alignment and Size
GLSL Standard Uniform Block Layout
HLSL DirectXShaderCompiler Buffer-Packing Wiki
Vulkan Offset and Stride Assignment
Related issues
gfx-rs/naga#1400 (gfx-rs/naga#1400 (comment)), #4375, #4376 - inverse of this issue (concerning the frontends)
The text was updated successfully, but these errors were encountered: