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/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,