Move ReadPixels to the Framebuffer object and Impl.

BUG=angle:841

Change-Id: I71deac9e755b5dfa010596cd1f8a213c24d895bf
Reviewed-on: https://chromium-review.googlesource.com/232691
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 20d0a20..b613ee9 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -906,17 +906,18 @@
         return false;
     }
 
-    if (!framebuffer->getReadColorbuffer())
+    const FramebufferAttachment *readBuffer = framebuffer->getReadColorbuffer();
+    if (!readBuffer)
     {
         context->recordError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
-    GLenum currentInternalFormat, currentFormat, currentType;
+    GLenum currentFormat = framebuffer->getImplementationColorReadFormat();
+    GLenum currentType = framebuffer->getImplementationColorReadType();
+    GLenum currentInternalFormat = readBuffer->getActualFormat();
     GLuint clientVersion = context->getClientVersion();
 
-    context->getCurrentReadFormatType(&currentInternalFormat, &currentFormat, &currentType);
-
     bool validReadFormat = (clientVersion < 3) ? ValidES2ReadFormatType(context, format, type) :
                                                  ValidES3ReadFormatType(context, currentInternalFormat, format, type);