Fix validation of ReadPixels format and type.

The validation for ReadPixels allows for two combations of format/type:
  1. Based on the current framebuffer's component type.
    * GL_RGBA/GL_UNSIGNED_BYTE if the framebuffer is a normalized (signed
      or unsigned).
    * GL_RGBA_INTEGER/GL_INTEGER if the framebuffer is an
      integer format.
    * GL_RGBA_INTEGER/GL_UNSIGNED_INTEGER if the framebuffer is an
      unsigned integer format.
    * GL_RGBA/GL_FLOAT if the framebuffer is any type of float
      framebuffer (added in EXT_color_buffer_float).
    * These combations are detailed in the ES2 spec on pg 105 or ES3 on pg
      193.
  2. The implementation read format/type returned from glGetIntegerv.
    * These formats are added by specs, OES_texture_float, EXT_texture_rg,
      EXT_read_format_bgra, etc.

Update the GL and D3D backends to perform the conversion from GL_HALF_FLOAT
to GL_HALF_FLOAT_OES.

Continue allowing reading as BGRA_EXT to support Skia.  Should be removed in
the future.

BUG=607283
BUG=angleproject:1478

Change-Id: I0312cad4d5f138ab036f383d221f8ccd19a77f6d
Reviewed-on: https://chromium-review.googlesource.com/346232
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index 0d52428..067b224 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -352,6 +352,26 @@
             (luminanceBits + alphaBits) > 0);
 }
 
+GLenum InternalFormat::getReadPixelsFormat() const
+{
+    return format;
+}
+
+GLenum InternalFormat::getReadPixelsType() const
+{
+    switch (type)
+    {
+        case GL_HALF_FLOAT:
+            // The internal format may have a type of GL_HALF_FLOAT but when exposing this type as
+            // the IMPLEMENTATION_READ_TYPE, only HALF_FLOAT_OES is allowed by
+            // OES_texture_half_float
+            return GL_HALF_FLOAT_OES;
+
+        default:
+            return type;
+    }
+}
+
 Format::Format(GLenum internalFormat) : Format(GetInternalFormatInfo(internalFormat))
 {
 }