From ebb1a07857fe25fdaa66b2f86303bc8fbd621cfe Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 10 Feb 2026 13:56:06 +0100 Subject: fix: Capture scene framebuffer before post-processing for CNN effect CNNEffect's "original" input was black because FadeEffect (priority 1) ran before CNNEffect (priority 1), fading the scene. Changed framebuffer capture to use framebuffer_a (scene output) instead of current_input (post-chain). Also add seq_compiler validation to detect post-process priority collisions within and across concurrent sequences, preventing similar render order issues. Updated stub_types.h WGPULoadOp enum values to match webgpu.h spec. Co-Authored-By: Claude Sonnet 4.5 --- src/gpu/effect.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gpu/effect.cc') diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc index 0662f26..b50acce 100644 --- a/src/gpu/effect.cc +++ b/src/gpu/effect.cc @@ -349,8 +349,9 @@ void MainSequence::render_frame(float global_time, float beat, float peak, WGPURenderPassColorAttachment capture_attachment = {}; capture_attachment.view = captured_view; capture_attachment.resolveTarget = nullptr; - capture_attachment.loadOp = WGPULoadOp_Load; + capture_attachment.loadOp = WGPULoadOp_Clear; capture_attachment.storeOp = WGPUStoreOp_Store; + capture_attachment.clearValue = {0.0f, 0.0f, 0.0f, 1.0f}; #if !defined(DEMO_CROSS_COMPILE_WIN32) capture_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; #endif @@ -362,10 +363,10 @@ void MainSequence::render_frame(float global_time, float beat, float peak, (float)width_, (float)height_, 0.0f, 1.0f); - // Use passthrough effect to copy current_input to captured_frame + // Use passthrough effect to copy framebuffer_a (scene) to captured_frame PostProcessEffect* passthrough = (PostProcessEffect*)passthrough_effect_.get(); - passthrough->update_bind_group(current_input); + passthrough->update_bind_group(framebuffer_view_a_); passthrough->render(capture_pass, 0, 0, 0, aspect_ratio); wgpuRenderPassEncoderEnd(capture_pass); -- cgit v1.2.3