Remove remaining functions in GrGLCaps that use GrPixelConfig.

At this point this just leaves the function that converts a GrBackendFormat
to a GrPixelConfig. This function will probably need to live until we
fully remove GrPixelConfig.

Also removed the bgraIsInternalFormat call since we literally have the format
so we can just straight up check if it is bgra or not.

Bug: skia:6718
Change-Id: I917d9361b590d69baeb0f6a5e1e5dae6908f09ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234658
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index c585727..e70fcfa 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1249,10 +1249,6 @@
 void GrGLCaps::onDumpJSON(SkJSONWriter* writer) const { }
 #endif
 
-bool GrGLCaps::bgraIsInternalFormat() const {
-    return this->getFormatFromColorType(GrColorType::kBGRA_8888) == GrGLFormat::kBGRA8;
-}
-
 void GrGLCaps::getTexImageFormats(GrGLFormat surfaceFormat, GrColorType surfaceColorType,
                                   GrColorType memoryColorType, GrGLenum* internalFormat,
                                   GrGLenum* externalFormat, GrGLenum* externalType) const {
@@ -2911,7 +2907,7 @@
     // Table 3.9 of the ES2 spec indicates the supported formats with CopyTexSubImage
     // and BGRA isn't in the spec. There doesn't appear to be any extension that adds it. Perhaps
     // many drivers would allow it to work, but ANGLE does not.
-    if (GR_IS_GR_GL_ES(fStandard) && this->bgraIsInternalFormat() &&
+    if (GR_IS_GR_GL_ES(fStandard) &&
         (dstFormat == GrGLFormat::kBGRA8 || srcFormat == GrGLFormat::kBGRA8)) {
         return false;
     }
@@ -3083,11 +3079,12 @@
         blitFramebufferRestrictions.fRectsMustMatch = GrSurfaceProxy::RectsMustMatch::kYes;
     }
 
+    auto srcFormat = src->backendFormat().asGLFormat();
     // Check for format issues with glCopyTexSubImage2D
-    if (this->bgraIsInternalFormat() && kBGRA_8888_GrPixelConfig == src->config()) {
+    if (srcFormat == GrGLFormat::kBGRA8) {
         // glCopyTexSubImage2D doesn't work with this config. If the bgra can be used with fbo blit
         // then we set up for that, otherwise fail.
-        if (this->canConfigBeFBOColorAttachment(kBGRA_8888_GrPixelConfig)) {
+        if (this->canFormatBeFBOColorAttachment(srcFormat)) {
             return blitFramebufferRestrictions;
         }
         // Caller will have to use a draw.
@@ -3100,7 +3097,7 @@
         if (srcIsMSAARenderbuffer) {
             // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up for FBO
             // blit or fail.
-            if (this->canConfigBeFBOColorAttachment(src->config())) {
+            if (this->canFormatBeFBOColorAttachment(srcFormat)) {
                 return blitFramebufferRestrictions;
             }
             // Caller will have to use a draw.
@@ -3837,53 +3834,6 @@
     return SkToBool(this->getFormatInfo(format).fFlags & FormatInfo::kCanUseTexStorage_Flag);
 }
 
-GrGLFormat GrGLCaps::pixelConfigToFormat(GrPixelConfig config) const {
-    switch (config) {
-        case kRGB_888X_GrPixelConfig:
-            return GrGLFormat::kRGBA8;
-        case kAlpha_8_as_Alpha_GrPixelConfig:
-            return GrGLFormat::kALPHA8;
-        case kAlpha_8_as_Red_GrPixelConfig:
-            return GrGLFormat::kR8;
-        case kGray_8_as_Lum_GrPixelConfig:
-            return GrGLFormat::kLUMINANCE8;
-        case kGray_8_as_Red_GrPixelConfig:
-            return GrGLFormat::kR8;
-        case kAlpha_half_as_Lum_GrPixelConfig:
-            return GrGLFormat::kLUMINANCE16F;
-        case kAlpha_half_as_Red_GrPixelConfig:
-            return GrGLFormat::kR16F;
-        case kRGB_ETC1_GrPixelConfig: {
-            const auto& info = this->getFormatInfo(GrGLFormat::kCOMPRESSED_ETC1_RGB8);
-            bool usesETC1 = SkToBool(info.fFlags & FormatInfo::kTexturable_Flag);
-            return usesETC1 ? GrGLFormat::kCOMPRESSED_ETC1_RGB8
-                            : GrGLFormat::kCOMPRESSED_RGB8_ETC2;
-        }
-        case kUnknown_GrPixelConfig:
-        case kAlpha_8_GrPixelConfig:
-        case kGray_8_GrPixelConfig:
-        case kRGB_565_GrPixelConfig:
-        case kRGBA_4444_GrPixelConfig:
-        case kRGBA_8888_GrPixelConfig:
-        case kRGB_888_GrPixelConfig:
-        case kRG_88_GrPixelConfig:
-        case kBGRA_8888_GrPixelConfig:
-        case kSRGBA_8888_GrPixelConfig:
-        case kRGBA_1010102_GrPixelConfig:
-        case kRGBA_float_GrPixelConfig:
-        case kAlpha_half_GrPixelConfig:
-        case kRGBA_half_GrPixelConfig:
-        case kRGBA_half_Clamped_GrPixelConfig:
-        case kR_16_GrPixelConfig:
-        case kRG_1616_GrPixelConfig:
-        case kRGBA_16161616_GrPixelConfig:
-        case kRG_half_GrPixelConfig:
-            return this->getFormatFromColorType(GrPixelConfigToColorType(config));
-    }
-    SkUNREACHABLE;
-    return GrGLFormat::kUnknown;
-}
-
 static GrPixelConfig validate_sized_format(GrGLFormat format,
                                            GrColorType ct,
                                            GrGLStandard standard) {
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index acae805..a49edd7 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -137,31 +137,15 @@
 
     bool canFormatBeFBOColorAttachment(GrGLFormat) const;
 
-    bool canConfigBeFBOColorAttachment(GrPixelConfig config) const {
-        auto format = this->pixelConfigToFormat(config);
-        return this->canFormatBeFBOColorAttachment(format);
-    }
-
-    bool configSupportsTexStorage(GrPixelConfig config) const {
-        auto format = this->pixelConfigToFormat(config);
-        return this->formatSupportsTexStorage(format);
-    }
-
     GrGLFormat getFormatFromColorType(GrColorType colorType) const {
         int idx = static_cast<int>(colorType);
         return fColorTypeToFormatTable[idx];
     }
 
-    GrGLenum configSizedInternalFormat(GrPixelConfig config) const {
-        return this->getSizedInternalFormat(this->pixelConfigToFormat(config));
-    }
     GrGLenum formatSizedInternalFormat(GrGLFormat format) const {
         return this->getFormatInfo(format).fSizedInternalFormat;
     }
 
-    // TODO: Once pixel config is no longer used in the caps remove this helper function.
-    GrGLFormat pixelConfigToFormat(GrPixelConfig) const;
-
     void getTexImageFormats(GrGLFormat surfaceFormat, GrColorType surfaceColorType,
                             GrColorType memoryColorType, GrGLenum* internalFormat,
                             GrGLenum* externalFormat, GrGLenum* externalType) const;
@@ -290,13 +274,6 @@
     /// The maximum number of fragment uniform vectors (GLES has min. 16).
     int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; }
 
-    /**
-     * Depending on the ES extensions present the BGRA external format may
-     * correspond to either a BGRA or RGBA internalFormat. On desktop GL it is
-     * RGBA.
-     */
-    bool bgraIsInternalFormat() const;
-
     /// Is there support for GL_PACK_REVERSE_ROW_ORDER
     bool packFlipYSupport() const { return fPackFlipYSupport; }
 
@@ -562,20 +539,6 @@
         GrGLenum fType;
     };
 
-    struct ConfigFormats {
-        ConfigFormats() {
-            // Inits to known bad GL enum values.
-            memset(this, 0xAB, sizeof(ConfigFormats));
-        }
-
-    };
-
-    struct ConfigInfo {
-        ConfigFormats fFormats;
-    };
-
-    ConfigInfo fConfigTable[kGrPixelConfigCnt];
-
     /** Number type of the components (with out considering number of bits.) */
     enum class FormatType {
         kUnknown,