Commit bbd532d1 by Joonatan Saarhelo Committed by Commit Bot

Fix querying large vertex attrib divisors

glGetVertexAttribIuiv previously returned an incorrect value for GL_VERTEX_ATTRIB_ARRAY_DIVISOR, because the divisor was treated as an integer even though it is an unsigned integer. BUG=angleproject:2281 Change-Id: I4d1c9df15244db855c6a000fc8fb6cc786bfcb85 Reviewed-on: https://chromium-review.googlesource.com/c/1273300Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 79b91407
...@@ -121,6 +121,7 @@ template GLint CastFromStateValue<GLint, GLint64>(GLenum pname, GLint64 value); ...@@ -121,6 +121,7 @@ template GLint CastFromStateValue<GLint, GLint64>(GLenum pname, GLint64 value);
template GLint64 CastFromStateValue<GLint64, GLint>(GLenum pname, GLint value); template GLint64 CastFromStateValue<GLint64, GLint>(GLenum pname, GLint value);
template GLint64 CastFromStateValue<GLint64, GLint64>(GLenum pname, GLint64 value); template GLint64 CastFromStateValue<GLint64, GLint64>(GLenum pname, GLint64 value);
template GLfloat CastFromStateValue<GLfloat, GLint>(GLenum pname, GLint value); template GLfloat CastFromStateValue<GLfloat, GLint>(GLenum pname, GLint value);
template GLfloat CastFromStateValue<GLfloat, GLuint>(GLenum pname, GLuint value);
template GLfloat CastFromStateValue<GLfloat, GLfloat>(GLenum pname, GLfloat value); template GLfloat CastFromStateValue<GLfloat, GLfloat>(GLenum pname, GLfloat value);
template GLint CastFromStateValue<GLint, GLfloat>(GLenum pname, GLfloat value); template GLint CastFromStateValue<GLint, GLfloat>(GLenum pname, GLfloat value);
template GLuint CastFromStateValue<GLuint, GLint>(GLenum pname, GLint value); template GLuint CastFromStateValue<GLuint, GLint>(GLenum pname, GLint value);
......
...@@ -423,7 +423,7 @@ void QueryVertexAttribBase(const VertexAttribute &attrib, ...@@ -423,7 +423,7 @@ void QueryVertexAttribBase(const VertexAttribute &attrib,
*params = CastFromGLintStateValue<ParamType>(pname, binding.getBuffer().id()); *params = CastFromGLintStateValue<ParamType>(pname, binding.getBuffer().id());
break; break;
case GL_VERTEX_ATTRIB_ARRAY_DIVISOR: case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
*params = CastFromGLintStateValue<ParamType>(pname, binding.getDivisor()); *params = CastFromStateValue<ParamType>(pname, binding.getDivisor());
break; break;
case GL_VERTEX_ATTRIB_ARRAY_INTEGER: case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
*params = CastFromGLintStateValue<ParamType>(pname, attrib.pureInteger); *params = CastFromGLintStateValue<ParamType>(pname, attrib.pureInteger);
......
...@@ -621,6 +621,19 @@ void main() ...@@ -621,6 +621,19 @@ void main()
} }
} }
// This is a regression test. If VertexAttribDivisor was returned as a signed integer, it would be
// incorrectly clamped down to the maximum signed integer.
TEST_P(InstancingTestES3, LargestDivisor)
{
constexpr GLuint kLargeDivisor = std::numeric_limits<GLuint>::max();
glVertexAttribDivisor(0, kLargeDivisor);
GLuint divisor = 0;
glGetVertexAttribIuiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, &divisor);
EXPECT_EQ(kLargeDivisor, divisor)
<< "Vertex attrib divisor read was not the same that was passed in.";
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against. We test on D3D9 and D3D11 9_3 because they use special codepaths // tests should be run against. We test on D3D9 and D3D11 9_3 because they use special codepaths
// when attribute zero is instanced, unlike D3D11. // when attribute zero is instanced, unlike D3D11.
......
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