From 8d25820c9165a576360429590d76202fe467e66c Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 3 Mar 2023 11:24:57 -0800 Subject: [PATCH] Move screenshot pass out of basic_rendering, into normal_rendering This fixes a bug with avrecorder capturing a mostly white frame at the beginning of a wipe. This was because wipe_capture_start_rendering depends on basic_rendering and a wipe could occur before any 2d elements are batched for the current frame, thus producing a white frame when basic_rendering is passed. It only lasted for one frame because the PREVIOUS frame is used for the wipe itself. This is also why the white frame was not visible on screen. --- src/i_video_common.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/i_video_common.cpp b/src/i_video_common.cpp index ef76d1e58..e12cb712a 100644 --- a/src/i_video_common.cpp +++ b/src/i_video_common.cpp @@ -193,14 +193,16 @@ static InternalPassData build_pass_manager() ); basic_rendering->insert("pp_final_simple_blit", pp_simple_blit_pass); - basic_rendering->insert( + auto screenshot_rendering = std::make_shared(); + + screenshot_rendering->insert( "screenshot_prepare", [screenshot_pass, framebuffer_manager](PassManager&, Rhi&) { screenshot_pass->set_source(framebuffer_manager->current_post_color(), vid.width, vid.height); } ); - basic_rendering->insert("screenshot", screenshot_pass); + screenshot_rendering->insert("screenshot", screenshot_pass); // Composite-present takes the current postprocess result and outputs it to the default framebuffer. // It also renders imgui and presents the screen. @@ -233,6 +235,7 @@ static InternalPassData build_pass_manager() normal_rendering->insert("resource_manager", resource_manager); normal_rendering->insert("basic_rendering", basic_rendering); + normal_rendering->insert("screenshot_rendering", screenshot_rendering); normal_rendering->insert("composite_present_rendering", composite_present_rendering); // Wipe Start Screen Capture rendering @@ -305,14 +308,7 @@ static InternalPassData build_pass_manager() } ); wipe_rendering->insert("pp_final_wipe", pp_wipe_pass); - wipe_rendering->insert( - "screenshot_prepare", - [screenshot_pass, framebuffer_manager](PassManager&, Rhi&) - { - screenshot_pass->set_source(framebuffer_manager->current_post_color(), vid.width, vid.height); - } - ); - wipe_rendering->insert("screenshot", screenshot_pass); + wipe_rendering->insert("screenshot_rendering", screenshot_rendering); wipe_rendering->insert("composite_present_rendering", composite_present_rendering); InternalPassData ret;