ES31: Add missing checks for querying GL_COMPUTE_WORK_GROUP_SIZE
This patch adds missing checks for querying GL_COMPUTE_WORK_GROUP_SIZE
by glGetProgramiv.
When querying GL_COMPUTE_WORK_GROUP_SIZE, an INVALID_OPERATION error
should be generated when this program hasn't been linked successfully
or it doesn't contain any objects to form a compute shader.
BUG=angleproject:2324
TEST=angle_end2end_tests
dEQP-GLES31.functional.debug.negative_coverage.get_error.compute.invalid_program_query
Change-Id: I13dcebef8a0abede5c18a038d4cf915ee4164e2e
Reviewed-on: https://chromium-review.googlesource.com/933627
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/ComputeShaderTest.cpp b/src/tests/gl_tests/ComputeShaderTest.cpp
index 5832a3e..d86fff1 100644
--- a/src/tests/gl_tests/ComputeShaderTest.cpp
+++ b/src/tests/gl_tests/ComputeShaderTest.cpp
@@ -1152,6 +1152,47 @@
}
}
+// Verify an INVALID_OPERATION error is reported when querying GL_COMPUTE_WORK_GROUP_SIZE for a
+// program which has not been linked successfully or which does not contain objects to form a
+// compute shader.
+TEST_P(ComputeShaderTest, QueryComputeWorkGroupSize)
+{
+ const std::string vsSource =
+ R"(#version 310 es
+ void main()
+ {
+ })";
+
+ const std::string fsSource =
+ R"(#version 310 es
+ void main()
+ {
+ })";
+
+ GLint workGroupSize[3];
+
+ ANGLE_GL_PROGRAM(graphicsProgram, vsSource, fsSource);
+ glGetProgramiv(graphicsProgram, GL_COMPUTE_WORK_GROUP_SIZE, workGroupSize);
+ EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+
+ GLuint computeProgram = glCreateProgram();
+ GLShader computeShader(GL_COMPUTE_SHADER);
+ glAttachShader(computeProgram, computeShader);
+ glLinkProgram(computeProgram);
+ glDetachShader(computeProgram, computeShader);
+
+ GLint linkStatus;
+ glGetProgramiv(computeProgram, GL_LINK_STATUS, &linkStatus);
+ ASSERT_GL_FALSE(linkStatus);
+
+ glGetProgramiv(computeProgram, GL_COMPUTE_WORK_GROUP_SIZE, workGroupSize);
+ EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+
+ glDeleteProgram(computeProgram);
+
+ ASSERT_GL_NO_ERROR();
+}
+
// Check that it is not possible to create a compute shader when the context does not support ES
// 3.10
TEST_P(ComputeShaderTestES3, NotSupported)