Expand description
Backend-agnostic resolution of ParticleEmitter components into the
ParticleEmitterRecords the backends consume. Each record carries the
clamped emitter tunables, the resolved texture pool slot, and the per-frame
uniform builder the GPU compute + render passes share. Pure CPU; the
per-emitter GPU buffers themselves are allocated by the backend at init.
Structs§
- Particle
Emitter Record - Resolved per-emitter state threaded into the backend at init. The backend
allocates one GPU particle pool of
max_particlesslots per record and drives its compute + render passes from these fields each frame. - Particle
Spawn State - Per-emitter spawn accumulator. The runtime keeps one of these per record
and feeds the integer overflow into the compute kernel as
spawn_budgeteach frame. Fractional carry-over keeps low spawn rates honest even when the frame-time is below the per-particle interval.
Constants§
- MAX_
PARTICLES_ PER_ EMITTER - Upper bound on the per-emitter pool the backend will allocate. Each slot
is 32 bytes on the GPU (matching
Particleinshaders/particle_types.slang), so 65 536 slots = 2 MiB per emitter, already well past the visual point of diminishing returns for a billboard pool.
Functions§
- build_
particle_ records - Resolve a list of
ParticleEmittercomponents intoParticleEmitterRecords the backend can consume. Skips invisible emitters and emitters whose pool would be empty. An emitter’stexturecarries its cook-assignedTextureHandle, whose value is the texture’s albedo pool slot;texture_countis the pool size and bounds the handle. An out-of-range handle is logged and dropped; an emitter with notexturefalls back to slot 0 (white).