Fix BGRA/RGBA readback conversions on mac
Reading back from a BGRA framebuffer as RGBA or vis-versa is slow on mac. On my early 2013 MBP, we see a 40% regression when using
the discrete GPU or a 13% regression on integrated.
This change adds a workaround which causes Mac to use the existing Mesa path and prefer readback from the same format as the
framebuffer.
BUG=581311
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1786813002
Review URL: https://codereview.chromium.org/1786813002
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index cf16291..376610d 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -345,6 +345,9 @@
bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; }
bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; }
+ bool rgbaToBgraReadbackConversionsAreSlow() const {
+ return fRGBAToBGRAReadbackConversionsAreSlow;
+ }
const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); }
@@ -413,6 +416,7 @@
bool fRectangleTextureSupport : 1;
bool fTextureSwizzleSupport : 1;
bool fMipMapLevelAndLodControlSupport : 1;
+ bool fRGBAToBGRAReadbackConversionsAreSlow : 1;
BlitFramebufferSupport fBlitFramebufferSupport;