Fix query for GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT for GrPixelConfigs that aren't renderable

We recently separated renderabibilty by Skia from FBO-bindable ( https://skia-review.googlesource.com/4345). Overlooked in that change was the necessity to be able to query GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT and _TYPE for formats that we don't support rendering to Skia but are legal color attachment formats.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2489643002

Review-Url: https://codereview.chromium.org/2489643002
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 0af5c57..a37d0e0 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -855,7 +855,8 @@
 bool GrGLCaps::readPixelsSupported(GrPixelConfig surfaceConfig,
                                    GrPixelConfig readConfig,
                                    std::function<void (GrGLenum, GrGLint*)> getIntegerv,
-                                   std::function<bool ()> bindRenderTarget) const {
+                                   std::function<bool ()> bindRenderTarget,
+                                   std::function<void ()> unbindRenderTarget) const {
     // If it's not possible to even have a color attachment of surfaceConfig then read pixels is
     // not supported regardless of readConfig.
     if (!this->canConfigBeFBOColorAttachment(surfaceConfig)) {
@@ -912,6 +913,7 @@
         getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &type);
         rpFormat->fFormat = format;
         rpFormat->fType = type;
+        unbindRenderTarget();
     }
 
     return fConfigTable[surfaceConfig].fSecondReadPixelsFormat.fFormat == readFormat &&