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/renderer/d3d/FramebufferD3D.cpp b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
index a45c945..a272264 100644
--- a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -207,7 +207,7 @@
GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
const gl::InternalFormat &implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
- return implementationFormatInfo.format;
+ return implementationFormatInfo.getReadPixelsFormat();
}
GLenum FramebufferD3D::getImplementationColorReadType() const
@@ -229,7 +229,7 @@
GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
const gl::InternalFormat &implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
- return implementationFormatInfo.type;
+ return implementationFormatInfo.getReadPixelsType();
}
gl::Error FramebufferD3D::readPixels(ContextImpl *context,