From 1bf5d7efca06a7ebaa6c91c1ce10c6bec97968b2 Mon Sep 17 00:00:00 2001 From: chyyran Date: Wed, 11 Sep 2024 18:52:29 -0400 Subject: [PATCH] rt(d3d11): draw final pass to output targets --- librashader-runtime-d3d11/src/filter_chain.rs | 23 ++++++++++++++++++- librashader-runtime-d3d11/tests/triangle.rs | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/librashader-runtime-d3d11/src/filter_chain.rs b/librashader-runtime-d3d11/src/filter_chain.rs index 169bf9a..7ca2256 100644 --- a/librashader-runtime-d3d11/src/filter_chain.rs +++ b/librashader-runtime-d3d11/src/filter_chain.rs @@ -495,11 +495,32 @@ impl FilterChainD3D11 { // try to hint the optimizer assert_eq!(last.len(), 1); if let Some(pass) = last.iter_mut().next() { + let index = passes_len - 1; source.filter = pass.config.filter; source.wrap_mode = pass.config.wrap_mode; + + // Draw to output_framebuffers for proper handling of feedback. + + let feedback_target = &self.output_framebuffers[index]; pass.draw( &ctx, - passes_len - 1, + index, + &self.common, + pass.config.get_frame_count(frame_count), + options, + viewport, + &original, + &source, + RenderTarget::viewport_with_output( + &feedback_target.create_render_target_view()?, + viewport, + ), + QuadType::Final, + )?; + + pass.draw( + &ctx, + index, &self.common, pass.config.get_frame_count(frame_count), options, diff --git a/librashader-runtime-d3d11/tests/triangle.rs b/librashader-runtime-d3d11/tests/triangle.rs index cc3d924..5d678e8 100644 --- a/librashader-runtime-d3d11/tests/triangle.rs +++ b/librashader-runtime-d3d11/tests/triangle.rs @@ -12,10 +12,10 @@ use librashader_runtime_d3d11::options::FilterChainOptionsD3D11; // const FILTER_PATH: &str = // "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID].slangp"; -const FILTER_PATH: &str = "../test/shaders_slang/crt/crt-royale.slangp"; +// const FILTER_PATH: &str = "../test/shaders_slang/crt/crt-royale.slangp"; // const FILTER_PATH: &str = "../test/slang-shaders/test/history.slangp"; -// const FILTER_PATH: &str = "../test/slang-shaders/test/feedback.slangp"; +const FILTER_PATH: &str = "../test/shaders_slang/test/feedback.slangp"; // const FILTER_PATH: &str = "../test/shaders_slang/crt/crt-royale.slangp"; const IMAGE_PATH: &str = "../triangle.png";