diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test_demo.cc | 25 |
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); } }; |
