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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 ctxInfo.hasExtension("GL_OES_texture_float")) { | 1652 ctxInfo.hasExtension("GL_OES_texture_float")) { |
1653 hasFPTextures = true; | 1653 hasFPTextures = true; |
1654 } | 1654 } |
1655 if (ctxInfo.hasExtension("GL_OES_texture_half_float_linear") && | 1655 if (ctxInfo.hasExtension("GL_OES_texture_half_float_linear") && |
1656 ctxInfo.hasExtension("GL_OES_texture_half_float")) { | 1656 ctxInfo.hasExtension("GL_OES_texture_half_float")) { |
1657 hasHalfFPTextures = true; | 1657 hasHalfFPTextures = true; |
1658 } | 1658 } |
1659 } | 1659 } |
1660 } | 1660 } |
1661 | 1661 |
| 1662 if (kANGLE_GrGLDriver == ctxInfo.driver()) { |
| 1663 // ANGLE reports the wrong format for half-float (See http://anglebug.co
m/1478), but |
| 1664 // validates creation against the correct format. Rather than work aroun
d those bugs, |
| 1665 // just black-list support entirely for now. |
| 1666 hasHalfFPTextures = false; |
| 1667 } |
| 1668 |
1662 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL
_RGBA; | 1669 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL
_RGBA; |
1663 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G
L_RGBA32F; | 1670 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fSizedInternalFormat = GR_G
L_RGBA32F; |
1664 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte
rnalFormatUsage] = | 1671 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fExternalFormat[kOther_Exte
rnalFormatUsage] = |
1665 GR_GL_RGBA; | 1672 GR_GL_RGBA; |
1666 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fExternalType = GR_GL_FLOAT
; | 1673 fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fExternalType = GR_GL_FLOAT
; |
1667 fConfigTable[kRGBA_float_GrPixelConfig].fFormatType = kFloat_FormatType; | 1674 fConfigTable[kRGBA_float_GrPixelConfig].fFormatType = kFloat_FormatType; |
1668 if (hasFPTextures) { | 1675 if (hasFPTextures) { |
1669 fConfigTable[kRGBA_float_GrPixelConfig].fFlags = ConfigInfo::kTextureabl
e_Flag; | 1676 fConfigTable[kRGBA_float_GrPixelConfig].fFlags = ConfigInfo::kTextureabl
e_Flag; |
1670 // For now we only enable rendering to float on desktop, because on ES w
e'd have to solve | 1677 // For now we only enable rendering to float on desktop, because on ES w
e'd have to solve |
1671 // many precision issues and no clients actually want this yet. | 1678 // many precision issues and no clients actually want this yet. |
(...skipping 20 matching lines...) Expand all Loading... |
1692 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= | 1699 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= |
1693 ConfigInfo::kCanUseWithTexelBuffer_Flag; | 1700 ConfigInfo::kCanUseWithTexelBuffer_Flag; |
1694 } | 1701 } |
1695 } else { | 1702 } else { |
1696 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G
R_GL_ALPHA; | 1703 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = G
R_GL_ALPHA; |
1697 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_ALPHA16F; | 1704 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fSizedInternalFormat =
GR_GL_ALPHA16F; |
1698 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_
ExternalFormatUsage] | 1705 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalFormat[kOther_
ExternalFormatUsage] |
1699 = GR_GL_ALPHA; | 1706 = GR_GL_ALPHA; |
1700 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::AAAA(); | 1707 fConfigTable[kAlpha_half_GrPixelConfig].fSwizzle = GrSwizzle::AAAA(); |
1701 } | 1708 } |
1702 // ANGLE reports the wrong format for half-float (See http://anglebug.com/14
78) | 1709 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0)) { |
1703 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0) || | |
1704 kANGLE_GrGLDriver == ctxInfo.driver()) { | |
1705 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT; | 1710 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT; |
1706 } else { | 1711 } else { |
1707 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT_OES; | 1712 fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_H
ALF_FLOAT_OES; |
1708 } | 1713 } |
1709 fConfigTable[kAlpha_half_GrPixelConfig].fFormatType = kFloat_FormatType; | 1714 fConfigTable[kAlpha_half_GrPixelConfig].fFormatType = kFloat_FormatType; |
1710 if (hasHalfFPTextures) { | 1715 if (hasHalfFPTextures) { |
1711 fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureabl
e_Flag; | 1716 fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureabl
e_Flag; |
1712 // ES requires either 3.2 or the combination of EXT_color_buffer_half_fl
oat and support for | 1717 // ES requires either 3.2 or the combination of EXT_color_buffer_half_fl
oat and support for |
1713 // GL_RED internal format. | 1718 // GL_RED internal format. |
1714 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || | 1719 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || |
1715 (this->textureRedSupport() && | 1720 (this->textureRedSupport() && |
1716 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) { | 1721 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) { |
1717 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags; | 1722 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags; |
1718 } | 1723 } |
1719 } | 1724 } |
1720 if (texStorageSupported) { | 1725 if (texStorageSupported) { |
1721 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex
Storage_Flag; | 1726 fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTex
Storage_Flag; |
1722 } | 1727 } |
1723 | 1728 |
1724 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_
RGBA; | 1729 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_
RGBA; |
1725 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL
_RGBA16F; | 1730 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL
_RGBA16F; |
1726 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter
nalFormatUsage] = | 1731 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalFormat[kOther_Exter
nalFormatUsage] = |
1727 GR_GL_RGBA; | 1732 GR_GL_RGBA; |
1728 // ANGLE reports the wrong format for half-float (See http://anglebug.com/14
78) | 1733 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0)) { |
1729 if (kGL_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER
(3, 0) || | |
1730 kANGLE_GrGLDriver == ctxInfo.driver()) { | |
1731 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT; | 1734 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT; |
1732 } else { | 1735 } else { |
1733 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT_OES; | 1736 fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HA
LF_FLOAT_OES; |
1734 } | 1737 } |
1735 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType; | 1738 fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType; |
1736 if (hasHalfFPTextures) { | 1739 if (hasHalfFPTextures) { |
1737 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable
_Flag; | 1740 fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable
_Flag; |
1738 // ES requires 3.2 or EXT_color_buffer_half_float. | 1741 // ES requires 3.2 or EXT_color_buffer_half_float. |
1739 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || | 1742 if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) || |
1740 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) { | 1743 ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { | 1952 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
1950 if (options.fEnableInstancedRendering) { | 1953 if (options.fEnableInstancedRendering) { |
1951 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); | 1954 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); |
1952 #ifndef SK_BUILD_FOR_MAC | 1955 #ifndef SK_BUILD_FOR_MAC |
1953 // OS X doesn't seem to write correctly to floating point textures when
using | 1956 // OS X doesn't seem to write correctly to floating point textures when
using |
1954 // glDraw*Indirect, regardless of the underlying GPU. | 1957 // glDraw*Indirect, regardless of the underlying GPU. |
1955 fAvoidInstancedDrawsToFPTargets = true; | 1958 fAvoidInstancedDrawsToFPTargets = true; |
1956 #endif | 1959 #endif |
1957 } | 1960 } |
1958 } | 1961 } |
OLD | NEW |