-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issueswgsl resolvedResolved - waiting for a change to the WGSL specificationResolved - waiting for a change to the WGSL specification
Milestone
Description
For mat2x2, the stride between columns is 16 bytes in In a uniform buffer and 8 bytes in storage buffer.
As part of the resolution to #922, we decided to avoid having the user tell us the matrix stride.
Then consider code like this:
[[block]] struct S {
[[offset(0)]] M : mat2x2<f32>;
};
[[set(0), binding(1)]] var<storage> sbuf : S;
[[set(0), binding(1)]] var<storage> ubuf : S;
Then:
- ubuf.M[1][0] is 16 bytes into the buffer, and
- sbuf.M[1][0] is 8 bytes into the buffer
This is ... confusing for users.
Also, when generating SPIR-V code for the type, we have to split S into two types, which causes a lot of complexity.
I suggest adding a rule:
- If a type contains a mat2x2, then that type may not be used as the store type or inside the store type for both a uniform buffer and a storage buffer.
We already have a note in 3.4.6.2. Internal Layout of Values that says:
Note: Matrix values are laid out more compactly in the storage storage class than in the uniform storage class.
Thanks to @Kangz who raised this to prominence.
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issueswgsl resolvedResolved - waiting for a change to the WGSL specificationResolved - waiting for a change to the WGSL specification