Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

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

SlotAccessContents
indicesreadThe final permutation: entry n names the slot that draws n-th.
out_indicesread_writeThe emitter's index buffer, six indices per slot.
sortviewread[0] slot count.

Dispatch one workgroup of 64 per 64 slots.