simvx.graphics.renderer.particle_compute¶
GPU compute shader particle simulation.
Dispatches a compute shader to update particle positions, velocities, lifetimes, and visual properties entirely on the GPU — avoiding per-frame CPU-to-GPU uploads for particle data.
Module Contents¶
Classes¶
GPU-based particle simulation via Vulkan compute shader. |
Data¶
API¶
- simvx.graphics.renderer.particle_compute.__all__¶
[‘ParticleCompute’]
- simvx.graphics.renderer.particle_compute.log¶
‘getLogger(…)’
- class simvx.graphics.renderer.particle_compute.ParticleCompute(engine: Any)[source]¶
GPU-based particle simulation via Vulkan compute shader.
Creates a compute pipeline that updates particle state (position, velocity, colour, scale, lifetime) in an SSBO. The same SSBO can be bound by the graphics particle pass for zero-copy rendering.
Initialization
- setup(max_particles: int = 65536) None[source]¶
Create compute pipeline, SSBO, and descriptor set.
Args: max_particles: Maximum number of particles in the simulation buffer.
- dispatch(cmd: Any, dt: float, emitter_config: dict) None[source]¶
Dispatch the compute shader to simulate one step.
Args: cmd: Active command buffer (must be outside a render pass). dt: Delta time in seconds. emitter_config: Dict with emitter parameters: - emitter_pos: (x, y, z) - gravity: (x, y, z) - damping: float - initial_velocity: (x, y, z) - velocity_spread: float - start_colour: (r, g, b, a) - end_colour: (r, g, b, a) - start_scale: float - end_scale: float - emission_radius: float
- get_particle_ssbo() Any[source]¶
Return the particle SSBO buffer handle for use by the rendering pass.
- render(cmd: Any, particle_pass: Any, view_proj: numpy.ndarray, camera_right: numpy.ndarray, camera_up: numpy.ndarray, extent: tuple[int, int]) None[source]¶
Draw the GPU-simulated particles using the shared billboard pipeline.
Reuses the same graphics pipeline as
ParticlePass(identical particle.vert / particle.frag shaders) but binds our own compute- owned SSBO in place of the pass’s CPU-uploaded one. A lazy-allocated descriptor set matchingParticlePass._ssbo_layoutpoints at the compute buffer so no per-frame upload is needed.