Builtin Library
- ..
- README.md1.0 KB
- bindings.yaml227 B
- shader.wgsl1.4 KB
README.md
particle_census
Counts a particle emitter's live slots on the device. One invocation per slot
over the state buffer the update pass writes, applying the same test that pass
applies — a slot is alive while age < lifetime — and accumulating into a
two-slot u32 counter.
| Slot | Counts |
|---|---|
| 0 | live particles |
| 1 | live particles a dispatch has advanced (age > 0) |
The gap between the two is what a state buffer the simulation has not run over looks like: the emitter's spawns wrote slots at age 0, and nothing moved them.
Bindings (see bindings.yaml): particles (read array<f32>), census
(read_write array<atomic<u32>>), params (read array<f32>, whose
P_MAX_COUNT bounds the pass).
The particle module dispatches it for an emitter that has been asked to confirm
its population — sys:requestCensus(), or any sys:observe() — and reads the
counter back over the following frames. The answer reaches content through
observe().confirmation, carrying the simulated time it was taken at.