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

Nicolai Hähnle nhaehnle at gmail.com
Wed Oct 5 15:08:49 UTC 2016


On 05.10.2016 16:18, Samuel Pitoiset wrote:
> 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.
> +	 */

The ARB_compute_variable_group_size spec actually explicitly points out 
in an editing note:

    "(insert after the first INVALID_OPERATION error in the first error
    block, shared between DispatchCompute and
    DispatchComputeGroupSizeARB, p. 586)"

So the INVALID_VALUE for excessive num_groups in the error block from 
ARB_computer_shader / the OpenGL >= 4.3 spec applies. With the comment 
updated accordingly, this patch is

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

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


More information about the Piglit mailing list