summaryrefslogtreecommitdiff
path: root/src/effects/particles_effect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects/particles_effect.cc')
-rw-r--r--src/effects/particles_effect.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/effects/particles_effect.cc b/src/effects/particles_effect.cc
index d83f303..3c9feb7 100644
--- a/src/effects/particles_effect.cc
+++ b/src/effects/particles_effect.cc
@@ -12,11 +12,9 @@ Particles::Particles(const GpuContext& ctx,
const std::vector<std::string>& outputs, float start_time,
float end_time)
: Effect(ctx, inputs, outputs, start_time, end_time) {
- // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
HEADLESS_RETURN_IF_NULL(ctx_.device);
- // Initialize uniforms
- uniforms_.init(ctx_.device);
+ init_uniforms_buffer();
// Initialize particles buffer
std::vector<Particle> init_p(NUM_PARTICLES);
@@ -49,7 +47,7 @@ Particles::Particles(const GpuContext& ctx,
// Create compute shader (particle simulation)
ResourceBinding compute_bindings[] = {
{particles_buffer_, WGPUBufferBindingType_Storage},
- {uniforms_.get(), WGPUBufferBindingType_Uniform}};
+ {uniforms_buffer_.get(), WGPUBufferBindingType_Uniform}};
compute_pass_ = gpu_create_compute_pass(ctx_.device, particle_compute_wgsl,
compute_bindings, 2);
compute_pass_.workgroup_size_x = (NUM_PARTICLES + 63) / 64;
@@ -57,7 +55,7 @@ Particles::Particles(const GpuContext& ctx,
// Create render shader (particle rendering)
ResourceBinding render_bindings[] = {
{particles_buffer_, WGPUBufferBindingType_ReadOnlyStorage},
- {uniforms_.get(), WGPUBufferBindingType_Uniform}};
+ {uniforms_buffer_.get(), WGPUBufferBindingType_Uniform}};
render_pass_ =
gpu_create_render_pass(ctx_.device, WGPUTextureFormat_RGBA8Unorm,
particle_render_wgsl, render_bindings, 2);
@@ -69,7 +67,7 @@ void Particles::render(WGPUCommandEncoder encoder,
const UniformsSequenceParams& params,
NodeRegistry& nodes) {
// Update uniforms
- uniforms_.update(ctx_.queue, params);
+ uniforms_buffer_.update(ctx_.queue, params);
// Run compute pass (particle simulation)
WGPUComputePassEncoder compute =