Return HALF_FLOAT as an implementation read type in ES3.
BUG=765953
Change-Id: I4dc79921766975cd75c489887b7e57ec4666fbbb
Reviewed-on: https://chromium-review.googlesource.com/685897
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index faf985c..cf4a2fb 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -312,15 +312,24 @@
return format;
}
-GLenum InternalFormat::getReadPixelsType() const
+GLenum InternalFormat::getReadPixelsType(const Version &version) 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;
+ case GL_HALF_FLOAT_OES:
+ if (version < Version(3, 0))
+ {
+ // 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. HALF_FLOAT becomes core in ES3 and is acceptable to use
+ // as an IMPLEMENTATION_READ_TYPE.
+ return GL_HALF_FLOAT_OES;
+ }
+ else
+ {
+ return GL_HALF_FLOAT;
+ }
default:
return type;
diff --git a/src/libANGLE/formatutils.h b/src/libANGLE/formatutils.h
index 2d3f5f1..330afbd 100644
--- a/src/libANGLE/formatutils.h
+++ b/src/libANGLE/formatutils.h
@@ -83,7 +83,7 @@
bool isLUMA() const;
GLenum getReadPixelsFormat() const;
- GLenum getReadPixelsType() const;
+ GLenum getReadPixelsType(const Version &version) const;
// Return true if the format is a required renderbuffer format in the given version of the core
// spec. Note that it isn't always clear whether all the rules that apply to core required
diff --git a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
index b7ce556..8fe577c 100644
--- a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -232,7 +232,7 @@
const gl::InternalFormat &implementationFormatInfo =
gl::GetSizedInternalFormatInfo(implementationFormat);
- return implementationFormatInfo.getReadPixelsType();
+ return implementationFormatInfo.getReadPixelsType(context->getClientVersion());
}
gl::Error FramebufferD3D::readPixels(const gl::Context *context,
diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp
index 1b30710..221af40 100644
--- a/src/libANGLE/renderer/gl/FramebufferGL.cpp
+++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp
@@ -410,7 +410,7 @@
{
const auto *readAttachment = mState.getReadAttachment();
const Format &format = readAttachment->getFormat();
- return format.info->getReadPixelsType();
+ return format.info->getReadPixelsType(context->getClientVersion());
}
Error FramebufferGL::readPixels(const gl::Context *context,
diff --git a/src/libANGLE/renderer/null/FramebufferNULL.cpp b/src/libANGLE/renderer/null/FramebufferNULL.cpp
index 0112623..39a7adc 100644
--- a/src/libANGLE/renderer/null/FramebufferNULL.cpp
+++ b/src/libANGLE/renderer/null/FramebufferNULL.cpp
@@ -109,7 +109,7 @@
const gl::Format &format = readAttachment->getFormat();
ASSERT(format.info != nullptr);
- return format.info->getReadPixelsType();
+ return format.info->getReadPixelsType(context->getClientVersion());
}
gl::Error FramebufferNULL::readPixels(const gl::Context *context,