-
Notifications
You must be signed in to change notification settings - Fork 353
Closed
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues
Milestone
Description
After the span, offset and align discussion I wonder if the right idea is to just remove offset.
Proposal
We spec the alignment and span of each type that can be put in a buffer, this is partially done already with the Alignment table in the spec. So, we spec something along the lines of:
| type | align | span |
| vec2 | 8 | 8 |
| vec3 | 16 | 16 |
| vec4 | 16 | 16 |
| f32 | 4 | 4 |
| ... |
We can then, if desired, update the various compilers to dump out the offsets for a given struct to make matching up to the API side easier (would this be useful as a reflection API?)
Future
If, in the future, we want packed types, we add a [[packed]] decoration to structs, at that point, all members of the struct would be tightly packed they'd all have a span of their exact type size (so vec3 spans 12) and there would be no padding injected between them.
kvark
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues