[Impeller] disable lossy texture compression. (#170596)

Fixes https://github.com/flutter/flutter/issues/170056
Fixes https://github.com/flutter/flutter/issues/170089

Lossy texture compression can cause rendering artifacts in certain kinds
of images. Disable automatic application of it.
This commit is contained in:
Jonah Williams 2025-06-13 16:48:30 -07:00 committed by GitHub
parent c23b2d0498
commit c64e652bfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -321,7 +321,6 @@ ImageDecoderImpeller::UnsafeUploadTextureToPrivate(
texture_descriptor.format = pixel_format.value();
texture_descriptor.size = {image_info.width(), image_info.height()};
texture_descriptor.mip_count = texture_descriptor.size.MipCount();
texture_descriptor.compression_type = impeller::CompressionType::kLossy;
if (context->GetBackendType() == impeller::Context::BackendType::kMetal &&
resize_info.has_value()) {
// The MPS used to resize images on iOS does not require mip generation.
@ -370,7 +369,6 @@ ImageDecoderImpeller::UnsafeUploadTextureToPrivate(
resize_desc.format = pixel_format.value();
resize_desc.size = {resize_info->width(), resize_info->height()};
resize_desc.mip_count = resize_desc.size.MipCount();
resize_desc.compression_type = impeller::CompressionType::kLossy;
resize_desc.usage = impeller::TextureUsage::kShaderRead;
if (context->GetBackendType() == impeller::Context::BackendType::kMetal) {
// Resizing requires a MPS on Metal platforms.