Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1786813002: Fix BGRA/RGBA readback conversions on mac (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGLCaps.h" 9 #include "GrGLCaps.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 fUseNonVBOVertexAndIndexDynamicData = false; 46 fUseNonVBOVertexAndIndexDynamicData = false;
47 fIsCoreProfile = false; 47 fIsCoreProfile = false;
48 fBindFragDataLocationSupport = false; 48 fBindFragDataLocationSupport = false;
49 fExternalTextureSupport = false; 49 fExternalTextureSupport = false;
50 fRectangleTextureSupport = false; 50 fRectangleTextureSupport = false;
51 fTextureSwizzleSupport = false; 51 fTextureSwizzleSupport = false;
52 fSRGBWriteControl = false; 52 fSRGBWriteControl = false;
53 fRGBA8888PixelsOpsAreSlow = false; 53 fRGBA8888PixelsOpsAreSlow = false;
54 fPartialFBOReadIsSlow = false; 54 fPartialFBOReadIsSlow = false;
55 fMipMapLevelAndLodControlSupport = false; 55 fMipMapLevelAndLodControlSupport = false;
56 fRGBAToBGRAReadbackConversionsAreSlow = false;
56 57
57 fBlitFramebufferSupport = kNone_BlitFramebufferSupport; 58 fBlitFramebufferSupport = kNone_BlitFramebufferSupport;
58 59
59 fShaderCaps.reset(new GrGLSLCaps(contextOptions)); 60 fShaderCaps.reset(new GrGLSLCaps(contextOptions));
60 61
61 this->init(contextOptions, ctxInfo, glInterface); 62 this->init(contextOptions, ctxInfo, glInterface);
62 } 63 }
63 64
64 void GrGLCaps::init(const GrContextOptions& contextOptions, 65 void GrGLCaps::init(const GrContextOptions& contextOptions,
65 const GrGLContextInfo& ctxInfo, 66 const GrGLContextInfo& ctxInfo,
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // We're assuming that on Windows Chromium we're using ANGLE. 260 // We're assuming that on Windows Chromium we're using ANGLE.
260 bool isANGLE = kANGLE_GrGLDriver == ctxInfo.driver() || 261 bool isANGLE = kANGLE_GrGLDriver == ctxInfo.driver() ||
261 kChromium_GrGLDriver == ctxInfo.driver(); 262 kChromium_GrGLDriver == ctxInfo.driver();
262 // Angle has slow read/write pixel paths for 32bit RGBA (but fast for BGRA). 263 // Angle has slow read/write pixel paths for 32bit RGBA (but fast for BGRA).
263 fRGBA8888PixelsOpsAreSlow = isANGLE; 264 fRGBA8888PixelsOpsAreSlow = isANGLE;
264 // On DX9 ANGLE reading a partial FBO is slow. TODO: Check whether this is s till true and 265 // On DX9 ANGLE reading a partial FBO is slow. TODO: Check whether this is s till true and
265 // check DX11 ANGLE. 266 // check DX11 ANGLE.
266 fPartialFBOReadIsSlow = isANGLE; 267 fPartialFBOReadIsSlow = isANGLE;
267 #endif 268 #endif
268 269
270 bool isMESA = kMesa_GrGLDriver == ctxInfo.driver();
271 bool isMAC = false;
272 #ifdef SK_BUILD_FOR_MAC
273 isMAC = true;
274 #endif
275
276 // Both mesa and mac have reduced performance if reading back an RGBA frameb uffer as BGRA or
277 // vis-versa.
278 fRGBAToBGRAReadbackConversionsAreSlow = isMESA || isMAC;
279
269 /************************************************************************** 280 /**************************************************************************
270 * GrShaderCaps fields 281 * GrShaderCaps fields
271 **************************************************************************/ 282 **************************************************************************/
272 283
273 // This must be called after fCoreProfile is set on the GrGLCaps 284 // This must be called after fCoreProfile is set on the GrGLCaps
274 this->initGLSL(ctxInfo); 285 this->initGLSL(ctxInfo);
275 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); 286 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
276 287
277 glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli ); 288 glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli );
278 289
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO ")); 1056 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO "));
1046 r.appendf("Use non-VBO for dynamic data: %s\n", 1057 r.appendf("Use non-VBO for dynamic data: %s\n",
1047 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 1058 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
1048 r.appendf("SRGB write contol: %s\n", (fSRGBWriteControl ? "YES" : "NO")); 1059 r.appendf("SRGB write contol: %s\n", (fSRGBWriteControl ? "YES" : "NO"));
1049 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO")); 1060 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO"));
1050 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO")); 1061 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO"));
1051 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor t ? "YES" : "NO")); 1062 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor t ? "YES" : "NO"));
1052 r.appendf("External texture support: %s\n", (fExternalTextureSupport ? "YES" : "NO")); 1063 r.appendf("External texture support: %s\n", (fExternalTextureSupport ? "YES" : "NO"));
1053 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES " : "NO")); 1064 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES " : "NO"));
1054 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" : "NO")); 1065 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" : "NO"));
1066 r.appendf("BGRA to RGBA readback conversions are slow: %s\n",
1067 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO"));
1055 1068
1056 r.append("Configs\n-------\n"); 1069 r.append("Configs\n-------\n");
1057 for (int i = 0; i < kGrPixelConfigCnt; ++i) { 1070 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
1058 r.appendf(" cfg: %d flags: 0x%04x, b_internal: 0x%08x s_internal: 0x%08 x, e_format: " 1071 r.appendf(" cfg: %d flags: 0x%04x, b_internal: 0x%08x s_internal: 0x%08 x, e_format: "
1059 "0x%08x, e_format_teximage: 0x%08x, e_type: 0x%08x, i_for_texi mage: 0x%08x, " 1072 "0x%08x, e_format_teximage: 0x%08x, e_type: 0x%08x, i_for_texi mage: 0x%08x, "
1060 "i_for_renderbuffer: 0x%08x\n", 1073 "i_for_renderbuffer: 0x%08x\n",
1061 i, 1074 i,
1062 fConfigTable[i].fFlags, 1075 fConfigTable[i].fFlags,
1063 fConfigTable[i].fFormats.fBaseInternalFormat, 1076 fConfigTable[i].fFormats.fBaseInternalFormat,
1064 fConfigTable[i].fFormats.fSizedInternalFormat, 1077 fConfigTable[i].fFormats.fSizedInternalFormat,
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { 1815 for (int j = 0; j < kExternalFormatUsageCnt; ++j) {
1803 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != 1816 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] !=
1804 fConfigTable[i].fFormats.fExternalFormat[j]); 1817 fConfigTable[i].fFormats.fExternalFormat[j]);
1805 } 1818 }
1806 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); 1819 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType);
1807 } 1820 }
1808 #endif 1821 #endif
1809 } 1822 }
1810 1823
1811 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1824 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {}
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698