Skip to main content

Module gpu_particles

Module gpu_particles 

Source
Expand description

GPU particle system — compute shader driven, double-buffered, indirect draw.

Moves particle simulation entirely to the GPU for massive particle counts (50,000–131,072) at 60fps with zero CPU readback.

Architecture:

Frame N:
  1. Dispatch compute_update: SSBO_A → SSBO_B (simulate)
  2. Dispatch compute_emit: append new particles to SSBO_B
  3. Dispatch compute_compact: count alive particles → indirect draw buffer
  4. Draw: glDrawArraysIndirect reading from SSBO_B (render)
  5. Swap: A ↔ B

The CPU never reads particle data. Force fields, engine types, and corruption are passed as uniforms.

Structs§

ChaosFieldPresets
Pre-configured chaos field setups for different game contexts.
EngineDistribution
Distribution of particles across mathematical engine types for the chaos field.
GpuEmitterConfig
Configuration for emitting new particles on the GPU.
GpuForceField
A force field descriptor passed to the compute shader as a uniform.
GpuIndirectDrawParams
Indirect draw arguments (matches GL_DRAW_INDIRECT_BUFFER layout).
GpuParticle
Per-particle data stored in GPU SSBO. Must be 64 bytes, aligned for std430.
GpuParticleDispatchParams
Parameters passed to the compute shader update dispatch.
GpuParticleSystem
The main GPU particle system.
TemporalFieldManager
Manager for temporal force fields.
TemporalForceField
A force field with a limited lifetime that fades out.

Constants§

MAX_GPU_FORCE_FIELDS
Maximum number of simultaneous force fields in the compute shader.