Index: src/gpu/gl/GrGLCaps.cpp |
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp |
index 6523e032335f30925587a34e51a6cbe868283f50..cc5269350ff78d32384d21a6133651a0a03f2c27 100644 |
--- a/src/gpu/gl/GrGLCaps.cpp |
+++ b/src/gpu/gl/GrGLCaps.cpp |
@@ -369,8 +369,6 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
this->initConfigRenderableTable(ctxInfo); |
- this->initCompressedTextureSupport(ctxInfo); |
- |
return true; |
} |
@@ -404,12 +402,15 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
// Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the functions called |
// below already account for this). |
+ GrGLStandard standard = ctxInfo.standard(); |
+ GrGLVersion version = ctxInfo.version(); |
+ |
enum { |
kNo_MSAA = 0, |
kYes_MSAA = 1, |
}; |
- if (kGL_GrGLStandard == ctxInfo.standard()) { |
+ if (kGL_GrGLStandard == standard) { |
// Post 3.0 we will get R8 |
// Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object) |
if (ctxInfo.version() >= GR_GL_VER(3,0) || |
@@ -423,7 +424,7 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSupport; |
} |
- if (kGL_GrGLStandard != ctxInfo.standard()) { |
+ if (kGL_GrGLStandard != standard) { |
// only available in ES |
fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true; |
fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true; |
@@ -451,45 +452,72 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
} |
} |
- // If we don't support MSAA then undo any places above where we set a config as renderable with |
- // msaa. |
- if (kNone_MSFBOType == fMSFBOType) { |
- for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
- fConfigRenderSupport[i][kYes_MSAA] = false; |
- } |
- } |
-} |
+ // Compressed texture support |
-void GrGLCaps::initCompressedTextureSupport(const GrGLContextInfo &ctxInfo) { |
- GrGLStandard standard = ctxInfo.standard(); |
- GrGLVersion version = ctxInfo.version(); |
+ // Check for ETC1 |
+ bool hasCompressTex2D = (kGL_GrGLStandard != standard || version > GR_GL_VER(1, 3)); |
robertphillips
2014/05/29 12:53:18
Shouldn't this comment go above the prior line of
krajcevski
2014/05/29 14:28:22
Done.
|
// glCompressedTexImage2D is available on all OpenGL ES devices... |
// however, it is only available on standard OpenGL after version 1.3 |
robertphillips
2014/05/29 12:53:18
I think setting this to false and just using 'hasC
krajcevski
2014/05/29 14:28:22
I agree. This is left over from when I was reorder
|
- if (kGL_GrGLStandard == standard && version < GR_GL_VER(1, 3)) { |
- return; |
- } |
- |
- // Check for ETC1 |
- bool hasETC1 = false; |
+ bool hasETC1 = hasCompressTex2D; |
// First check version for support |
if (kGL_GrGLStandard == standard) { |
- hasETC1 = |
- version >= GR_GL_VER(4, 3) || |
- ctxInfo.hasExtension("GL_ARB_ES3_compatibility"); |
+ hasETC1 = hasETC1 && (version >= GR_GL_VER(4, 3) || |
+ ctxInfo.hasExtension("GL_ARB_ES3_compatibility")); |
} else { |
- hasETC1 = |
- version >= GR_GL_VER(3, 0) || |
- ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || |
- // ETC2 is a superset of ETC1, so we can just check for that, too. |
- (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && |
- ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture")); |
+ hasETC1 = hasETC1 && |
+ (version >= GR_GL_VER(3, 0) || |
+ ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || |
+ // ETC2 is a superset of ETC1, so we can just check for that, too. |
+ (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && |
+ ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))); |
+ } |
+ fConfigRenderSupport[kETC1_GrPixelConfig][kYes_MSAA] = hasETC1; |
+ fConfigRenderSupport[kETC1_GrPixelConfig][kNo_MSAA] = hasETC1; |
+ |
+ // Check for LATC under its various forms |
+ LATCAlias alias = kLATC_LATCAlias; |
+ bool hasLATC = hasCompressTex2D && (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") || |
+ ctxInfo.hasExtension("GL_NV_texture_compression_latc")); |
+ |
+ // Check for RGTC |
+ if (!hasLATC) { |
+ // If we're using OpenGL 3.0 or later, then we have RGTC, an identical compression format. |
+ if (kGL_GrGLStandard == standard) { |
+ hasLATC = version >= GR_GL_VER(3, 0); |
+ } |
+ |
+ if (!hasLATC) { |
+ hasLATC = |
+ ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") || |
+ ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc"); |
+ } |
+ |
+ if (hasLATC) { |
+ alias = kRGTC_LATCAlias; |
+ } |
+ } |
+ |
+ // Check for 3DC |
+ if (!hasLATC) { |
+ hasLATC = ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture"); |
+ if (hasLATC) { |
+ alias = k3DC_LATCAlias; |
+ } |
} |
- fCompressedFormatSupport[kETC1_GrCompressedFormat] = hasETC1; |
- fCompressedFormatSupport[kETC2_GrCompressedFormat] = false; |
- fCompressedFormatSupport[kDXT1_GrCompressedFormat] = false; |
+ fConfigRenderSupport[kLATC_GrPixelConfig][kYes_MSAA] = hasLATC; |
+ fConfigRenderSupport[kLATC_GrPixelConfig][kNo_MSAA] = hasLATC; |
+ fLATCAlias = alias; |
+ |
+ // If we don't support MSAA then undo any places above where we set a config as renderable with |
+ // msaa. |
+ if (kNone_MSFBOType == fMSFBOType) { |
+ for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
+ fConfigRenderSupport[i][kYes_MSAA] = false; |
+ } |
+ } |
} |
bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |