[Impeller] Always use BGRA10_XR for wide gamut (flutter/engine#41385)

Fixes errors blitting offscreen textures to onscreen textures
when wide gamut is enabled due to the mismatching formats.
This commit is contained in:
Brandon DeRosier
2023-04-21 01:45:06 -07:00
committed by GitHub
parent 8333b64fc4
commit b98bc7c360
2 changed files with 2 additions and 15 deletions

View File

@@ -96,11 +96,7 @@ static BOOL IsWideGamutSupported() {
CGColorSpaceRef srgb = CGColorSpaceCreateWithName(kCGColorSpaceExtendedSRGB);
layer.colorspace = srgb;
CFRelease(srgb);
if (self.opaque) {
layer.pixelFormat = MTLPixelFormatBGR10_XR;
} else {
layer.pixelFormat = MTLPixelFormatBGRA10_XR;
}
layer.pixelFormat = MTLPixelFormatBGRA10_XR;
}
}

View File

@@ -10,15 +10,6 @@
namespace flutter {
static impeller::PixelFormat InferOffscreenLayerPixelFormat(impeller::PixelFormat pixel_format) {
switch (pixel_format) {
case impeller::PixelFormat::kB10G10R10XR:
return impeller::PixelFormat::kB10G10R10A10XR;
default:
return pixel_format;
}
}
IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(const fml::scoped_nsobject<CAMetalLayer>& layer,
const std::shared_ptr<IOSContext>& context)
: IOSSurface(context),
@@ -47,7 +38,7 @@ void IOSSurfaceMetalImpeller::UpdateStorageSizeIfNecessary() {
// |IOSSurface|
std::unique_ptr<Surface> IOSSurfaceMetalImpeller::CreateGPUSurface(GrDirectContext*) {
impeller_context_->UpdateOffscreenLayerPixelFormat(
InferOffscreenLayerPixelFormat(impeller::FromMTLPixelFormat(layer_.get().pixelFormat)));
impeller::FromMTLPixelFormat(layer_.get().pixelFormat));
return std::make_unique<GPUSurfaceMetalImpeller>(this, //
impeller_context_ //
);