diff options
| author | skal <pascal.massimino@gmail.com> | 2026-05-20 23:12:08 +0200 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-05-20 23:21:59 +0200 |
| commit | ca8acd5e7c0556bee7cb21f5ff280c5fd1f47801 (patch) | |
| tree | 3811886d12f075ba196f2a7ba2d05c0d5b43574b /src/effects/peak_meter_effect.cc | |
| parent | a91f89c8ea15665853176c05597760d0fcf6e0df (diff) | |
fix: audio & effects cleanup — dead code removal, simplifications
Diffstat (limited to 'src/effects/peak_meter_effect.cc')
| -rw-r--r-- | src/effects/peak_meter_effect.cc | 19 |
1 files changed, 6 insertions, 13 deletions
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<std::string>& inputs, const std::vector<std::string>& 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); } |
