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

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

Issue 1830303002: Require sRGB write control for sRGB support. Add flag to GrPaint to suppress linear -> sRGB convers… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added comment to srgbSupport() 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
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 28 matching lines...) Expand all
39 fES2CompatibilitySupport = false; 39 fES2CompatibilitySupport = false;
40 fMultisampleDisableSupport = false; 40 fMultisampleDisableSupport = false;
41 fDrawIndirectSupport = false; 41 fDrawIndirectSupport = false;
42 fMultiDrawIndirectSupport = false; 42 fMultiDrawIndirectSupport = false;
43 fBaseInstanceSupport = false; 43 fBaseInstanceSupport = false;
44 fUseNonVBOVertexAndIndexDynamicData = false; 44 fUseNonVBOVertexAndIndexDynamicData = false;
45 fIsCoreProfile = false; 45 fIsCoreProfile = false;
46 fBindFragDataLocationSupport = false; 46 fBindFragDataLocationSupport = false;
47 fRectangleTextureSupport = false; 47 fRectangleTextureSupport = false;
48 fTextureSwizzleSupport = false; 48 fTextureSwizzleSupport = false;
49 fSRGBWriteControl = false;
50 fRGBA8888PixelsOpsAreSlow = false; 49 fRGBA8888PixelsOpsAreSlow = false;
51 fPartialFBOReadIsSlow = false; 50 fPartialFBOReadIsSlow = false;
52 fMipMapLevelAndLodControlSupport = false; 51 fMipMapLevelAndLodControlSupport = false;
53 fRGBAToBGRAReadbackConversionsAreSlow = false; 52 fRGBAToBGRAReadbackConversionsAreSlow = false;
54 53
55 fBlitFramebufferSupport = kNone_BlitFramebufferSupport; 54 fBlitFramebufferSupport = kNone_BlitFramebufferSupport;
56 55
57 fShaderCaps.reset(new GrGLSLCaps(contextOptions)); 56 fShaderCaps.reset(new GrGLSLCaps(contextOptions));
58 57
59 this->init(contextOptions, ctxInfo, glInterface); 58 this->init(contextOptions, ctxInfo, glInterface);
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); 1072 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
1074 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); 1073 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
1075 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO")); 1074 r.appendf("Direct state access support: %s\n", (fDirectStateAccessSupport ? "YES": "NO"));
1076 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO")); 1075 r.appendf("Debug support: %s\n", (fDebugSupport ? "YES": "NO"));
1077 r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO")); 1076 r.appendf("Multisample disable support: %s\n", (fMultisampleDisableSupport ? "YES" : "NO"));
1078 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO ")); 1077 r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO "));
1079 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO")); 1078 r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO"));
1080 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO ")); 1079 r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO "));
1081 r.appendf("Use non-VBO for dynamic data: %s\n", 1080 r.appendf("Use non-VBO for dynamic data: %s\n",
1082 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); 1081 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
1083 r.appendf("SRGB write contol: %s\n", (fSRGBWriteControl ? "YES" : "NO"));
1084 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO")); 1082 r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO"));
1085 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO")); 1083 r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO"));
1086 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor t ? "YES" : "NO")); 1084 r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSuppor t ? "YES" : "NO"));
1087 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES " : "NO")); 1085 r.appendf("Rectangle texture support: %s\n", (fRectangleTextureSupport? "YES " : "NO"));
1088 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" : "NO")); 1086 r.appendf("Texture swizzle support: %s\n", (fTextureSwizzleSupport ? "YES" : "NO"));
1089 r.appendf("BGRA to RGBA readback conversions are slow: %s\n", 1087 r.appendf("BGRA to RGBA readback conversions are slow: %s\n",
1090 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO")); 1088 (fRGBAToBGRAReadbackConversionsAreSlow ? "YES" : "NO"));
1091 1089
1092 r.append("Configs\n-------\n"); 1090 r.append("Configs\n-------\n");
1093 for (int i = 0; i < kGrPixelConfigCnt; ++i) { 1091 for (int i = 0; i < kGrPixelConfigCnt; ++i) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 ConfigInfo::kRenderableWithMSAA_Flag; 1425 ConfigInfo::kRenderableWithMSAA_Flag;
1428 } 1426 }
1429 } 1427 }
1430 } 1428 }
1431 if (texStorageSupported) { 1429 if (texStorageSupported) {
1432 fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag; 1430 fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexS torage_Flag;
1433 } 1431 }
1434 fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); 1432 fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
1435 1433
1436 // We only enable srgb support if both textures and FBOs support srgb, 1434 // We only enable srgb support if both textures and FBOs support srgb,
1437 // *and* we can disable sRGB decode-on-read, to support "legacy" mode. 1435 // *and* we can disable sRGB decode-on-read, to support "legacy" mode,
1436 // *and* we can disable sRGB encode-on-write.
1438 if (kGL_GrGLStandard == standard) { 1437 if (kGL_GrGLStandard == standard) {
1439 if (ctxInfo.version() >= GR_GL_VER(3,0)) { 1438 if (ctxInfo.version() >= GR_GL_VER(3,0)) {
1440 fSRGBSupport = true; 1439 fSRGBSupport = true;
1441 } else if (ctxInfo.hasExtension("GL_EXT_texture_sRGB")) { 1440 } else if (ctxInfo.hasExtension("GL_EXT_texture_sRGB")) {
1442 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") || 1441 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") ||
1443 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) { 1442 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) {
1444 fSRGBSupport = true; 1443 fSRGBSupport = true;
1445 } 1444 }
1446 } 1445 }
1447 // All the above srgb extensions support toggling srgb writes 1446 // All the above srgb extensions support toggling srgb writes
1448 fSRGBWriteControl = fSRGBSupport;
1449 } else { 1447 } else {
1450 // See https://bug.skia.org/4148 for PowerVR issue. 1448 // See https://bug.skia.org/4148 for PowerVR issue.
1451 fSRGBSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() && 1449 fSRGBSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() &&
1452 (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT _sRGB")); 1450 (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT _sRGB"));
1453 // ES through 3.1 requires EXT_srgb_write_control to support toggling 1451 // ES through 3.1 requires EXT_srgb_write_control to support toggling
1454 // sRGB writing for destinations. 1452 // sRGB writing for destinations.
1455 fSRGBWriteControl = ctxInfo.hasExtension("GL_EXT_sRGB_write_control"); 1453 fSRGBSupport = fSRGBSupport && ctxInfo.hasExtension("GL_EXT_sRGB_write_c ontrol");
1456 } 1454 }
1457 if (!ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode")) { 1455 if (!ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode")) {
1458 // To support "legacy" L32 mode, we require the ability to turn off sRGB decode: 1456 // To support "legacy" L32 mode, we require the ability to turn off sRGB decode:
1459 fSRGBSupport = false; 1457 fSRGBSupport = false;
1460 } 1458 }
1461 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL _SRGB_ALPHA; 1459 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL _SRGB_ALPHA;
1462 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G L_SRGB8_ALPHA8; 1460 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G L_SRGB8_ALPHA8;
1463 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the 1461 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the
1464 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image. 1462 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image.
1465 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] = 1463 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] =
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { 1865 for (int j = 0; j < kExternalFormatUsageCnt; ++j) {
1868 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != 1866 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] !=
1869 fConfigTable[i].fFormats.fExternalFormat[j]); 1867 fConfigTable[i].fFormats.fExternalFormat[j]);
1870 } 1868 }
1871 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); 1869 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType);
1872 } 1870 }
1873 #endif 1871 #endif
1874 } 1872 }
1875 1873
1876 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1874 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {}
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698