Commit 69df242c by Geoff Lang Committed by Commit Bot

Don't validate attribute types match for gl_VertexID and gl_InstanceID.

TEST=conformance2/glsl3/no-attribute-vertex-shader TEST=deqp/functional/gles3/instancedrendering BUG=angleproject:2012 Change-Id: I234410fabf6a8fcd87040c8085ca5dce82fa8932 Reviewed-on: https://chromium-review.googlesource.com/559851 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent d7cd4ae5
...@@ -755,6 +755,12 @@ bool ValidateVertexShaderAttributeTypeMatch(ValidationContext *context) ...@@ -755,6 +755,12 @@ bool ValidateVertexShaderAttributeTypeMatch(ValidationContext *context)
for (const auto &shaderAttribute : program->getAttributes()) for (const auto &shaderAttribute : program->getAttributes())
{ {
// gl_VertexID and gl_InstanceID are active attributes but don't have a bound attribute.
if (shaderAttribute.isBuiltIn())
{
continue;
}
GLenum shaderInputType = VariableComponentType(shaderAttribute.type); GLenum shaderInputType = VariableComponentType(shaderAttribute.type);
const auto &attrib = vao->getVertexAttribute(shaderAttribute.location); const auto &attrib = vao->getVertexAttribute(shaderAttribute.location);
......
...@@ -2881,6 +2881,34 @@ TEST_P(WebGL2CompatibilityTest, UniformBlockPrecisionMismatch) ...@@ -2881,6 +2881,34 @@ TEST_P(WebGL2CompatibilityTest, UniformBlockPrecisionMismatch)
glDeleteProgram(program); glDeleteProgram(program);
} }
// Test no attribute vertex shaders
TEST_P(WebGL2CompatibilityTest, NoAttributeVertexShader)
{
const std::string vertexShader =
"#version 300 es\n"
"void main()\n"
"{\n"
"\n"
" ivec2 xy = ivec2(gl_VertexID % 2, (gl_VertexID / 2 + gl_VertexID / 3) % 2);\n"
" gl_Position = vec4(vec2(xy) * 2. - 1., 0, 1);\n"
"}";
const std::string fragmentShader =
"#version 300 es\n"
"precision mediump float;\n"
"out vec4 result;\n"
"void main()\n"
"{\n"
" result = vec4(0, 1, 0, 1);\n"
"}";
ANGLE_GL_PROGRAM(program, vertexShader, fragmentShader);
glUseProgram(program);
glDrawArrays(GL_TRIANGLES, 0, 6);
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
// 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. // tests should be run against.
ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest, ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest,
......
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