From 856f69113d7e5422e46db2ae1d86336e5640efd1 Mon Sep 17 00:00:00 2001 From: chyyran Date: Fri, 13 Sep 2024 00:47:05 -0400 Subject: [PATCH] rt(mtl): don't make mipmapper for history if not needed --- librashader-runtime-mtl/src/filter_chain.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/librashader-runtime-mtl/src/filter_chain.rs b/librashader-runtime-mtl/src/filter_chain.rs index 24df008..2dad5ff 100644 --- a/librashader-runtime-mtl/src/filter_chain.rs +++ b/librashader-runtime-mtl/src/filter_chain.rs @@ -206,10 +206,11 @@ impl FilterChainMetal { cmd: &ProtocolObject, input: &ProtocolObject, ) -> error::Result<()> { - let mipmapper = cmd - .blitCommandEncoder() - .ok_or(FilterChainError::FailedToCreateCommandBuffer)?; + if let Some(mut back) = self.history_framebuffers.pop_back() { + let mipmapper = cmd + .blitCommandEncoder() + .ok_or(FilterChainError::FailedToCreateCommandBuffer)?; if back.texture.height() != input.height() || back.texture.width() != input.width() || input.pixelFormat() != back.texture.pixelFormat() @@ -228,8 +229,6 @@ impl FilterChainMetal { back.copy_from(&mipmapper, input)?; mipmapper.endEncoding(); self.history_framebuffers.push_front(back); - } else { - mipmapper.endEncoding(); } Ok(()) }