Commit e77f63a2 by Geoff Lang Committed by Commit Bot

Use clamp cast for stencil mask in all versions.

dEQP only covers this behaviour in ES2.0 tests and they fail when running with an ES3.1 context. BUG=angleproject:3425 Change-Id: I339b83901434da92ae6dd6273460b0725644cdf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1602177Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent eaf2d928
......@@ -2087,7 +2087,7 @@ angle::Result State::getIntegerv(const Context *context, GLenum pname, GLint *pa
*params = mStencilRef;
break;
case GL_STENCIL_VALUE_MASK:
*params = CastMaskValue(context, mDepthStencil.stencilMask);
*params = CastMaskValue(mDepthStencil.stencilMask);
break;
case GL_STENCIL_BACK_FUNC:
*params = mDepthStencil.stencilBackFunc;
......@@ -2096,7 +2096,7 @@ angle::Result State::getIntegerv(const Context *context, GLenum pname, GLint *pa
*params = mStencilBackRef;
break;
case GL_STENCIL_BACK_VALUE_MASK:
*params = CastMaskValue(context, mDepthStencil.stencilBackMask);
*params = CastMaskValue(mDepthStencil.stencilBackMask);
break;
case GL_STENCIL_FAIL:
*params = mDepthStencil.stencilFail;
......@@ -2138,10 +2138,10 @@ angle::Result State::getIntegerv(const Context *context, GLenum pname, GLint *pa
*params = mBlend.blendEquationAlpha;
break;
case GL_STENCIL_WRITEMASK:
*params = CastMaskValue(context, mDepthStencil.stencilWritemask);
*params = CastMaskValue(mDepthStencil.stencilWritemask);
break;
case GL_STENCIL_BACK_WRITEMASK:
*params = CastMaskValue(context, mDepthStencil.stencilBackWritemask);
*params = CastMaskValue(mDepthStencil.stencilBackWritemask);
break;
case GL_STENCIL_CLEAR_VALUE:
*params = mStencilClearValue;
......
......@@ -69,14 +69,9 @@ NativeT CastQueryValueToInt(GLenum pname, QueryT value)
} // anonymous namespace
// ES 3.10 Section 2.2.2
// When querying bitmasks(such as SAMPLE_MASK_VALUE or STENCIL_WRITEMASK) with GetIntegerv, the
// mask value is treated as a signed integer, so that mask values with the high bit set will not be
// clamped when returned as signed integers.
GLint CastMaskValue(const Context *context, GLuint value)
GLint CastMaskValue(GLuint value)
{
return (context->getClientVersion() >= Version(3, 1) ? static_cast<GLint>(value)
: clampCast<GLint>(value));
return clampCast<GLint>(value);
}
template <typename QueryT, typename InternalT>
......
......@@ -58,7 +58,7 @@ struct GLTypeToGLenum<GLfloat>
static constexpr GLenum value = GL_FLOAT;
};
GLint CastMaskValue(const Context *context, GLuint value);
GLint CastMaskValue(GLuint value);
template <typename QueryT, typename InternalT>
QueryT CastFromGLintStateValue(GLenum pname, InternalT value);
......
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