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 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= | 1692 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= |
1693 ConfigInfo::kCanUseWithTexelBuffer_Flag; | 1693 ConfigInfo::kCanUseWithTexelBuffer_Flag; |
1694 } | 1694 } |
1695 } else { | 1695 } else { |
1696 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G
R_GL_ALPHA; | 1696 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G
R_GL_ALPHA; |
1697 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_ALPHA16F; | 1697 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_ALPHA16F; |
1698 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_
ExternalFormatUsage] | 1698 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_
ExternalFormatUsage] |
1699 = GR_GL_ALPHA; | 1699 = GR_GL_ALPHA; |
1700 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::AAAA(); | 1700 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::AAAA(); |
1701 } | 1701 } |
1702 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0)) { | 1702 // ANGLE reports the wrong format for half-float (See http://anglebug.com/14
78) |
| 1703 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0) || |
| 1704 kANGLE_GrGLDriver == ctxInfo.driver()) { |
1703 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT; | 1705 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT; |
1704 } else { | 1706 } else { |
1705 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT_OES; | 1707 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT_OES; |
1706 } | 1708 } |
1707 fConfigTable[kAlpha_half_GrPixelConfig].fFormatType = kFloat_FormatType; | 1709 fConfigTable[kAlpha_half_GrPixelConfig].fFormatType = kFloat_FormatType; |
1708 if (hasHalfFPTextures) { | 1710 if (hasHalfFPTextures) { |
1709 fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureabl
e_Flag; | 1711 fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureabl
e_Flag; |
1710 // ES requires either 3.2 or the combination of EXT_color_buffer_half_fl
oat and support for | 1712 // ES requires either 3.2 or the combination of EXT_color_buffer_half_fl
oat and support for |
1711 // GL_RED internal format. | 1713 // GL_RED internal format. |
1712 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || | 1714 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || |
1713 (this->textureRedSupport() && | 1715 (this->textureRedSupport() && |
1714 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) { | 1716 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) { |
1715 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags; | 1717 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags; |
1716 } | 1718 } |
1717 } | 1719 } |
1718 if (texStorageSupported) { | 1720 if (texStorageSupported) { |
1719 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex
Storage_Flag; | 1721 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex
Storage_Flag; |
1720 } | 1722 } |
1721 | 1723 |
1722 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_
RGBA; | 1724 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_
RGBA; |
1723 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL
_RGBA16F; | 1725 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL
_RGBA16F; |
1724 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter
nalFormatUsage] = | 1726 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter
nalFormatUsage] = |
1725 GR_GL_RGBA; | 1727 GR_GL_RGBA; |
1726 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0)) { | 1728 // ANGLE reports the wrong format for half-float (See http://anglebug.com/14
78) |
| 1729 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0) || |
| 1730 kANGLE_GrGLDriver == ctxInfo.driver()) { |
1727 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT; | 1731 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT; |
1728 } else { | 1732 } else { |
1729 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT_OES; | 1733 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT_OES; |
1730 } | 1734 } |
1731 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType; | 1735 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType; |
1732 if (hasHalfFPTextures) { | 1736 if (hasHalfFPTextures) { |
1733 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable
_Flag; | 1737 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable
_Flag; |
1734 // ES requires 3.2 or EXT_color_buffer_half_float. | 1738 // ES requires 3.2 or EXT_color_buffer_half_float. |
1735 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || | 1739 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || |
1736 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) { | 1740 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { | 1949 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
1946 if (options.fEnableInstancedRendering) { | 1950 if (options.fEnableInstancedRendering) { |
1947 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); | 1951 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); |
1948 #ifndef SK_BUILD_FOR_MAC | 1952 #ifndef SK_BUILD_FOR_MAC |
1949 // OS X doesn't seem to write correctly to floating point textures when
using | 1953 // OS X doesn't seem to write correctly to floating point textures when
using |
1950 // glDraw*Indirect, regardless of the underlying GPU. | 1954 // glDraw*Indirect, regardless of the underlying GPU. |
1951 fAvoidInstancedDrawsToFPTargets = true; | 1955 fAvoidInstancedDrawsToFPTargets = true; |
1952 #endif | 1956 #endif |
1953 } | 1957 } |
1954 } | 1958 } |
OLD | NEW |