summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-12 00:41:46 +0100
committerskal <pascal.massimino@gmail.com>2026-02-12 00:41:46 +0100
commitc6aa7f1be2d52d9b12507fd0d5381513f5c0b9b6 (patch)
tree1f03e78f575c4983539167d078c2e590db52d0c6 /src
parent05fdd78a78b83a322abc1b507325644662f3a9c1 (diff)
fix: PeakMeterEffect render() now properly overrides base class
The custom render() signature didn't match PostProcessEffect::render(), so it was never called. The base class method was used instead, which didn't update uniforms with the peak value. Fixed by: - Using correct override signature: render(pass, uniforms) - Calling PostProcessEffect::render() to handle standard rendering - Removed unused custom parameters (time, beat, peak_value, aspect_ratio) - Added override keyword to update_bind_group() Peak meter bar now displays correctly with audio_intensity. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src')
-rw-r--r--src/test_demo.cc25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/test_demo.cc b/src/test_demo.cc
index b564b9b..9cbeae2 100644
--- a/src/test_demo.cc
+++ b/src/test_demo.cc
@@ -86,30 +86,15 @@ class PeakMeterEffect : public PostProcessEffect {
create_post_process_pipeline(ctx_.device, ctx_.format, shader_code.c_str());
}
- void update_bind_group(WGPUTextureView input_view) {
+ void update_bind_group(WGPUTextureView input_view) override {
pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view,
uniforms_.get(), {});
}
- void render(WGPURenderPassEncoder pass, float time, float beat,
- float peak_value, float aspect_ratio) {
- (void)time;
- (void)beat;
-
- CommonPostProcessUniforms u = {
- .resolution = {(float)width_, (float)height_},
- .aspect_ratio = aspect_ratio,
- .time = time,
- .beat_time = beat,
- .beat_phase = beat,
- .audio_intensity = peak_value,
- ._pad = 0.0f,
- };
- uniforms_.update(ctx_.queue, u);
-
- wgpuRenderPassEncoderSetPipeline(pass, pipeline_);
- wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group_, 0, nullptr);
- wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0); // Full-screen triangle
+ void render(WGPURenderPassEncoder pass,
+ const CommonPostProcessUniforms& uniforms) override {
+ uniforms_.update(ctx_.queue, uniforms);
+ PostProcessEffect::render(pass, uniforms);
}
};