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/1187511
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index 0a0fd1d..cc80c13 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -3347,7 +3347,14 @@
{
case GL_UNIFORM_TYPE:
case GL_UNIFORM_SIZE:
+ break;
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_OFFSET:
case GL_UNIFORM_ARRAY_STRIDE:
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index a7779e3..21c517b 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -4223,6 +4223,21 @@
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
// tests should be run against.
ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest,