diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-17 08:16:03 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-17 08:16:03 +0100 |
| commit | 64f977f6fbedf75d5edbc3963e002b593c8428d8 (patch) | |
| tree | ef711b63d34b5c3f5ecc93d46a0a3ab0b6d26a6f /src/effects/flash_effect.cc | |
| parent | 8c9332c16b44270921eb1b6a2886717eb3435d5d (diff) | |
style: Apply clang-format
Diffstat (limited to 'src/effects/flash_effect.cc')
| -rw-r--r-- | src/effects/flash_effect.cc | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/effects/flash_effect.cc b/src/effects/flash_effect.cc index 9f0a6fa..ac46562 100644 --- a/src/effects/flash_effect.cc +++ b/src/effects/flash_effect.cc @@ -2,21 +2,19 @@ // Pulses white based on beat timing #include "effects/flash_effect.h" -#include "gpu/post_process_helper.h" #include "effects/shaders.h" +#include "gpu/post_process_helper.h" #include "util/fatal_error.h" -Flash::Flash(const GpuContext& ctx, - const std::vector<std::string>& inputs, - const std::vector<std::string>& outputs) +Flash::Flash(const GpuContext& ctx, const std::vector<std::string>& inputs, + const std::vector<std::string>& outputs) : Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), sampler_(nullptr), dummy_texture_(nullptr), dummy_texture_view_(nullptr) { HEADLESS_RETURN_IF_NULL(ctx_.device); uniforms_buffer_.init(ctx_.device); - pipeline_ = create_post_process_pipeline(ctx_.device, - WGPUTextureFormat_RGBA8Unorm, - flash_shader_wgsl); + pipeline_ = create_post_process_pipeline( + ctx_.device, WGPUTextureFormat_RGBA8Unorm, flash_shader_wgsl); // Create dummy sampler (scene effects don't use texture input) WGPUSamplerDescriptor sampler_desc = {}; @@ -40,16 +38,20 @@ Flash::Flash(const GpuContext& ctx, } Flash::~Flash() { - if (bind_group_) wgpuBindGroupRelease(bind_group_); - if (pipeline_) wgpuRenderPipelineRelease(pipeline_); - if (sampler_) wgpuSamplerRelease(sampler_); - if (dummy_texture_view_) wgpuTextureViewRelease(dummy_texture_view_); - if (dummy_texture_) wgpuTextureRelease(dummy_texture_); + if (bind_group_) + wgpuBindGroupRelease(bind_group_); + if (pipeline_) + wgpuRenderPipelineRelease(pipeline_); + if (sampler_) + wgpuSamplerRelease(sampler_); + if (dummy_texture_view_) + wgpuTextureViewRelease(dummy_texture_view_); + if (dummy_texture_) + wgpuTextureRelease(dummy_texture_); } void Flash::render(WGPUCommandEncoder encoder, - const UniformsSequenceParams& params, - NodeRegistry& nodes) { + const UniformsSequenceParams& params, NodeRegistry& nodes) { // Get output view (scene effects typically write to output, ignore input) WGPUTextureView output_view = nodes.get_view(output_nodes_[0]); @@ -57,8 +59,9 @@ void Flash::render(WGPUCommandEncoder encoder, uniforms_buffer_.update(ctx_.queue, params); // Update bind group (use dummy texture for scene effect) - pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, dummy_texture_view_, - uniforms_buffer_.get(), {nullptr, 0}); + pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, + dummy_texture_view_, uniforms_buffer_.get(), + {nullptr, 0}); // Render pass WGPURenderPassColorAttachment color_attachment = {}; @@ -72,7 +75,8 @@ void Flash::render(WGPUCommandEncoder encoder, pass_desc.colorAttachmentCount = 1; pass_desc.colorAttachments = &color_attachment; - WGPURenderPassEncoder pass = wgpuCommandEncoderBeginRenderPass(encoder, &pass_desc); + WGPURenderPassEncoder pass = + wgpuCommandEncoderBeginRenderPass(encoder, &pass_desc); wgpuRenderPassEncoderSetPipeline(pass, pipeline_); wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group_, 0, nullptr); wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0); |
