Does wgpu always require 16 byte aligned arrays? #3156
-
I have a shader which is compiled from GLSL to SpirV via spirv-cross and then used in wgpu via Naga. The type is defined like so in GLSL:
The resulting layouts for these types look like this, after the module is created from the SPIR-V source:
At runtime, I get this error when trying to create a pipeline from this module:
I'm having a bit of trouble narrowing down the source of this error. Is this something wrong in my GLSL, or is it possibly something wrong in the way I am calling Naga or SPIR-V Cross? I.e. where does the array stride value get determined to be 16 rather than 12? I know I can solve this by adding a padding variable to my |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think you can probably call this a bug in Naga. The spirv/glsl frontends should translate this pattern to a valid module. The reason it's a problem is that glsl auto-pads to 16, whereas wgsl requires everything be properly aligned already |
Beta Was this translation helpful? Give feedback.
I think you can probably call this a bug in Naga. The spirv/glsl frontends should translate this pattern to a valid module. The reason it's a problem is that glsl auto-pads to 16, whereas wgsl requires everything be properly aligned already