gfx-rs/wgpu

[wgsl-in] Align attribute not being propagated to struct alignment

teoxoy opened this issue · 1 comments

With the changes in gfx-rs/naga#1812 this issue became apparent.

For instance the following example fails validation but shouldn't.

struct S {
    @align(16) // <- should propagate alignment to struct here
    a: u32,
}

struct Test {
    a: u32,
    b: S, // <- validation fails here because b has offset 4 but shouldn't since alignment of S should be 16
}

This is because the layouter is not aware of overridden alignment of struct members.

https://github.com/gfx-rs/naga/blob/43cd0eceddfac4c44c9a4fc4e9d156dfd1abba57/src/proc/layouter.rs#L187-L204

We most likely have to add alignment information in the IR (either on the struct or struct members).

Any timeline or updates on this issue? It becomes especially tedious manually adding padding with uniform buffers as they have strict requirement.s