diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-01 01:47:41 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-01 01:47:41 +0100 |
| commit | b2d4d2cd06e28b012115bdafaa0bd015888d5452 (patch) | |
| tree | e1fd467dff6fead734cfbf366ce4df7085dc5efb /src/gpu | |
| parent | e6e34e551a73e65301685071445aaec9aaf60fd2 (diff) | |
Chore: Apply clang-format to the codebase
Diffstat (limited to 'src/gpu')
| -rw-r--r-- | src/gpu/demo_effects.cc | 3 | ||||
| -rw-r--r-- | src/gpu/demo_effects.h | 5 | ||||
| -rw-r--r-- | src/gpu/effect.cc | 3 | ||||
| -rw-r--r-- | src/gpu/effect.h | 7 | ||||
| -rw-r--r-- | src/gpu/effects/distort_effect.cc | 3 | ||||
| -rw-r--r-- | src/gpu/effects/heptagon_effect.cc | 3 | ||||
| -rw-r--r-- | src/gpu/effects/particles_effect.cc | 3 | ||||
| -rw-r--r-- | src/gpu/effects/post_process_helper.cc | 11 | ||||
| -rw-r--r-- | src/gpu/effects/post_process_helper.h | 3 |
9 files changed, 24 insertions, 17 deletions
diff --git a/src/gpu/demo_effects.cc b/src/gpu/demo_effects.cc index d92d4e9..36fd16e 100644 --- a/src/gpu/demo_effects.cc +++ b/src/gpu/demo_effects.cc @@ -9,5 +9,6 @@ void LoadTimeline(MainSequence& main_seq, WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format) { // This function is defined in src/generated/timeline.cc // and its definition should not be here. - // This file is now essentially a placeholder that includes the main effects header. + // This file is now essentially a placeholder that includes the main effects + // header. } diff --git a/src/gpu/demo_effects.h b/src/gpu/demo_effects.h index 2d495f3..fb8d531 100644 --- a/src/gpu/demo_effects.h +++ b/src/gpu/demo_effects.h @@ -3,9 +3,9 @@ #pragma once #include "effect.h" -#include "gpu/gpu.h" #include "gpu/effects/post_process_helper.h" #include "gpu/effects/shaders.h" +#include "gpu/gpu.h" #include <memory> static const int NUM_PARTICLES = 10000; @@ -43,7 +43,8 @@ class ParticlesEffect : public Effect { class PassthroughEffect : public PostProcessEffect { public: - PassthroughEffect(WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format); + PassthroughEffect(WGPUDevice device, WGPUQueue queue, + WGPUTextureFormat format); void update_bind_group(WGPUTextureView input_view) override; }; diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc index 997946c..81d5952 100644 --- a/src/gpu/effect.cc +++ b/src/gpu/effect.cc @@ -128,7 +128,8 @@ void MainSequence::init(WGPUDevice d, WGPUQueue q, WGPUTextureFormat f, format = f; create_framebuffers(width, height); - passthrough_effect_ = std::make_unique<PassthroughEffect>(device, queue, format); + passthrough_effect_ = + std::make_unique<PassthroughEffect>(device, queue, format); for (ActiveSequence& entry : sequences_) { entry.seq->init(this); diff --git a/src/gpu/effect.h b/src/gpu/effect.h index 488e92e..51b3883 100644 --- a/src/gpu/effect.h +++ b/src/gpu/effect.h @@ -15,8 +15,8 @@ class PostProcessEffect; class Effect { public: - Effect(WGPUDevice device, WGPUQueue queue) - : device_(device), queue_(queue) {} + Effect(WGPUDevice device, WGPUQueue queue) : device_(device), queue_(queue) { + } virtual ~Effect() = default; virtual void init(MainSequence* demo) { (void)demo; @@ -49,7 +49,8 @@ class Effect { class PostProcessEffect : public Effect { public: PostProcessEffect(WGPUDevice device, WGPUQueue queue) - : Effect(device, queue) {} + : Effect(device, queue) { + } bool is_post_process() const override { return true; } diff --git a/src/gpu/effects/distort_effect.cc b/src/gpu/effects/distort_effect.cc index 1f2b8fc..d9aa308 100644 --- a/src/gpu/effects/distort_effect.cc +++ b/src/gpu/effects/distort_effect.cc @@ -11,7 +11,8 @@ DistortEffect::DistortEffect(WGPUDevice device, WGPUQueue queue, uniforms_ = gpu_create_buffer(device_, sizeof(float) * 4, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst); - pipeline_ = create_post_process_pipeline(device_, format, distort_shader_wgsl); + pipeline_ = + create_post_process_pipeline(device_, format, distort_shader_wgsl); } void DistortEffect::render(WGPURenderPassEncoder pass, float t, float b, float i, float a) { diff --git a/src/gpu/effects/heptagon_effect.cc b/src/gpu/effects/heptagon_effect.cc index 64e4b47..c982912 100644 --- a/src/gpu/effects/heptagon_effect.cc +++ b/src/gpu/effects/heptagon_effect.cc @@ -12,7 +12,8 @@ HeptagonEffect::HeptagonEffect(WGPUDevice device, WGPUQueue queue, gpu_create_buffer(device_, sizeof(float) * 4, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst); ResourceBinding bindings[] = {{uniforms_, WGPUBufferBindingType_Uniform}}; - pass_ = gpu_create_render_pass(device_, format, main_shader_wgsl, bindings, 1); + pass_ = + gpu_create_render_pass(device_, format, main_shader_wgsl, bindings, 1); pass_.vertex_count = 21; } void HeptagonEffect::render(WGPURenderPassEncoder pass, float t, float b, diff --git a/src/gpu/effects/particles_effect.cc b/src/gpu/effects/particles_effect.cc index f2ef96b..6218af9 100644 --- a/src/gpu/effects/particles_effect.cc +++ b/src/gpu/effects/particles_effect.cc @@ -18,7 +18,8 @@ ParticlesEffect::ParticlesEffect(WGPUDevice device, WGPUQueue queue, WGPUBufferUsage_Storage | WGPUBufferUsage_Vertex, init_p.data()); ResourceBinding cb[] = {{particles_buffer_, WGPUBufferBindingType_Storage}, {uniforms_, WGPUBufferBindingType_Uniform}}; - compute_pass_ = gpu_create_compute_pass(device_, particle_compute_wgsl, cb, 2); + compute_pass_ = + gpu_create_compute_pass(device_, particle_compute_wgsl, cb, 2); compute_pass_.workgroup_size_x = (NUM_PARTICLES + 63) / 64; ResourceBinding rb[] = { {particles_buffer_, WGPUBufferBindingType_ReadOnlyStorage}, diff --git a/src/gpu/effects/post_process_helper.cc b/src/gpu/effects/post_process_helper.cc index 7c64844..db89d77 100644 --- a/src/gpu/effects/post_process_helper.cc +++ b/src/gpu/effects/post_process_helper.cc @@ -6,9 +6,9 @@ #include <cstring> // Helper to create a standard post-processing pipeline -WGPURenderPipeline -create_post_process_pipeline(WGPUDevice device, WGPUTextureFormat format, - const char* shader_code) { +WGPURenderPipeline create_post_process_pipeline(WGPUDevice device, + WGPUTextureFormat format, + const char* shader_code) { WGPUShaderModuleDescriptor shader_desc = {}; WGPUShaderSourceWGSL wgsl_src = {}; wgsl_src.chain.sType = WGPUSType_ShaderSourceWGSL; @@ -63,9 +63,8 @@ create_post_process_pipeline(WGPUDevice device, WGPUTextureFormat format, // --- PostProcess Implementation Helper --- void pp_update_bind_group(WGPUDevice device, WGPURenderPipeline pipeline, - WGPUBindGroup* bind_group, - WGPUTextureView input_view, - GpuBuffer uniforms) { + WGPUBindGroup* bind_group, WGPUTextureView input_view, + GpuBuffer uniforms) { if (*bind_group) wgpuBindGroupRelease(*bind_group); WGPUBindGroupLayout bgl = wgpuRenderPipelineGetBindGroupLayout(pipeline, 0); diff --git a/src/gpu/effects/post_process_helper.h b/src/gpu/effects/post_process_helper.h index 098687b..d3a37bd 100644 --- a/src/gpu/effects/post_process_helper.h +++ b/src/gpu/effects/post_process_helper.h @@ -7,7 +7,8 @@ #include <webgpu.h> // Helper to create a standard post-processing pipeline -WGPURenderPipeline create_post_process_pipeline(WGPUDevice device, WGPUTextureFormat format, +WGPURenderPipeline create_post_process_pipeline(WGPUDevice device, + WGPUTextureFormat format, const char* shader_code); // Helper to update bind group for post-processing effects |
