From 8935ab28e96b7406125f50a7f7f8b8dea455a6d4 Mon Sep 17 00:00:00 2001 From: chyyran Date: Sun, 4 Dec 2022 22:36:14 -0500 Subject: [PATCH] rt: allow specifying frame_direction --- librashader-runtime-d3d11/src/filter_chain.rs | 5 +++-- librashader-runtime-d3d11/src/options.rs | 1 + librashader-runtime-gl/src/filter_chain/filter_impl.rs | 6 +++--- librashader-runtime-gl/src/options.rs | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/librashader-runtime-d3d11/src/filter_chain.rs b/librashader-runtime-d3d11/src/filter_chain.rs index 0375ffb..193cead 100644 --- a/librashader-runtime-d3d11/src/filter_chain.rs +++ b/librashader-runtime-d3d11/src/filter_chain.rs @@ -485,6 +485,7 @@ impl FilterChainD3D11 { return Ok(()); } + let frame_direction = options.map(|f| f.frame_direction).unwrap_or(1); let filter = passes[0].config.filter; let wrap_mode = passes[0].config.wrap_mode; @@ -551,7 +552,7 @@ impl FilterChainD3D11 { } else { frame_count } as u32, - 1, + frame_direction, viewport, &original, &source, @@ -581,7 +582,7 @@ impl FilterChainD3D11 { } else { frame_count } as u32, - 1, + frame_direction, viewport, &original, &source, diff --git a/librashader-runtime-d3d11/src/options.rs b/librashader-runtime-d3d11/src/options.rs index 77b6836..571cdb2 100644 --- a/librashader-runtime-d3d11/src/options.rs +++ b/librashader-runtime-d3d11/src/options.rs @@ -2,6 +2,7 @@ #[derive(Debug, Clone)] pub struct FrameOptionsD3D11 { pub clear_history: bool, + pub frame_direction: i32, } #[repr(C)] diff --git a/librashader-runtime-gl/src/filter_chain/filter_impl.rs b/librashader-runtime-gl/src/filter_chain/filter_impl.rs index 7abe17c..369a288 100644 --- a/librashader-runtime-gl/src/filter_chain/filter_impl.rs +++ b/librashader-runtime-gl/src/filter_chain/filter_impl.rs @@ -437,6 +437,7 @@ impl FilterChainImpl { if passes.is_empty() { return Ok(()); } + let frame_direction = options.map(|f| f.frame_direction).unwrap_or(1); // do not need to rebind FBO 0 here since first `draw` will // bind automatically. @@ -509,8 +510,7 @@ impl FilterChainImpl { } else { count } as u32, - // todo: put this in options - 1, + frame_direction, viewport, &original, &source, @@ -536,7 +536,7 @@ impl FilterChainImpl { } else { count } as u32, - 1, + frame_direction, viewport, &original, &source, diff --git a/librashader-runtime-gl/src/options.rs b/librashader-runtime-gl/src/options.rs index 2f67d13..2bf869d 100644 --- a/librashader-runtime-gl/src/options.rs +++ b/librashader-runtime-gl/src/options.rs @@ -2,6 +2,7 @@ #[derive(Debug, Clone)] pub struct FrameOptionsGL { pub clear_history: bool, + pub frame_direction: i32, } #[repr(C)]