Commit 22f7aafb by Bryan Bernhart Committed by Commit Bot

Add webgl checks in GetActiveUniformsiv.

Add validation that disallows GL_UNIFORM_NAME_LENGTH from being used. BUG=angleproject:1523 TEST=angle_end2end_tests Change-Id: Id70e25ab79fd93ae4eb8b8343819458a4a0e4a71 Reviewed-on: https://chromium-review.googlesource.com/1187511Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarBryan Bernhart <bryan.bernhart@intel.com> Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent c14ab2a7
...@@ -3347,7 +3347,14 @@ bool ValidateGetActiveUniformsiv(Context *context, ...@@ -3347,7 +3347,14 @@ bool ValidateGetActiveUniformsiv(Context *context,
{ {
case GL_UNIFORM_TYPE: case GL_UNIFORM_TYPE:
case GL_UNIFORM_SIZE: case GL_UNIFORM_SIZE:
break;
case GL_UNIFORM_NAME_LENGTH: case GL_UNIFORM_NAME_LENGTH:
if (context->getExtensions().webglCompatibility)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false;
}
break;
case GL_UNIFORM_BLOCK_INDEX: case GL_UNIFORM_BLOCK_INDEX:
case GL_UNIFORM_OFFSET: case GL_UNIFORM_OFFSET:
case GL_UNIFORM_ARRAY_STRIDE: case GL_UNIFORM_ARRAY_STRIDE:
......
...@@ -4223,6 +4223,21 @@ TEST_P(WebGL2CompatibilityTest, TransformFeedbackCheckNullDeref) ...@@ -4223,6 +4223,21 @@ TEST_P(WebGL2CompatibilityTest, TransformFeedbackCheckNullDeref)
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
} }
// Check the return type of a given parameter upon getting the active uniforms.
TEST_P(WebGL2CompatibilityTest, UniformVariablesReturnTypes)
{
ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());
std::vector<GLuint> validUniformIndices = {0};
std::vector<GLint> uniformNameLengthBuf(validUniformIndices.size());
// This should fail because GL_UNIFORM_NAME_LENGTH cannot be used in WebGL2.
glGetActiveUniformsiv(program, static_cast<GLsizei>(validUniformIndices.size()),
&validUniformIndices[0], GL_UNIFORM_NAME_LENGTH,
&uniformNameLengthBuf[0]);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
}
// 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