Advanced
Lay out a WGSL uniform struct
layout(members) should return each member's byte offset and the struct's size by WGSL's rules for uniform structs: each member starts at the next multiple of its alignment, and the size rounds up to the largest alignment.
The starter packs everything tightly, like a JavaScript array. Fix both TODOs.
What Check tests
- The glow struct packs into 32 bytes
- A vec2f after a vec3f starts at 16
- The size rounds up to the largest alignment
- A vec3f followed by an f32 shares 16 bytes
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.