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);
}

View file

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