Move config texturability/renderability to config table.

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1563443002

Committed: https://skia.googlesource.com/skia/+/32a3cd2f2860b15a842a6aa49e4e6a3bed04f949

Review URL: https://codereview.chromium.org/1563443002
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index c568646..923c392 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -20,14 +20,11 @@
     fStencilFormats.reset();
     fMSFBOType = kNone_MSFBOType;
     fInvalidateFBType = kNone_InvalidateFBType;
-    fLATCAlias = kLATC_LATCAlias;
     fMapBufferType = kNone_MapBufferType;
     fTransferBufferType = kNone_TransferBufferType;
     fMaxFragmentUniformVectors = 0;
     fMaxVertexAttributes = 0;
     fMaxFragmentTextureUnits = 0;
-    fRGBA8RenderbufferSupport = false;
-    fBGRAIsInternalFormat = false;
     fUnpackRowLengthSupport = false;
     fUnpackFlipYSupport = false;
     fPackRowLengthSupport = false;
@@ -82,14 +79,6 @@
     GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUnits);
 
     if (kGL_GrGLStandard == standard) {
-        fRGBA8RenderbufferSupport = true;
-    } else {
-        fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) ||
-                                    ctxInfo.hasExtension("GL_OES_rgb8_rgba8") ||
-                                    ctxInfo.hasExtension("GL_ARM_rgba8");
-    }
-
-    if (kGL_GrGLStandard == standard) {
         fUnpackRowLengthSupport = true;
         fUnpackFlipYSupport = false;
         fPackRowLengthSupport = true;
@@ -141,28 +130,6 @@
     fImagingSupport = kGL_GrGLStandard == standard &&
                       ctxInfo.hasExtension("GL_ARB_imaging");
 
-    // We only enable srgb support if both textures and FBOs support srgb.
-    bool srgbSupport = false;
-    if (kGL_GrGLStandard == standard) {
-        if (ctxInfo.version() >= GR_GL_VER(3,0)) {
-            srgbSupport = true;
-        } else if (ctxInfo.hasExtension("GL_EXT_texture_sRGB")) {
-            if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") ||
-                ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) {
-                srgbSupport = true;
-            }
-         }
-        // All the above srgb extensions support toggling srgb writes
-        fSRGBWriteControl = srgbSupport;
-    } else {
-        // See https://bug.skia.org/4148 for PowerVR issue.
-        srgbSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() &&
-                      (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_sRGB"));
-        // ES through 3.1 requires EXT_srgb_write_control to support toggling
-        // sRGB writing for destinations.
-        fSRGBWriteControl = ctxInfo.hasExtension("GL_EXT_sRGB_write_control");
-    }
-
     // SGX and Mali GPUs that are based on a tiled-deferred architecture that have trouble with
     // frequently changing VBOs. We've measured a performance increase using non-VBO vertex
     // data for dynamic content on these GPUs. Perhaps we should read the renderer string and
@@ -469,13 +436,12 @@
                  ctxInfo.hasExtension("GL_EXT_instanced_arrays"));
     }
 
-    this->initConfigTexturableTable(ctxInfo, gli, srgbSupport);
-    this->initConfigRenderableTable(ctxInfo, srgbSupport);
     this->initShaderPrecisionTable(ctxInfo, gli, glslCaps);
     // Requires fTexutreSwizzleSupport and fTextureRedSupport to be set before this point.
     this->initConfigSwizzleTable(ctxInfo, glslCaps);
-    // Requires various members are already correctly initialized (e.g. fTextureRedSupport).
-    this->initConfigTable(ctxInfo);
+    // Requires various members are already correctly initialized (e.g. fTextureRedSupport,
+    // msaa support).
+    this->initConfigTable(ctxInfo, gli);
 
     this->applyOptionsOverrides(contextOptions);
     glslCaps->applyOptionsOverrides(contextOptions);
@@ -645,313 +611,6 @@
     }
     return true;
 }
-
-void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo, bool srgbSupport) {
-    // OpenGL < 3.0
-    //  no support for render targets unless the GL_ARB_framebuffer_object
-    //  extension is supported (in which case we get ALPHA, RED, RG, RGB,
-    //  RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we
-    //  probably don't get R8 in this case.
-
-    // OpenGL 3.0
-    //  base color renderable: ALPHA, RED, RG, RGB, and RGBA
-    //  sized derivatives: ALPHA8, R8, RGBA4, RGBA8
-
-    // >= OpenGL 3.1
-    //  base color renderable: RED, RG, RGB, and RGBA
-    //  sized derivatives: R8, RGBA4, RGBA8
-    //  if the GL_ARB_compatibility extension is supported then we get back
-    //  support for GL_ALPHA and ALPHA8
-
-    // GL_EXT_bgra adds BGRA render targets to any version
-
-    // ES 2.0
-    //  color renderable: RGBA4, RGB5_A1, RGB565
-    //  GL_EXT_texture_rg adds support for R8 as a color render target
-    //  GL_OES_rgb8_rgba8 and/or GL_ARM_rgba8 adds support for RGBA8
-    //  GL_EXT_texture_format_BGRA8888 and/or GL_APPLE_texture_format_BGRA8888 added BGRA support
-
-    // ES 3.0
-    // 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();
-
-    enum {
-        kNo_MSAA = 0,
-        kYes_MSAA = 1,
-    };
-
-    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) ||
-            ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
-            fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = true;
-            fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = true;
-        }
-    } else {
-        // On ES we can only hope for R8
-        fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = fTextureRedSupport;
-        fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSupport;
-    }
-
-    if (kGL_GrGLStandard != standard) {
-        // only available in ES
-        fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true;
-        fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true;
-    }
-
-    // we no longer support 444 as a render target
-    fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kNo_MSAA]  = false;
-    fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kYes_MSAA]  = false;
-
-    if (this->fRGBA8RenderbufferSupport) {
-        fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kNo_MSAA]  = true;
-        fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kYes_MSAA]  = true;
-    }
-
-    if (this->isConfigTexturable(kBGRA_8888_GrPixelConfig)) {
-        // On iOS, BGRA is not supported as a renderable target on ES 3.0+
-        if (!ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888") ||
-            ctxInfo.version() < GR_GL_VER(3,0)) {
-            fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kNo_MSAA]  = true;
-            // The GL_EXT_texture_format_BGRA8888 extension does not add BGRA to the list of
-            // configs that are color-renderable and can be passed to
-            // glRenderBufferStorageMultisample. Chromium may have an extension to allow BGRA
-            // renderbuffers to work on desktop platforms.
-            if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) {
-                fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true;
-            } else {
-                fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] =
-                    !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers();
-            }
-        }
-    }
-
-    if (this->fRGBA8RenderbufferSupport && srgbSupport) {
-        fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kNo_MSAA] = true;
-        fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kYes_MSAA] = true;
-    }
-    
-    if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) {
-        if (kGL_GrGLStandard == standard) {
-            fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true;
-            fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = true;
-        } else {
-            // for now we only enable this on desktop, because on ES we'd have to solve many
-            // precision issues and no clients actually want this yet
-            /*
-            if (ctxInfo.hasExtension("GL_EXT_color_buffer_float")) {
-                fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true;
-            } else {
-                fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = false;
-            }
-            // for now we don't support floating point MSAA on ES
-            fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = false;*/
-            fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = false;
-            fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = false;
-        }
-    }
-
-    if (this->isConfigTexturable(kAlpha_half_GrPixelConfig)) {
-        if (kGL_GrGLStandard == standard) {
-            fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
-            fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = true;
-        } else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
-            fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
-            // for now we don't support floating point MSAA on ES
-            fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
-        } else {
-            if (ctxInfo.hasExtension("GL_EXT_color_buffer_half_float") && fTextureRedSupport) {
-                fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
-            } else {
-                fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = false;
-            }
-            // for now we don't support floating point MSAA on ES
-            fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
-        }
-    }
-    
-    if (this->isConfigTexturable(kRGBA_half_GrPixelConfig)) {
-        if (kGL_GrGLStandard == standard) {
-            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = true;
-            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kYes_MSAA] = true;
-        } else if (ctxInfo.version() >= GR_GL_VER(3, 0)) {
-            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = true;
-            // for now we don't support floating point MSAA on ES
-            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kYes_MSAA] = false;
-        } else {
-            if (ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) {
-                fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = true;
-            } else {
-                fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = false;
-            }
-            // for now we don't support floating point MSAA on ES
-            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kYes_MSAA] = false;
-        }
-    }
-
-    // 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;
-        }
-    }
-}
-
-void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli,
-                                         bool srgbSupport) {
-    GrGLStandard standard = ctxInfo.standard();
-    GrGLVersion version = ctxInfo.version();
-
-    // Base texture support
-    fConfigTextureSupport[kAlpha_8_GrPixelConfig] = true;
-    fConfigTextureSupport[kRGB_565_GrPixelConfig] = true;
-    fConfigTextureSupport[kRGBA_4444_GrPixelConfig] = true;
-    fConfigTextureSupport[kRGBA_8888_GrPixelConfig] = true;
-
-    // Disable this for now, while we investigate https://bug.skia.org/4333
-    if (false) {
-        // Check for 8-bit palette..
-        GrGLint numFormats;
-        GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);
-        if (numFormats) {
-            SkAutoSTMalloc<10, GrGLint> formats(numFormats);
-            GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats);
-            for (int i = 0; i < numFormats; ++i) {
-                if (GR_GL_PALETTE8_RGBA8 == formats[i]) {
-                    fConfigTextureSupport[kIndex_8_GrPixelConfig] = true;
-                    break;
-                }
-            }
-        }
-    }
-
-    // Check for BGRA
-    if (kGL_GrGLStandard == standard) {
-        fConfigTextureSupport[kBGRA_8888_GrPixelConfig] =
-            version >= GR_GL_VER(1,2) || ctxInfo.hasExtension("GL_EXT_bgra");
-    } else {
-        if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
-            fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true;
-            if (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_texture_storage")) {
-                fBGRAIsInternalFormat = true;
-            }
-        } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
-            fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true;
-            fBGRAIsInternalFormat = true;
-        }
-        SkASSERT(fConfigTextureSupport[kBGRA_8888_GrPixelConfig] ||
-                 kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig);
-    }
-
-    fConfigTextureSupport[kSRGBA_8888_GrPixelConfig] = srgbSupport;
-    
-    // Compressed texture support
-
-    // glCompressedTexImage2D is available on all OpenGL ES devices...
-    // however, it is only available on standard OpenGL after version 1.3
-    bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VER(1, 3));
-
-    fCompressedTexSubImageSupport =
-        hasCompressTex2D && (gli->fFunctions.fCompressedTexSubImage2D);
-
-    // Check for ETC1
-    bool hasETC1 = false;
-
-    // First check version for support
-    if (kGL_GrGLStandard == standard) {
-        hasETC1 = hasCompressTex2D &&
-            (version >= GR_GL_VER(4, 3) ||
-             ctxInfo.hasExtension("GL_ARB_ES3_compatibility"));
-    } else {
-        hasETC1 = hasCompressTex2D &&
-            (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")));
-    }
-    fConfigTextureSupport[kETC1_GrPixelConfig] = 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;
-        }
-    }
-
-    fConfigTextureSupport[kLATC_GrPixelConfig] = hasLATC;
-    fLATCAlias = alias;
-
-    // Check for R11_EAC ... We don't support R11_EAC on desktop, as most
-    // cards default to decompressing the textures in the driver, and is
-    // generally slower.
-    if (kGL_GrGLStandard != standard) {
-        fConfigTextureSupport[kR11_EAC_GrPixelConfig] = version >= GR_GL_VER(3, 0);
-    }
-
-    // Check for ASTC
-    fConfigTextureSupport[kASTC_12x12_GrPixelConfig] =
-        ctxInfo.hasExtension("GL_KHR_texture_compression_astc_hdr") ||
-        ctxInfo.hasExtension("GL_KHR_texture_compression_astc_ldr") ||
-        ctxInfo.hasExtension("GL_OES_texture_compression_astc");
-
-    // Check for floating point texture support
-    // NOTE: We disallow floating point textures on ES devices if linear
-    // filtering modes are not supported.  This is for simplicity, but a more
-    // granular approach is possible.  Coincidentally, floating point textures became part of
-    // the standard in ES3.1 / OGL 3.1, hence the shorthand
-    bool hasFPTextures = version >= GR_GL_VER(3, 1);
-    if (!hasFPTextures) {
-        hasFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
-                        (ctxInfo.hasExtension("GL_OES_texture_float_linear") &&
-                         ctxInfo.hasExtension("GL_OES_texture_float"));
-    }
-    fConfigTextureSupport[kRGBA_float_GrPixelConfig] = hasFPTextures;
-
-    // Check for fp16 texture support
-    // NOTE: We disallow floating point textures on ES devices if linear
-    // filtering modes are not supported.  This is for simplicity, but a more
-    // granular approach is possible.  Coincidentally, 16-bit floating point textures became part of
-    // the standard in ES3.1 / OGL 3.1, hence the shorthand
-    bool hasHalfFPTextures = version >= GR_GL_VER(3, 1);
-    if (!hasHalfFPTextures) {
-        hasHalfFPTextures = ctxInfo.hasExtension("GL_ARB_texture_float") ||
-                            (ctxInfo.hasExtension("GL_OES_texture_half_float_linear") &&
-                             ctxInfo.hasExtension("GL_OES_texture_half_float"));
-    }
-    fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures;
-    fConfigTextureSupport[kRGBA_half_GrPixelConfig] = hasHalfFPTextures;
-}
-
 bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
                                    GrPixelConfig readConfig,
                                    GrPixelConfig currFBOConfig) const {
@@ -1188,8 +847,6 @@
     r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
     r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits);
     r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
-    r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO"));
-    r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES": "NO"));
     r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES": "NO"));
     r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"));
     r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "NO"));
@@ -1209,6 +866,21 @@
     r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO"));
     r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO"));
     r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSupport ? "YES" : "NO"));
+
+    r.append("Configs\n-------\n");
+    for (int i = 0; i < kGrPixelConfigCnt; ++i) {
+        r.appendf("  cfg: %d flags: 0x%04x, b_internal: 0x%08x s_internal: 0x%08x, e_format: "
+                  "0x%08x, e_type: 0x%08x, i_for_teximage: 0x%08x, e_for_teximage: 0x%08x\n",
+                  i,
+                  fConfigTable[i].fFlags,
+                  fConfigTable[i].fFormats.fBaseInternalFormat,
+                  fConfigTable[i].fFormats.fSizedInternalFormat,
+                  fConfigTable[i].fFormats.fExternalFormat,
+                  fConfigTable[i].fFormats.fExternalType,
+                  fConfigTable[i].fFormats.fInternalFormatTexImage,
+                  fConfigTable[i].fFormats.fExternalFormatForTexImage);
+    }
+
     return r;
 }
 
@@ -1334,7 +1006,88 @@
 
 }
 
-void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo) {
+bool GrGLCaps::bgraIsInternalFormat() const {
+    return fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat == GR_GL_BGRA;
+}
+
+void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
+    /*
+        Comments on renderability of configs on various GL versions.
+          OpenGL < 3.0:
+            no built in support for render targets.
+            GL_EXT_framebuffer_object adds possible support for any sized format with base internal
+              format RGB, RGBA and NV float formats we don't use.
+              This is the following:
+                R3_G3_B2, RGB4, RGB5, RGB8, RGB10, RGB12, RGB16, RGBA2, RGBA4, RGB5_A1, RGBA8
+                RGB10_A2, RGBA12,RGBA16
+              Though, it is hard to believe the more obscure formats such as RGBA12 would work
+              since they aren't required by later standards and the driver can simply return
+              FRAMEBUFFER_UNSUPPORTED for anything it doesn't allow.
+            GL_ARB_framebuffer_object adds everything added by the EXT extension and additionally
+              any sized internal format with a base internal format of ALPHA, LUMINANCE,
+              LUMINANCE_ALPHA, INTENSITY, RED, and RG.
+              This adds a lot of additional renderable sized formats, including ALPHA8.
+              The GL_ARB_texture_rg brings in the RED and RG formats (8, 8I, 8UI, 16, 16I, 16UI,
+              16F, 32I, 32UI, and 32F variants).
+              Again, the driver has an escape hatch via FRAMEBUFFER_UNSUPPORTED.
+
+            For both the above extensions we limit ourselves to those that are also required by
+            OpenGL 3.0.
+
+          OpenGL 3.0:
+            Any format with base internal format ALPHA, RED, RG, RGB or RGBA is "color-renderable"
+            but are not required to be supported as renderable textures/renderbuffer.
+            Required renderable color formats:
+                - RGBA32F, RGBA32I, RGBA32UI, RGBA16, RGBA16F, RGBA16I,
+                  RGBA16UI, RGBA8, RGBA8I, RGBA8UI, SRGB8_ALPHA8, and
+                  RGB10_A2.
+                - R11F_G11F_B10F.
+                - RG32F, RG32I, RG32UI, RG16, RG16F, RG16I, RG16UI, RG8, RG8I,
+                  and RG8UI.
+                - R32F, R32I, R32UI, R16F, R16I, R16UI, R16, R8, R8I, and R8UI.
+                - ALPHA8
+
+          OpenGL 3.1, 3.2, 3.3
+            Same as 3.0 except ALPHA8 requires GL_ARB_compatibility/compatibility profile.
+          OpengGL 3.3, 4.0, 4.1
+            Adds RGB10_A2UI.
+          OpengGL 4.2
+            Adds
+                - RGB5_A1, RGBA4
+                - RGB565
+          OpenGL 4.4
+            Does away with the separate list and adds a column to the sized internal color format
+            table. However, no new formats become required color renderable.
+
+          ES 2.0
+            color renderable: RGBA4, RGB5_A1, RGB565
+            GL_EXT_texture_rg adds support for R8, RG5 as a color render target
+            GL_OES_rgb8_rgba8 adds support for RGB8 and RGBA8
+            GL_ARM_rgba8 adds support for RGBA8 (but not RGB8)
+            GL_EXT_texture_format_BGRA8888 does not add renderbuffer support
+            GL_CHROMIUM_renderbuffer_format_BGRA8888 adds BGRA8 as color-renderable
+            GL_APPLE_texture_format_BGRA8888 does not add renderbuffer support
+
+          ES 3.0
+                - RGBA32I, RGBA32UI, RGBA16I, RGBA16UI, RGBA8, RGBA8I,
+                  RGBA8UI, SRGB8_ALPHA8, RGB10_A2, RGB10_A2UI, RGBA4, and
+                  RGB5_A1.
+                - RGB8 and RGB565.
+                - RG32I, RG32UI, RG16I, RG16UI, RG8, RG8I, and RG8UI.
+                - R32I, R32UI, R16I, R16UI, R8, R8I, and R8UI
+          ES 3.1
+            Adds RGB10_A2, RGB10_A2UI,
+          ES 3.2
+            Adds R16F, RG16F, RGBA16F, R32F, RG32F, RGBA32F, R11F_G11F_B10F.
+    */
+    uint32_t allRenderFlags = ConfigInfo::kRenderable_Flag;
+    if (kNone_MSFBOType != fMSFBOType) {
+        allRenderFlags |= ConfigInfo::kRenderableWithMSAA_Flag;
+    }
+
+    GrGLStandard standard = ctxInfo.standard();
+    GrGLVersion version = ctxInfo.version();
+
     fConfigTable[kUnknown_GrPixelConfig].fFormats.fBaseInternalFormat = 0;
     fConfigTable[kUnknown_GrPixelConfig].fFormats.fSizedInternalFormat = 0;
     fConfigTable[kUnknown_GrPixelConfig].fFormats.fExternalFormat = 0;
@@ -1346,19 +1099,73 @@
     fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fExternalFormat = GR_GL_RGBA;
     fConfigTable[kRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
     fConfigTable[kRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
-
-    if (this->bgraIsInternalFormat()) {
-        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_BGRA;
-        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_BGRA8;
+    fConfigTable[kRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+    if (kGL_GrGLStandard == standard) {
+        // We require some form of FBO support and all GLs with FBO support can render to RGBA8
+        fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags;
     } else {
-        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
-        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA8;
+        if (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_OES_rgb8_rgba8") ||
+            ctxInfo.hasExtension("GL_ARM_rgba8")) {
+            fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags;
+        }
     }
+
     fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalFormat= GR_GL_BGRA;
     fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalType  = GR_GL_UNSIGNED_BYTE;
     fConfigTable[kBGRA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    if (kGL_GrGLStandard == standard) {
+        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
+        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA8;
+        if (version >= GR_GL_VER(1, 2) || ctxInfo.hasExtension("GL_EXT_bgra")) {
+            // Since the internal format is RGBA8, it is also renderable.
+            fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag |
+                                                            allRenderFlags;
+        }
+    } else {
+        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_BGRA;
+        fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_BGRA8;
+        if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
+            // The APPLE extension doesn't make this renderable.
+            fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+            if (version < GR_GL_VER(3,0) && !ctxInfo.hasExtension("GL_EXT_texture_storage")) {
+                // On ES2 the internal format of a BGRA texture is RGBA with the APPLE extension.
+                // Though, that seems to not be the case if the texture storage extension is
+                // present. The specs don't exactly make that clear.
+                fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
+                fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA8;
+            }
+        } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
+            fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag |
+                                                            ConfigInfo::kRenderable_Flag;
+            if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888") &&
+                this->usesMSAARenderBuffers()) {
+                fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |=
+                    ConfigInfo::kRenderableWithMSAA_Flag;
+            }
+        }
+    }
 
-
+    // We only enable srgb support if both textures and FBOs support srgb.
+    bool srgbSupport = false;
+    if (kGL_GrGLStandard == standard) {
+        if (ctxInfo.version() >= GR_GL_VER(3,0)) {
+            srgbSupport = true;
+        } else if (ctxInfo.hasExtension("GL_EXT_texture_sRGB")) {
+            if (ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") ||
+                ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) {
+                srgbSupport = true;
+            }
+        }
+        // All the above srgb extensions support toggling srgb writes
+        fSRGBWriteControl = srgbSupport;
+    } else {
+        // See https://bug.skia.org/4148 for PowerVR issue.
+        srgbSupport = kPowerVRRogue_GrGLRenderer != ctxInfo.renderer() &&
+            (ctxInfo.version() >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_sRGB"));
+        // ES through 3.1 requires EXT_srgb_write_control to support toggling
+        // sRGB writing for destinations.
+        fSRGBWriteControl = ctxInfo.hasExtension("GL_EXT_sRGB_write_control");
+    }
     fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_SRGB_ALPHA;
     fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_SRGB8_ALPHA8;
     // GL does not do srgb<->rgb conversions when transferring between cpu and gpu. Thus, the
@@ -1366,6 +1173,10 @@
     fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalFormat = GR_GL_RGBA;
     fConfigTable[kSRGBA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
     fConfigTable[kSRGBA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    if (srgbSupport) {
+        fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag |
+                                                         allRenderFlags;
+    }
 
     fConfigTable[kRGB_565_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGB;
     if (this->ES2CompatibilitySupport()) {
@@ -1376,13 +1187,28 @@
     fConfigTable[kRGB_565_GrPixelConfig].fFormats.fExternalFormat = GR_GL_RGB;
     fConfigTable[kRGB_565_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_SHORT_5_6_5;
     fConfigTable[kRGB_565_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    fConfigTable[kRGB_565_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+    if (kGL_GrGLStandard == standard) {
+        if (version >= GR_GL_VER(4, 2) || ctxInfo.hasExtension("GL_ES2_compatibility")) {
+            fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags;
+        }
+    } else {
+        fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags;
+    }
 
     fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
     fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA4;
     fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalFormat = GR_GL_RGBA;
     fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_SHORT_4_4_4_4;
     fConfigTable[kRGBA_4444_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
-
+    fConfigTable[kRGBA_4444_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+    if (kGL_GrGLStandard == standard) {
+        if (version >= GR_GL_VER(4, 2)) {
+            fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags;
+        }
+    } else {
+        fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags;
+    }
 
     if (this->textureRedSupport()) {
         fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RED;
@@ -1395,12 +1221,58 @@
     }
     fConfigTable[kAlpha_8_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_BYTE;
     fConfigTable[kAlpha_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    fConfigTable[kAlpha_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+    if (this->textureRedSupport() || kDesktop_ARB_MSFBOType == this->msFBOType()) {
+        // desktop ARB extension/3.0+ supports ALPHA8 as renderable.
+        // Core profile removes ALPHA8 support, but we should have chosen R8 in that case.
+        fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags;
+    }
+
+    // Check for [half] floating point texture support
+    // NOTE: We disallow floating point textures on ES devices if linear filtering modes are not
+    // supported. This is for simplicity, but a more granular approach is possible. Coincidentally,
+    // [half] floating point textures became part of the standard in ES3.1 / OGL 3.0.
+    bool hasFPTextures = false;
+    bool hasHalfFPTextures = false;
+    // for now we don't support floating point MSAA on ES
+    uint32_t fpRenderFlags = (kGL_GrGLStandard == standard) ?
+                              allRenderFlags : (uint32_t)ConfigInfo::kRenderable_Flag;
+
+    if (kGL_GrGLStandard == standard) {
+        if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_texture_float")) {
+            hasFPTextures = true;
+            hasHalfFPTextures = true;
+        }
+    } else {
+        if (version >= GR_GL_VER(3, 1)) {
+            hasFPTextures = true;
+            hasHalfFPTextures = true;
+        } else {
+            if (ctxInfo.hasExtension("GL_OES_texture_float_linear") &&
+                ctxInfo.hasExtension("GL_OES_texture_float")) {
+                hasFPTextures = true;
+            }
+            if (ctxInfo.hasExtension("GL_OES_texture_half_float_linear") &&
+                ctxInfo.hasExtension("GL_OES_texture_half_float")) {
+                hasHalfFPTextures = true;
+            }
+        }
+    }
 
     fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
     fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA32F;
     fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fExternalFormat = GR_GL_RGBA;
     fConfigTable[kRGBA_float_GrPixelConfig].fFormats.fExternalType = GR_GL_FLOAT;
     fConfigTable[kRGBA_float_GrPixelConfig].fFormatType = kFloat_FormatType;
+    if (hasFPTextures) {
+        fConfigTable[kRGBA_float_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+        // For now we only enable rendering to float on desktop, because on ES we'd have to solve
+        // many precision issues and no clients actually want this yet.
+        if (kGL_GrGLStandard == standard /* || version >= GR_GL_VER(3,2) ||
+            ctxInfo.hasExtension("GL_EXT_color_buffer_float")*/) {
+            fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= fpRenderFlags;
+        }
+    }
 
     if (this->textureRedSupport()) {
         fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RED;
@@ -1417,6 +1289,16 @@
         fConfigTable[kAlpha_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HALF_FLOAT_OES;
     }
     fConfigTable[kAlpha_half_GrPixelConfig].fFormatType = kFloat_FormatType;
+    if (hasHalfFPTextures) {
+        fConfigTable[kAlpha_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+        // ES requires either 3.2 or the combination of EXT_color_buffer_half_float and support for
+        // GL_RED internal format.
+        if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) ||
+            (this->textureRedSupport() &&
+             ctxInfo.hasExtension("GL_EXT_color_buffer_half_float"))) {
+            fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags;
+        }
+    }
 
     fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
     fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA16F;
@@ -1427,33 +1309,71 @@
         fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fExternalType = GR_GL_HALF_FLOAT_OES;
     }
     fConfigTable[kRGBA_half_GrPixelConfig].fFormatType = kFloat_FormatType;
+    if (hasHalfFPTextures) {
+        fConfigTable[kRGBA_half_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+        // ES requires 3.2 or EXT_color_buffer_half_float.
+        if (kGL_GrGLStandard == standard || version >= GR_GL_VER(3,2) ||
+             ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) {
+            fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= fpRenderFlags;
+        }
+    }
+
+    // Compressed texture support
+
+    // glCompressedTexImage2D is available on all OpenGL ES devices. It is available on standard
+    // OpenGL after version 1.3. We'll assume at least that level of OpenGL support.
+
+    // TODO: Fix command buffer bindings and remove this.
+    fCompressedTexSubImageSupport = SkToBool(gli->fFunctions.fCompressedTexSubImage2D);
 
     // No sized/unsized internal format distinction for compressed formats, no external format.
+    // Below we set the external formats and types to 0.
 
     fConfigTable[kIndex_8_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_PALETTE8_RGBA8;
     fConfigTable[kIndex_8_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_PALETTE8_RGBA8;
     fConfigTable[kIndex_8_GrPixelConfig].fFormats.fExternalFormat = 0;
     fConfigTable[kIndex_8_GrPixelConfig].fFormats.fExternalType = 0;
     fConfigTable[kIndex_8_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    // Disable this for now, while we investigate https://bug.skia.org/4333
+    if (false) {
+        // Check for 8-bit palette..
+        GrGLint numFormats;
+        GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);
+        if (numFormats) {
+            SkAutoSTMalloc<10, GrGLint> formats(numFormats);
+            GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats);
+            for (int i = 0; i < numFormats; ++i) {
+                if (GR_GL_PALETTE8_RGBA8 == formats[i]) {
+                    fConfigTable[kIndex_8_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+                    break;
+                }
+            }
+        }
+    }
 
-    switch(this->latcAlias()) {
-        case GrGLCaps::kLATC_LATCAlias:
-            fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
-                GR_GL_COMPRESSED_LUMINANCE_LATC1;
-            fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
-                GR_GL_COMPRESSED_LUMINANCE_LATC1;
-            break;
-        case GrGLCaps::kRGTC_LATCAlias:
-            fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
-                GR_GL_COMPRESSED_RED_RGTC1;
-            fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
-                GR_GL_COMPRESSED_RED_RGTC1;
-            break;
-        case GrGLCaps::k3DC_LATCAlias:
-            fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_3DC_X;
-            fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
-                GR_GL_COMPRESSED_3DC_X;
-            break;
+    // May change the internal format based on extensions.
+    fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
+        GR_GL_COMPRESSED_LUMINANCE_LATC1;
+    fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
+        GR_GL_COMPRESSED_LUMINANCE_LATC1;
+    if (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") ||
+        ctxInfo.hasExtension("GL_NV_texture_compression_latc")) {
+        fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+    } else if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 0)) ||
+               ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") ||
+               ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc")) {
+        // RGTC is identical and available on OpenGL 3.0+ as well as with extensions
+        fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+        fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat =
+            GR_GL_COMPRESSED_RED_RGTC1;
+        fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
+            GR_GL_COMPRESSED_RED_RGTC1;
+    } else if (ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture")) {
+        fConfigTable[kLATC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+        fConfigTable[kLATC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_3DC_X;
+        fConfigTable[kLATC_GrPixelConfig].fFormats.fSizedInternalFormat =
+            GR_GL_COMPRESSED_3DC_X;
+
     }
     fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalFormat = 0;
     fConfigTable[kLATC_GrPixelConfig].fFormats.fExternalType = 0;
@@ -1464,12 +1384,30 @@
     fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalFormat = 0;
     fConfigTable[kETC1_GrPixelConfig].fFormats.fExternalType = 0;
     fConfigTable[kETC1_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    if (kGL_GrGLStandard == standard) {
+        if (version >= GR_GL_VER(4, 3) || ctxInfo.hasExtension("GL_ARB_ES3_compatibility")) {
+            fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+        }
+    } else {
+        if (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"))) {
+            fConfigTable[kETC1_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+        }
+    }
 
     fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_COMPRESSED_R11_EAC;
     fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_COMPRESSED_R11_EAC;
     fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalFormat = 0;
     fConfigTable[kR11_EAC_GrPixelConfig].fFormats.fExternalType = 0;
     fConfigTable[kR11_EAC_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    // Check for R11_EAC. We don't support R11_EAC on desktop, as most cards default to
+    // decompressing the textures in the driver, and is generally slower.
+    if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) {
+        fConfigTable[kR11_EAC_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+    }
 
     fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fBaseInternalFormat =
         GR_GL_COMPRESSED_RGBA_ASTC_12x12;
@@ -1478,6 +1416,11 @@
     fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalFormat = 0;
     fConfigTable[kASTC_12x12_GrPixelConfig].fFormats.fExternalType = 0;
     fConfigTable[kASTC_12x12_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType;
+    if (ctxInfo.hasExtension("GL_KHR_texture_compression_astc_hdr") ||
+        ctxInfo.hasExtension("GL_KHR_texture_compression_astc_ldr") ||
+        ctxInfo.hasExtension("GL_OES_texture_compression_astc")) {
+        fConfigTable[kASTC_12x12_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag;
+    }
 
     // Bulk populate the texture internal/external formats here and then deal with exceptions below.