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

ParticleCompute

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)

GPU-based particle simulation via Vulkan compute shader.

Creates a compute pipeline that updates particle state (position, velocity, color, 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

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

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_color: (r, g, b, a) - end_color: (r, g, b, a) - start_scale: float - end_scale: float - emission_radius: float

get_particle_ssbo() Any

Return the particle SSBO buffer handle for use by the rendering pass.

get_particle_memory() Any

Return the particle SSBO memory handle.

property max_particles: int
property ready: bool
upload_initial_particles(particles: numpy.ndarray) None

Seed the GPU buffer with CPU-generated particle data.

Args: particles: Numpy array with dtype matching PARTICLE_DTYPE. Length must not exceed max_particles.

cleanup() None

Destroy all GPU resources.