Move read pixels format info into ConifgInfo in GrGLCaps
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1542813004

Review URL: https://codereview.chromium.org/1542813004
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index f32684e..230bffc 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -285,9 +285,8 @@
 
     /// Does ReadPixels support the provided format/type combo?
     bool readPixelsSupported(const GrGLInterface* intf,
-                             GrGLenum format,
-                             GrGLenum type,
-                             GrGLenum currFboFormat) const;
+                             GrPixelConfig readConfig,
+                             GrPixelConfig currFBOConfig) const;
 
     bool isCoreProfile() const { return fIsCoreProfile; }
 
@@ -342,8 +341,6 @@
     void initConfigRenderableTable(const GrGLContextInfo&, bool srgbSupport);
     void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*, bool srgbSupport);
 
-    bool doReadPixelsSupported(const GrGLInterface* intf, GrGLenum format, GrGLenum type) const;
-
     void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo,
                                   const GrGLInterface* intf,
                                   GrGLSLCaps* glslCaps);
@@ -374,7 +371,6 @@
     bool fTexStorageSupport : 1;
     bool fTextureRedSupport : 1;
     bool fImagingSupport  : 1;
-    bool fTwoFormatLimit : 1;
     bool fVertexArrayObjectSupport : 1;
     bool fDirectStateAccessSupport : 1;
     bool fDebugSupport : 1;
@@ -389,11 +385,30 @@
     bool fBindUniformLocationSupport : 1;
     bool fExternalTextureSupport : 1;
 
+    /** Number type of the components (with out considering number of bits.) */
+    enum FormatType {
+        kNormalizedFixedPoint_FormatType,
+        kFloat_FormatType,
+    };
+
+    struct ReadPixelsFormat {
+        ReadPixelsFormat() : fFormat(0), fType(0) {}
+        GrGLenum fFormat;
+        GrGLenum fType;
+    };
+
     struct ConfigInfo {
-        ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex), fFlags(0) {};
+        ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex), fFlags(0) {}
 
         ConfigFormats fFormats;
 
+        FormatType fFormatType;
+
+        // On ES contexts there are restrictions on type type/format that may be used for
+        // ReadPixels. One is implicitly specified by the current FBO's format. The other is
+        // queryable. This stores the queried option (lazily).
+        ReadPixelsFormat fSecondReadPixelsFormat;
+
         enum {
             // This indicates that a stencil format has not yet been determined for the config.
             kUnknown_StencilIndex = -1,
@@ -412,19 +427,6 @@
 
     ConfigInfo fConfigTable[kGrPixelConfigCnt];
 
-    struct ReadPixelsSupportedFormat {
-        GrGLenum fFormat;
-        GrGLenum fType;
-        GrGLenum fFboFormat;
-
-        bool operator==(const ReadPixelsSupportedFormat& rhs) const {
-            return fFormat    == rhs.fFormat
-                && fType      == rhs.fType
-                && fFboFormat == rhs.fFboFormat;
-        }
-    };
-    mutable SkTHashMap<ReadPixelsSupportedFormat, bool> fReadPixelsSupportedCache;
-
     typedef GrCaps INHERITED;
 };