Builtin Library
- ..
- README.md905 B
- bindings.yaml578 B
- shader.wgsl1.5 KB
README.md
particle_sort_indices
The last stage of a sprite emitter's per-frame back-to-front sort. One thread per draw slot, once per frame the emitter sorts.
Thread n reads which particle the sort put n-th and writes that particle's two triangles into the n-th six-index run of the emitter's index buffer. The vertices stay where the update pass wrote them, so the whole sort costs one u32 per slot of traffic and nothing per vertex.
A slot the sort resolved to the sentinel holds no live particle. It takes six copies of index 0 — three zero-area triangles the rasterizer drops.
Bindings
| Slot | Access | Contents |
|---|---|---|
indices | read | The final permutation: entry n names the slot that draws n-th. |
out_indices | read_write | The emitter's index buffer, six indices per slot. |
sortview | read | [0] slot count. |
Dispatch one workgroup of 64 per 64 slots.