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

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

Issue 2547603002: Revert of Enable sRGB on iOS, make sRGB decode support optional (Closed)
Patch Set: Created 4 years 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.cpp » ('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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 fBaseInstanceSupport = false; 44 fBaseInstanceSupport = 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 fRGBA8888PixelsOpsAreSlow = false; 49 fRGBA8888PixelsOpsAreSlow = false;
50 fPartialFBOReadIsSlow = false; 50 fPartialFBOReadIsSlow = false;
51 fMipMapLevelAndLodControlSupport = false; 51 fMipMapLevelAndLodControlSupport = false;
52 fRGBAToBGRAReadbackConversionsAreSlow = false; 52 fRGBAToBGRAReadbackConversionsAreSlow = false;
53 fDoManualMipmapping = false; 53 fDoManualMipmapping = false;
54 fSRGBDecodeDisableSupport = false;
55 54
56 fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag; 55 fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag;
57 56
58 fShaderCaps.reset(new GrShaderCaps(contextOptions)); 57 fShaderCaps.reset(new GrShaderCaps(contextOptions));
59 58
60 this->init(contextOptions, ctxInfo, glInterface); 59 this->init(contextOptions, ctxInfo, glInterface);
61 } 60 }
62 61
63 void GrGLCaps::init(const GrContextOptions& contextOptions, 62 void GrGLCaps::init(const GrContextOptions& contextOptions,
64 const GrGLContextInfo& ctxInfo, 63 const GrGLContextInfo& ctxInfo,
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // glGenerateMipmap. Our implementation requires mip-level sampling control. Additionally, 600 // glGenerateMipmap. Our implementation requires mip-level sampling control. Additionally,
602 // it can be much slower (especially on mobile GPUs), so we opt-in only when necessary: 601 // it can be much slower (especially on mobile GPUs), so we opt-in only when necessary:
603 if (fMipMapLevelAndLodControlSupport && 602 if (fMipMapLevelAndLodControlSupport &&
604 (contextOptions.fDoManualMipmapping || 603 (contextOptions.fDoManualMipmapping ||
605 (kIntel_GrGLVendor == ctxInfo.vendor()) || 604 (kIntel_GrGLVendor == ctxInfo.vendor()) ||
606 (kNVIDIA_GrGLDriver == ctxInfo.driver() && isMAC) || 605 (kNVIDIA_GrGLDriver == ctxInfo.driver() && isMAC) ||
607 (kATI_GrGLVendor == ctxInfo.vendor()))) { 606 (kATI_GrGLVendor == ctxInfo.vendor()))) {
608 fDoManualMipmapping = true; 607 fDoManualMipmapping = true;
609 } 608 }
610 609
611 fSRGBDecodeDisableSupport = ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode ");
612
613 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com patibility have 610 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com patibility have
614 // already been detected. 611 // already been detected.
615 this->initConfigTable(contextOptions, ctxInfo, gli, shaderCaps); 612 this->initConfigTable(ctxInfo, gli, shaderCaps);
616 613
617 this->applyOptionsOverrides(contextOptions); 614 this->applyOptionsOverrides(contextOptions);
618 shaderCaps->applyOptionsOverrides(contextOptions); 615 shaderCaps->applyOptionsOverrides(contextOptions);
619 } 616 }
620 617
621 const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration generation, 618 const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration generation,
622 bool isCoreProfile) { 619 bool isCoreProfile) {
623 switch (generation) { 620 switch (generation) {
624 case k110_GrGLSLGeneration: 621 case k110_GrGLSLGeneration:
625 if (kGLES_GrGLStandard == standard) { 622 if (kGLES_GrGLStandard == standard) {
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 if (memoryIsAlphaOnly && !surfaceIsAlphaOnly) { 1382 if (memoryIsAlphaOnly && !surfaceIsAlphaOnly) {
1386 if (this->textureRedSupport()) { 1383 if (this->textureRedSupport()) {
1387 SkASSERT(GR_GL_RED == *externalFormat); 1384 SkASSERT(GR_GL_RED == *externalFormat);
1388 *externalFormat = GR_GL_ALPHA; 1385 *externalFormat = GR_GL_ALPHA;
1389 } 1386 }
1390 } 1387 }
1391 1388
1392 return true; 1389 return true;
1393 } 1390 }
1394 1391
1395 void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, 1392 void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa ce* gli,
1396 const GrGLContextInfo& ctxInfo, const GrGLInterfa ce* gli,
1397 GrShaderCaps* shaderCaps) { 1393 GrShaderCaps* shaderCaps) {
1398 /* 1394 /*
1399 Comments on renderability of configs on various GL versions. 1395 Comments on renderability of configs on various GL versions.
1400 OpenGL < 3.0: 1396 OpenGL < 3.0:
1401 no built in support for render targets. 1397 no built in support for render targets.
1402 GL_EXT_framebuffer_object adds possible support for any sized format with base internal 1398 GL_EXT_framebuffer_object adds possible support for any sized format with base internal
1403 format RGB, RGBA and NV float formats we don't use. 1399 format RGB, RGBA and NV float formats we don't use.
1404 This is the following: 1400 This is the following:
1405 R3_G3_B2, RGB4, RGB5, RGB8, RGB10, RGB12, RGB16, RGBA2, RGBA4, R GB5_A1, RGBA8 1401 R3_G3_B2, RGB4, RGB5, RGB8, RGB10, RGB12, RGB16, RGBA2, RGBA4, R GB5_A1, RGBA8
1406 RGB10_A2, RGBA12,RGBA16 1402 RGB10_A2, RGBA12,RGBA16
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") || 1568 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") ||
1573 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) { 1569 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) {
1574 fSRGBSupport = true; 1570 fSRGBSupport = true;
1575 } 1571 }
1576 } 1572 }
1577 // All the above srgb extensions support toggling srgb writes 1573 // All the above srgb extensions support toggling srgb writes
1578 if (fSRGBSupport) { 1574 if (fSRGBSupport) {
1579 fSRGBWriteControl = true; 1575 fSRGBWriteControl = true;
1580 } 1576 }
1581 } else { 1577 } else {
1582 fSRGBSupport = ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtensi on("GL_EXT_sRGB"); 1578 // See https://bug.skia.org/4148 for PowerVR issue.
1583 #if defined(SK_CPU_X86) 1579 fSRGBSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() &&
1584 if (kPowerVRRogue_GrGLRenderer == ctxInfo.renderer()) { 1580 (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT _sRGB"));
1585 // NexusPlayer has strange bugs with sRGB (skbug.com/4148). This is a targeted fix to
1586 // blacklist that device (and any others that might be sharing the s ame driver).
1587 fSRGBSupport = false;
1588 }
1589 #endif
1590 // ES through 3.1 requires EXT_srgb_write_control to support toggling 1581 // ES through 3.1 requires EXT_srgb_write_control to support toggling
1591 // sRGB writing for destinations. 1582 // sRGB writing for destinations.
1592 // See https://bug.skia.org/5329 for Adreno4xx issue. 1583 // See https://bug.skia.org/5329 for Adreno4xx issue.
1593 fSRGBWriteControl = kAdreno4xx_GrGLRenderer != ctxInfo.renderer() && 1584 fSRGBWriteControl = kAdreno4xx_GrGLRenderer != ctxInfo.renderer() &&
1594 ctxInfo.hasExtension("GL_EXT_sRGB_write_control"); 1585 ctxInfo.hasExtension("GL_EXT_sRGB_write_control");
1595 } 1586 }
1596 if (contextOptions.fRequireDecodeDisableForSRGB && !fSRGBDecodeDisableSuppor t) { 1587 if (!ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode")) {
1597 // To support "legacy" L32 mode, we require the ability to turn off sRGB decode. Clients 1588 // To support "legacy" L32 mode, we require the ability to turn off sRGB decode:
1598 // can opt-out of that requirement, if they intend to always do linear b lending.
1599 fSRGBSupport = false; 1589 fSRGBSupport = false;
1600 } 1590 }
1601 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL _SRGB_ALPHA; 1591 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL _SRGB_ALPHA;
1602 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G L_SRGB8_ALPHA8; 1592 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G L_SRGB8_ALPHA8;
1603 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the 1593 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the
1604 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image. 1594 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image.
1605 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] = 1595 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] =
1606 GR_GL_RGBA; 1596 GR_GL_RGBA;
1607 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE; 1597 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE;
1608 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType; 1598 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType;
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { 2075 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {
2086 if (options.fEnableInstancedRendering) { 2076 if (options.fEnableInstancedRendering) {
2087 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th is); 2077 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th is);
2088 #ifndef SK_BUILD_FOR_MAC 2078 #ifndef SK_BUILD_FOR_MAC
2089 // OS X doesn't seem to write correctly to floating point textures when using 2079 // OS X doesn't seem to write correctly to floating point textures when using
2090 // glDraw*Indirect, regardless of the underlying GPU. 2080 // glDraw*Indirect, regardless of the underlying GPU.
2091 fAvoidInstancedDrawsToFPTargets = true; 2081 fAvoidInstancedDrawsToFPTargets = true;
2092 #endif 2082 #endif
2093 } 2083 }
2094 } 2084 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698