OLD | NEW |
---|---|
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 Loading... | |
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 fSRGBDecodeSupport = false; | |
55 fRequireDecodeForSRGB = true; | |
54 | 56 |
55 fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag; | 57 fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag; |
56 | 58 |
57 fShaderCaps.reset(new GrShaderCaps(contextOptions)); | 59 fShaderCaps.reset(new GrShaderCaps(contextOptions)); |
58 | 60 |
59 this->init(contextOptions, ctxInfo, glInterface); | 61 this->init(contextOptions, ctxInfo, glInterface); |
60 } | 62 } |
61 | 63 |
62 void GrGLCaps::init(const GrContextOptions& contextOptions, | 64 void GrGLCaps::init(const GrContextOptions& contextOptions, |
63 const GrGLContextInfo& ctxInfo, | 65 const GrGLContextInfo& ctxInfo, |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 // glGenerateMipmap. Our implementation requires mip-level sampling control. Additionally, | 602 // glGenerateMipmap. Our implementation requires mip-level sampling control. Additionally, |
601 // it can be much slower (especially on mobile GPUs), so we opt-in only when necessary: | 603 // it can be much slower (especially on mobile GPUs), so we opt-in only when necessary: |
602 if (fMipMapLevelAndLodControlSupport && | 604 if (fMipMapLevelAndLodControlSupport && |
603 (contextOptions.fDoManualMipmapping || | 605 (contextOptions.fDoManualMipmapping || |
604 (kIntel_GrGLVendor == ctxInfo.vendor()) || | 606 (kIntel_GrGLVendor == ctxInfo.vendor()) || |
605 (kNVIDIA_GrGLDriver == ctxInfo.driver() && isMAC) || | 607 (kNVIDIA_GrGLDriver == ctxInfo.driver() && isMAC) || |
606 (kATI_GrGLVendor == ctxInfo.vendor()))) { | 608 (kATI_GrGLVendor == ctxInfo.vendor()))) { |
607 fDoManualMipmapping = true; | 609 fDoManualMipmapping = true; |
608 } | 610 } |
609 | 611 |
612 fSRGBDecodeSupport = ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode"); | |
613 fRequireDecodeForSRGB = contextOptions.fRequireDecodeForSRGB; | |
614 | |
610 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com patibility have | 615 // Requires fTextureRedSupport, fTextureSwizzleSupport, msaa support, ES com patibility have |
611 // already been detected. | 616 // already been detected. |
612 this->initConfigTable(ctxInfo, gli, shaderCaps); | 617 this->initConfigTable(ctxInfo, gli, shaderCaps); |
613 | 618 |
614 this->applyOptionsOverrides(contextOptions); | 619 this->applyOptionsOverrides(contextOptions); |
615 shaderCaps->applyOptionsOverrides(contextOptions); | 620 shaderCaps->applyOptionsOverrides(contextOptions); |
616 } | 621 } |
617 | 622 |
618 const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration generation, | 623 const char* get_glsl_version_decl_string(GrGLStandard standard, GrGLSLGeneration generation, |
619 bool isCoreProfile) { | 624 bool isCoreProfile) { |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1568 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") || | 1573 if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") || |
1569 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) { | 1574 ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) { |
1570 fSRGBSupport = true; | 1575 fSRGBSupport = true; |
1571 } | 1576 } |
1572 } | 1577 } |
1573 // All the above srgb extensions support toggling srgb writes | 1578 // All the above srgb extensions support toggling srgb writes |
1574 if (fSRGBSupport) { | 1579 if (fSRGBSupport) { |
1575 fSRGBWriteControl = true; | 1580 fSRGBWriteControl = true; |
1576 } | 1581 } |
1577 } else { | 1582 } else { |
1578 // See https://bug.skia.org/4148 for PowerVR issue. | 1583 fSRGBSupport = ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtensi on("GL_EXT_sRGB"); |
1579 fSRGBSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() && | |
1580 (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT _sRGB")); | |
1581 // ES through 3.1 requires EXT_srgb_write_control to support toggling | 1584 // ES through 3.1 requires EXT_srgb_write_control to support toggling |
1582 // sRGB writing for destinations. | 1585 // sRGB writing for destinations. |
1583 // See https://bug.skia.org/5329 for Adreno4xx issue. | 1586 // See https://bug.skia.org/5329 for Adreno4xx issue. |
1584 fSRGBWriteControl = kAdreno4xx_GrGLRenderer != ctxInfo.renderer() && | 1587 fSRGBWriteControl = kAdreno4xx_GrGLRenderer != ctxInfo.renderer() && |
1585 ctxInfo.hasExtension("GL_EXT_sRGB_write_control"); | 1588 ctxInfo.hasExtension("GL_EXT_sRGB_write_control"); |
1586 } | 1589 } |
1587 if (!ctxInfo.hasExtension("GL_EXT_texture_sRGB_decode")) { | 1590 if (fRequireDecodeForSRGB && !fSRGBDecodeSupport) { |
bsalomon
2016/11/30 17:00:21
Should we just pass the options here rather than h
| |
1588 // To support "legacy" L32 mode, we require the ability to turn off sRGB decode: | 1591 // To support "legacy" L32 mode, we require the ability to turn off sRGB decode. Clients |
1592 // can opt-out of that requirement, if they intend to always do linear b lending. | |
1589 fSRGBSupport = false; | 1593 fSRGBSupport = false; |
1590 } | 1594 } |
1591 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL _SRGB_ALPHA; | 1595 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL _SRGB_ALPHA; |
1592 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G L_SRGB8_ALPHA8; | 1596 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G L_SRGB8_ALPHA8; |
1593 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the | 1597 // GL does not do srgb<->rgb conversions when transferring between cpu and g pu. Thus, the |
1594 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image. | 1598 // external format is GL_RGBA. See below for note about ES2.0 and glTex[Sub] Image. |
1595 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] = | 1599 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte rnalFormatUsage] = |
1596 GR_GL_RGBA; | 1600 GR_GL_RGBA; |
1597 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE; | 1601 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIG NED_BYTE; |
1598 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType; | 1602 fConfigTable[kSRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_ FormatType; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2075 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { | 2079 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
2076 if (options.fEnableInstancedRendering) { | 2080 if (options.fEnableInstancedRendering) { |
2077 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th is); | 2081 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th is); |
2078 #ifndef SK_BUILD_FOR_MAC | 2082 #ifndef SK_BUILD_FOR_MAC |
2079 // OS X doesn't seem to write correctly to floating point textures when using | 2083 // OS X doesn't seem to write correctly to floating point textures when using |
2080 // glDraw*Indirect, regardless of the underlying GPU. | 2084 // glDraw*Indirect, regardless of the underlying GPU. |
2081 fAvoidInstancedDrawsToFPTargets = true; | 2085 fAvoidInstancedDrawsToFPTargets = true; |
2082 #endif | 2086 #endif |
2083 } | 2087 } |
2084 } | 2088 } |
OLD | NEW |