Do push constants have alignment requirements? #3373
-
I am using a push constant to pass the model transform to my shader. This is a However, when I try uploading a
And the shader:
FWIW, I also tried uploading each item separately, e.g.:
This neither worked with the push constant expecting the full struct nor with individual push constants. I'm calculating the model matrix in the shader, but that works just fine (I use it and the What's going on with the push constant that's preventing this from working? -- Edit -- Having played a bit more and hardcoding some values in the shader, I've narrowed the issue down to the scale. Although the data size meets the requirements, so I ned to take alignment into account somehow? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Push constants still follow std430 rules (i.e. wgsl block's rules for storage buffers).
|
Beta Was this translation helpful? Give feedback.
Push constants still follow std430 rules (i.e. wgsl block's rules for storage buffers).
translation
is at offset 0, size 8, alignment 8rotation
is at offset 8, size 8, alignment 4scale
is at offset 16, size 8, alignment 8tint
is at offset 32, size 16, alignment 16