Chromium Code Reviews| Index: src/gpu/gl/GrGLCaps.cpp |
| diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp |
| index f577e9d740398dc5ca53fec9379b2e7266f544db..f7495ed12630f3de00f8ec20dd32f56cea40a5ea 100644 |
| --- a/src/gpu/gl/GrGLCaps.cpp |
| +++ b/src/gpu/gl/GrGLCaps.cpp |
| @@ -369,6 +369,8 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
| this->initConfigRenderableTable(ctxInfo); |
| + this->initCompressedTextureSupport(ctxInfo); |
| + |
| return true; |
| } |
| @@ -458,6 +460,35 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
| } |
| } |
| +void GrGLCaps::initCompressedTextureSupport(const GrGLContextInfo &ctxInfo) { |
| + GrGLStandard standard = ctxInfo.standard(); |
| + GrGLVersion version = ctxInfo.version(); |
| + |
| + // glCompressedTexImage2D is available on all OpenGL ES devices... |
| + // however, it is only available on the core profile after version 1.3 |
| + if (kGL_GrGLStandard == standard && version < GR_GL_VER(1, 3)) { |
| + return; |
| + } |
| + |
| + // Check for ETC1 |
| + bool hasETC1 = false; |
| + |
| + // First check version for support |
| + if (kGL_GrGLStandard == standard) { |
| + 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. |
|
robertphillips
2014/05/22 22:00:26
Is this an && or an || ?
krajcevski
2014/05/22 22:17:12
We have ETC1 if any of the following are true:
- O
|
| + (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && |
| + ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture")); |
| + } |
| + fCompressedFormatSupport[kETC1_GrCompressedFormat] = hasETC1; |
| +} |
| + |
| bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
| GrGLenum format, |
| GrGLenum type) const { |