rt(mtl): don't make mipmapper for history if not needed

This commit is contained in:
chyyran 2024-09-13 00:47:05 -04:00 committed by Ronny Chan
parent 477d0ae67c
commit 856f69113d

View file

@ -206,10 +206,11 @@ impl FilterChainMetal {
cmd: &ProtocolObject<dyn MTLCommandBuffer>, cmd: &ProtocolObject<dyn MTLCommandBuffer>,
input: &ProtocolObject<dyn MTLTexture>, input: &ProtocolObject<dyn MTLTexture>,
) -> error::Result<()> { ) -> error::Result<()> {
if let Some(mut back) = self.history_framebuffers.pop_back() {
let mipmapper = cmd let mipmapper = cmd
.blitCommandEncoder() .blitCommandEncoder()
.ok_or(FilterChainError::FailedToCreateCommandBuffer)?; .ok_or(FilterChainError::FailedToCreateCommandBuffer)?;
if let Some(mut back) = self.history_framebuffers.pop_back() {
if back.texture.height() != input.height() if back.texture.height() != input.height()
|| back.texture.width() != input.width() || back.texture.width() != input.width()
|| input.pixelFormat() != back.texture.pixelFormat() || input.pixelFormat() != back.texture.pixelFormat()
@ -228,8 +229,6 @@ impl FilterChainMetal {
back.copy_from(&mipmapper, input)?; back.copy_from(&mipmapper, input)?;
mipmapper.endEncoding(); mipmapper.endEncoding();
self.history_framebuffers.push_front(back); self.history_framebuffers.push_front(back);
} else {
mipmapper.endEncoding();
} }
Ok(()) Ok(())
} }