Commit 6b4962e8 by Mohan Maiya Committed by Commit Bot

Allow GL_UNSIGNED_BYTE as a type for glColorPointer

Previously glColorPointer would reject GL_UNSIGNED_BYTE. This should be allowed in both the gles 1 and 1.1 specifications. See page 6 of the gles 1 specification and page 20 of the gles 1.1 specification. This change allows doodle jump to work on angle on both the gl and vulkan backend Bug: angleproject:4308 Tests: angle_end2end_tests --gtest_filter=VertexPointerTest.AssignRetrieveColorUnsignedByte* Change-Id: I35f41b28d94cb34bc36256420b57793691b78cff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2424465 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent edea3d95
......@@ -146,6 +146,13 @@ bool ValidateBuiltinVertexAttributeCommon(const Context *context,
case VertexAttribType::Fixed:
case VertexAttribType::Float:
break;
case VertexAttribType::UnsignedByte:
if (arrayType != ClientVertexArrayType::Color)
{
context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
return false;
}
break;
default:
context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
return false;
......
......@@ -64,4 +64,35 @@ TEST_P(VertexPointerTest, AssignRetrieve)
}
}
// Checks that we can assign to client side vertex arrays with color vertex attributes of type
// GLubyte
TEST_P(VertexPointerTest, AssignRetrieveColorUnsignedByte)
{
std::vector<float> testVertexAttribute = {
1.0f,
1.0f,
1.0f,
1.0f,
};
std::vector<GLubyte> testColorAttribute = {
1,
1,
1,
1,
};
glVertexPointer(4, GL_FLOAT, 0, testVertexAttribute.data());
EXPECT_GL_NO_ERROR();
void *ptr = nullptr;
glGetPointerv(GL_VERTEX_ARRAY_POINTER, &ptr);
EXPECT_EQ(testVertexAttribute.data(), ptr);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, testColorAttribute.data());
glGetPointerv(GL_COLOR_ARRAY_POINTER, &ptr);
EXPECT_EQ(testColorAttribute.data(), ptr);
ASSERT_GL_NO_ERROR();
}
ANGLE_INSTANTIATE_TEST_ES1(VertexPointerTest);
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