[Piglit] [PATCH] arb_compute_variable_group_size: check for invalid work group count

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Oct 5 14:18:59 UTC 2016


The spec says nothing for that (although ARB_compute_shader does),
but it makes sense to return INVALID_VALUE when the number of work
group count is greater than the maximum allowed in any dimensions.

This test passes with NVIDIA blob.

Cc: Nicolai Hähnle <nicolai.haehnle at amd.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 .../spec/arb_compute_variable_group_size/errors.c  | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tests/spec/arb_compute_variable_group_size/errors.c b/tests/spec/arb_compute_variable_group_size/errors.c
index f020120..2ecd2fd 100644
--- a/tests/spec/arb_compute_variable_group_size/errors.c
+++ b/tests/spec/arb_compute_variable_group_size/errors.c
@@ -131,6 +131,30 @@ use_fixed_work_group_size()
 }
 
 static enum piglit_result
+use_invalid_work_group_count_values()
+{
+	GLint prog, v[3];
+
+	/* Nothing is specified in the spec but it makes sense to return
+	 * INVALID_VALUE when the number of work group count is greater than
+	 * the maximum allowed in any dimensions.
+	 */
+	prog = piglit_build_simple_program_multiple_shaders(
+		GL_COMPUTE_SHADER, variable_work_group_size_shader, 0);
+	glUseProgram(prog);
+
+	/* Use values greater than the maximum work group count. */
+	glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, &v[0]);
+	glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, &v[1]);
+	glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, &v[2]);
+
+	glDispatchComputeGroupSizeARB(v[0] + 1, v[1] + 1, v[2] + 1, 1, 1, 1);
+	if (!piglit_check_gl_error(GL_INVALID_VALUE))
+		return PIGLIT_FAIL;
+	return PIGLIT_PASS;
+}
+
+static enum piglit_result
 use_invalid_variable_work_group_size_values()
 {
 	/* The ARB_compute_variable_group_size spec says:
@@ -210,6 +234,12 @@ static const struct piglit_subtest subtests[] = {
 		NULL
 	},
 	{
+		"Use invalid work group count values",
+		"use_invalid_work_group_count_values",
+		use_invalid_work_group_count_values,
+		NULL
+	},
+	{
 		"Use invalid variable work group size values",
 		"use_invalid_variable_work_group_size_values",
 		use_invalid_variable_work_group_size_values,
-- 
2.10.0



More information about the Piglit mailing list