From 64f977f6fbedf75d5edbc3963e002b593c8428d8 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 17 Feb 2026 08:16:03 +0100 Subject: style: Apply clang-format --- src/effects/particles_effect.cc | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/effects/particles_effect.cc') diff --git a/src/effects/particles_effect.cc b/src/effects/particles_effect.cc index 7a8d94d..35e9919 100644 --- a/src/effects/particles_effect.cc +++ b/src/effects/particles_effect.cc @@ -1,15 +1,15 @@ // This file is part of the 64k demo project. // It implements the Particles. -#include "util/fatal_error.h" #include "effects/particles_effect.h" -#include "gpu/gpu.h" #include "effects/shaders.h" +#include "gpu/gpu.h" +#include "util/fatal_error.h" #include Particles::Particles(const GpuContext& ctx, - const std::vector& inputs, - const std::vector& outputs) + const std::vector& inputs, + const std::vector& outputs) : Effect(ctx, inputs, outputs) { // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL) HEADLESS_RETURN_IF_NULL(ctx_.device); @@ -57,23 +57,27 @@ Particles::Particles(const GpuContext& ctx, ResourceBinding render_bindings[] = { {particles_buffer_, WGPUBufferBindingType_ReadOnlyStorage}, {uniforms_.get(), WGPUBufferBindingType_Uniform}}; - render_pass_ = gpu_create_render_pass(ctx_.device, WGPUTextureFormat_RGBA8Unorm, - particle_render_wgsl, render_bindings, 2); + render_pass_ = + gpu_create_render_pass(ctx_.device, WGPUTextureFormat_RGBA8Unorm, + particle_render_wgsl, render_bindings, 2); render_pass_.vertex_count = 6; render_pass_.instance_count = NUM_PARTICLES; } void Particles::render(WGPUCommandEncoder encoder, - const UniformsSequenceParams& params, - NodeRegistry& nodes) { + const UniformsSequenceParams& params, + NodeRegistry& nodes) { // Update uniforms uniforms_.update(ctx_.queue, params); // Run compute pass (particle simulation) - WGPUComputePassEncoder compute = wgpuCommandEncoderBeginComputePass(encoder, nullptr); + WGPUComputePassEncoder compute = + wgpuCommandEncoderBeginComputePass(encoder, nullptr); wgpuComputePassEncoderSetPipeline(compute, compute_pass_.pipeline); - wgpuComputePassEncoderSetBindGroup(compute, 0, compute_pass_.bind_group, 0, nullptr); - wgpuComputePassEncoderDispatchWorkgroups(compute, compute_pass_.workgroup_size_x, 1, 1); + wgpuComputePassEncoderSetBindGroup(compute, 0, compute_pass_.bind_group, 0, + nullptr); + wgpuComputePassEncoderDispatchWorkgroups( + compute, compute_pass_.workgroup_size_x, 1, 1); wgpuComputePassEncoderEnd(compute); // Run render pass (draw particles to output) @@ -87,12 +91,14 @@ void Particles::render(WGPUCommandEncoder encoder, .clearValue = {0.0, 0.0, 0.0, 1.0}}; WGPURenderPassDescriptor render_desc = { - .colorAttachmentCount = 1, - .colorAttachments = &color_attachment}; + .colorAttachmentCount = 1, .colorAttachments = &color_attachment}; - WGPURenderPassEncoder pass = wgpuCommandEncoderBeginRenderPass(encoder, &render_desc); + WGPURenderPassEncoder pass = + wgpuCommandEncoderBeginRenderPass(encoder, &render_desc); wgpuRenderPassEncoderSetPipeline(pass, render_pass_.pipeline); - wgpuRenderPassEncoderSetBindGroup(pass, 0, render_pass_.bind_group, 0, nullptr); - wgpuRenderPassEncoderDraw(pass, render_pass_.vertex_count, render_pass_.instance_count, 0, 0); + wgpuRenderPassEncoderSetBindGroup(pass, 0, render_pass_.bind_group, 0, + nullptr); + wgpuRenderPassEncoderDraw(pass, render_pass_.vertex_count, + render_pass_.instance_count, 0, 0); wgpuRenderPassEncoderEnd(pass); } -- cgit v1.2.3