Commit c71ea661 by Geoff Lang Committed by Commit Bot

Return HALF_FLOAT as an implementation read type in ES3.

BUG=765953 Change-Id: I4dc79921766975cd75c489887b7e57ec4666fbbb Reviewed-on: https://chromium-review.googlesource.com/685897Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 457ded9b
......@@ -312,15 +312,24 @@ GLenum InternalFormat::getReadPixelsFormat() const
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;
......
......@@ -83,7 +83,7 @@ struct InternalFormat
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
......
......@@ -232,7 +232,7 @@ GLenum FramebufferD3D::getImplementationColorReadType(const gl::Context *context
const gl::InternalFormat &implementationFormatInfo =
gl::GetSizedInternalFormatInfo(implementationFormat);
return implementationFormatInfo.getReadPixelsType();
return implementationFormatInfo.getReadPixelsType(context->getClientVersion());
}
gl::Error FramebufferD3D::readPixels(const gl::Context *context,
......
......@@ -410,7 +410,7 @@ GLenum FramebufferGL::getImplementationColorReadType(const gl::Context *context)
{
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,
......
......@@ -109,7 +109,7 @@ GLenum FramebufferNULL::getImplementationColorReadType(const gl::Context *contex
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment