From 8b30cadfc19647487986d14dba9ddba7908dd1d0 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 12 Feb 2026 15:10:17 +0100 Subject: test_demo: Add beat-synchronized CNN post-processing with version selection - Add --cnn-version <1|2> flag to select between CNN v1 and v2 - Implement beat_phase modulation for dynamic blend in both CNN effects - Fix CNN v2 per-layer uniform buffer sharing (each layer needs own buffer) - Fix CNN v2 y-axis orientation to match render pass convention - Add Scene1Effect as base visual layer to test_demo timeline - Reorganize CNN v2 shaders into cnn_v2/ subdirectory - Update asset paths and documentation for new shader organization Co-Authored-By: Claude Sonnet 4.5 --- src/gpu/effects/cnn_effect.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/gpu/effects/cnn_effect.cc') diff --git a/src/gpu/effects/cnn_effect.cc b/src/gpu/effects/cnn_effect.cc index b2305b2..83a3365 100644 --- a/src/gpu/effects/cnn_effect.cc +++ b/src/gpu/effects/cnn_effect.cc @@ -79,12 +79,19 @@ void CNNEffect::resize(int width, int height) { void CNNEffect::render(WGPURenderPassEncoder pass, const CommonPostProcessUniforms& uniforms) { - (void)uniforms; if (!bind_group_) { fprintf(stderr, "CNN render: no bind_group\n"); return; } + float effective_blend = blend_amount_; + if (beat_modulated_) { + effective_blend = blend_amount_ * uniforms.beat_phase * beat_scale_; + } + + CNNLayerParams params = {layer_index_, effective_blend, {0.0f, 0.0f}}; + params_buffer_.update(ctx_.queue, params); + wgpuRenderPassEncoderSetPipeline(pass, pipeline_); wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group_, 0, nullptr); wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0); -- cgit v1.2.3