diff --git a/librashader-runtime-vk/src/filter_chain.rs b/librashader-runtime-vk/src/filter_chain.rs index d78d246..67328c5 100644 --- a/librashader-runtime-vk/src/filter_chain.rs +++ b/librashader-runtime-vk/src/filter_chain.rs @@ -201,8 +201,13 @@ impl FilterChain { let (passes, semantics) = FilterChain::load_preset(preset.shaders, &preset.textures)?; let device = vulkan.try_into()?; + let mut frames_in_flight = options.map(|o| o.frames_in_flight).unwrap_or(0); + if frames_in_flight == 0 { + frames_in_flight = 3; + } + // initialize passes - let filters = Self::init_passes(&device, passes, &semantics, 3)?; + let filters = Self::init_passes(&device, passes, &semantics, frames_in_flight)?; let luts = FilterChain::load_luts(&device, &preset.textures)?; let samplers = SamplerSet::new(&device.device)?; diff --git a/librashader-runtime-vk/src/options.rs b/librashader-runtime-vk/src/options.rs index 2aa83b0..87f0733 100644 --- a/librashader-runtime-vk/src/options.rs +++ b/librashader-runtime-vk/src/options.rs @@ -14,6 +14,8 @@ pub struct FrameOptions { #[repr(C)] #[derive(Debug, Clone)] pub struct FilterChainOptions { + /// The number of frames in flight to keep. If zero, defaults to three. + pub frames_in_flight: u32, /// Whether or not to explicitly disable mipmap generation regardless of shader preset settings. pub force_no_mipmaps: bool, }