rt(mtl): only gen mipmaps if the level count is greater than 1

This commit is contained in:
chyyran 2024-02-15 19:57:34 -05:00 committed by Ronny Chan
parent efdfd56e0e
commit edca0f1749
2 changed files with 8 additions and 3 deletions

View file

@ -79,7 +79,7 @@ impl LutTexture {
) )
} }
if config.mipmap { if config.mipmap && texture.mipmapLevelCount() > 1 {
mipmapper.generateMipmapsForTexture(&texture); mipmapper.generateMipmapsForTexture(&texture);
} }

View file

@ -133,7 +133,10 @@ impl OwnedTexture {
unsafe { unsafe {
encoder.copyFromTexture_toTexture(other, &self.texture); encoder.copyFromTexture_toTexture(other, &self.texture);
} }
encoder.generateMipmapsForTexture(&self.texture);
if self.texture.mipmapLevelCount() > 1 {
encoder.generateMipmapsForTexture(&self.texture);
}
Ok(()) Ok(())
} }
@ -142,7 +145,9 @@ impl OwnedTexture {
let mipmapper = cmd let mipmapper = cmd
.blitCommandEncoder() .blitCommandEncoder()
.ok_or(FilterChainError::FailedToCreateCommandBuffer)?; .ok_or(FilterChainError::FailedToCreateCommandBuffer)?;
mipmapper.generateMipmapsForTexture(&self.texture); if self.texture.mipmapLevelCount() > 1 {
mipmapper.generateMipmapsForTexture(&self.texture);
}
mipmapper.endEncoding(); mipmapper.endEncoding();
Ok(()) Ok(())
} }