Chromium Code Reviews| Index: src/gpu/gl/GrGLCaps.cpp |
| diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp |
| index 989c799a37c4edbf641322c88677b99a3278b8a2..2c24c964757727e2b042226c233d036f82f3a76b 100644 |
| --- a/src/gpu/gl/GrGLCaps.cpp |
| +++ b/src/gpu/gl/GrGLCaps.cpp |
| @@ -33,7 +33,6 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, |
| fPackRowLengthSupport = false; |
| fPackFlipYSupport = false; |
| fTextureUsageSupport = false; |
| - fTexStorageSupport = false; |
| fTextureRedSupport = false; |
| fImagingSupport = false; |
| fVertexArrayObjectSupport = false; |
| @@ -107,18 +106,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, |
| ctxInfo.hasExtension("GL_ANGLE_texture_usage"); |
| if (kGL_GrGLStandard == standard) { |
| - // The EXT version can apply to either GL or GLES. |
| - fTexStorageSupport = version >= GR_GL_VER(4,2) || |
| - ctxInfo.hasExtension("GL_ARB_texture_storage") || |
| - ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| - } else { |
| - // Qualcomm Adreno drivers appear to have issues with texture storage. |
| - fTexStorageSupport = (version >= GR_GL_VER(3,0) && |
| - kQualcomm_GrGLVendor != ctxInfo.vendor()) && |
| - ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| - } |
| - |
| - if (kGL_GrGLStandard == standard) { |
| fTextureBarrierSupport = version >= GR_GL_VER(4,5) || |
| ctxInfo.hasExtension("GL_ARB_texture_barrier") || |
| ctxInfo.hasExtension("GL_NV_texture_barrier"); |
| @@ -530,7 +517,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, |
| // TODO: remove after command buffer supports full ES 3.0. |
| if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3, 0) && |
| kChromium_GrGLDriver == ctxInfo.driver()) { |
| - fTexStorageSupport = false; |
| fSupportsInstancedDraws = false; |
| fTextureSwizzleSupport = false; |
| SkASSERT(ctxInfo.hasExtension("GL_CHROMIUM_map_sub")); |
| @@ -1036,7 +1022,6 @@ SkString GrGLCaps::dump() const { |
| r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
| r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")); |
| - r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")); |
| r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
| r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
| r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); |
| @@ -1313,6 +1298,25 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| GrGLStandard standard = ctxInfo.standard(); |
| GrGLVersion version = ctxInfo.version(); |
| + bool texStorageSupported = false; |
| + if (kGL_GrGLStandard == standard) { |
| + // The EXT version can apply to either GL or GLES. |
| + texStorageSupported = version >= GR_GL_VER(4,2) || |
| + ctxInfo.hasExtension("GL_ARB_texture_storage") || |
| + ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| + } else { |
| + // Qualcomm Adreno drivers appear to have issues with texture storage. |
| + texStorageSupported = (version >= GR_GL_VER(3,0) && |
| + kQualcomm_GrGLVendor != ctxInfo.vendor()) && |
| + ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| + } |
| + |
| + // TODO: remove after command buffer supports full ES 3.0 |
| + if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0) && |
| + kChromium_GrGLDriver == ctxInfo.driver()) { |
| + texStorageSupported = false; |
| + } |
| + |
| fConfigTable[kUnknown_GrPixelConfig].fFormats.fBaseInternalFormat = 0; |
| fConfigTable[kUnknown_GrPixelConfig].fFormats.fSizedInternalFormat = 0; |
| fConfigTable[kUnknown_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = 0; |
| @@ -1336,6 +1340,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags; |
| } |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = |
| @@ -1373,6 +1380,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| } |
| } |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| // We only enable srgb support if both textures and FBOs support srgb. |
| @@ -1408,6 +1418,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag | |
| allRenderFlags; |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kSRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| fConfigTable[kRGB_565_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGB; |
| @@ -1428,6 +1441,13 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| } else { |
| fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags; |
| } |
| + // 565 is not a sized internal format on desktop GL. So on desktop with |
| + // 565 we always use an unsized internal format to let the system pick |
| + // the best sized format to convert the 565 data to. Since TexStorage |
| + // only allows sized internal formats we disallow it. |
|
bsalomon
2016/02/27 14:18:54
This logic is due for an update, as of 4.2 regular
cblume
2016/02/28 02:44:42
Want me to throw a TODO in here?
bsalomon
2016/02/29 14:42:28
Sure
cblume
2016/02/29 17:22:31
Done.
|
| + if (texStorageSupported && kGL_GrGLStandard != standard) { |
| + fConfigTable[kRGB_565_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kRGB_565_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA; |
| @@ -1444,6 +1464,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| } else { |
| fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags; |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kRGBA_4444_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| if (this->textureRedSupport()) { |
| @@ -1467,6 +1490,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| // Core profile removes ALPHA8 support, but we should have chosen R8 in that case. |
| fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags; |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| // Check for [half] floating point texture support |
| // NOTE: We disallow floating point textures on ES devices if linear filtering modes are not |
| @@ -1514,6 +1540,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= fpRenderFlags; |
| } |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kRGBA_float_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| if (this->textureRedSupport()) { |
| @@ -1545,6 +1574,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags; |
| } |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA; |
| fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA16F; |
| @@ -1564,6 +1596,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= fpRenderFlags; |
| } |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kRGBA_half_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| // Compressed texture support |
| @@ -1598,6 +1633,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| } |
| } |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kIndex_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
|
bsalomon
2016/02/27 14:18:54
The spec for this (at least the original extension
cblume
2016/02/28 02:44:42
If it is something I can just look up then I would
bsalomon
2016/02/29 14:42:28
Totally up to you... if you do wind up researching
cblume
2016/02/29 17:22:31
I went ahead and disabled all the compressed textu
|
| + } |
| fConfigTable[kIndex_8_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| // May change the internal format based on extensions. |
| @@ -1627,6 +1665,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = 0; |
| fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalType = 0; |
| fConfigTable[kLATC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType; |
| + if (texStorageSupported) { |
| + fConfigTable[kLATC_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kLATC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); |
| fConfigTable[kETC1_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_ETC1_RGB8; |
| @@ -1647,6 +1688,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; |
| } |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kETC1_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kETC1_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_R11_EAC; |
| @@ -1659,6 +1703,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) { |
| fConfigTable[kR11_EAC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kR11_EAC_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kR11_EAC_GrPixelConfig].fSwizzle = GrSwizzle::RRRR(); |
| fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fBaseInternalFormat = |
| @@ -1674,6 +1721,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa |
| ctxInfo.hasExtension("GL_OES_texture_compression_astc")) { |
| fConfigTable[kASTC_12x12_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; |
| } |
| + if (texStorageSupported) { |
| + fConfigTable[kASTC_12x12_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; |
| + } |
| fConfigTable[kASTC_12x12_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); |
| // Bulk populate the texture internal/external formats here and then deal with exceptions below. |