From ca8acd5e7c0556bee7cb21f5ff280c5fd1f47801 Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 20 May 2026 23:12:08 +0200 Subject: fix: audio & effects cleanup — dead code removal, simplifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/effects/peak_meter_effect.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/effects/peak_meter_effect.cc') diff --git a/src/effects/peak_meter_effect.cc b/src/effects/peak_meter_effect.cc index c2ef42e..8956e32 100644 --- a/src/effects/peak_meter_effect.cc +++ b/src/effects/peak_meter_effect.cc @@ -9,8 +9,7 @@ PeakMeter::PeakMeter(const GpuContext& ctx, const std::vector& inputs, const std::vector& outputs, float start_time, float end_time) - : Effect(ctx, inputs, outputs, start_time, end_time), pipeline_(nullptr), - bind_group_(nullptr) { + : Effect(ctx, inputs, outputs, start_time, end_time) { HEADLESS_RETURN_IF_NULL(ctx_.device); const char* shader_main = R"( @@ -58,15 +57,8 @@ PeakMeter::PeakMeter(const GpuContext& ctx, std::string shader_code = ShaderComposer::Get().Compose({"common_uniforms"}, shader_main); - pipeline_ = create_post_process_pipeline( - ctx_.device, WGPUTextureFormat_RGBA8Unorm, shader_code.c_str()); -} - -PeakMeter::~PeakMeter() { - if (bind_group_) - wgpuBindGroupRelease(bind_group_); - if (pipeline_) - wgpuRenderPipelineRelease(pipeline_); + pipeline_.set(create_post_process_pipeline( + ctx_.device, WGPUTextureFormat_RGBA8Unorm, shader_code.c_str())); } void PeakMeter::render(WGPUCommandEncoder encoder, @@ -75,9 +67,10 @@ void PeakMeter::render(WGPUCommandEncoder encoder, WGPUTextureView input_view = nodes.get_view(input_nodes_[0]); WGPUTextureView output_view = nodes.get_view(output_nodes_[0]); - pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view, + pp_update_bind_group(ctx_.device, pipeline_.get(), + bind_group_.get_address(), input_view, uniforms_buffer_.get(), {nullptr, 0}); - run_fullscreen_pass(encoder, pipeline_, bind_group_, output_view, + run_fullscreen_pass(encoder, pipeline_.get(), bind_group_.get(), output_view, WGPULoadOp_Load); } -- cgit v1.2.3