[Piglit] [PATCH 4/4] GS: Test that max_vertices cannot be greater than glMaxGeometryOutputVertices

Paul Berry stereotype441 at gmail.com
Mon Sep 30 14:02:31 PDT 2013


On 16 September 2013 09:35, Nicholas Mack <nichmack at gmail.com> wrote:

> ---
>  .../glsl-1.50/compiler/layout-max-verts-limited.geom    | 17
> +++++++++++++++++
>  1 file changed, 17 insertions(+)
>  create mode 100644
> tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom
>
> diff --git a/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom
> b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom
> new file mode 100644
> index 0000000..7794d94
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom
> @@ -0,0 +1,17 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// check_link: true
> +// [end config]
> +//
> +// Section 4.3.8 (Output Layout Qualifiers) of the GLSL 1.50 spec says:
> +// "It is an error for the maximum number of vertices to be greater than
> +//  gl_MaxGeometryOutputVertices."
> +
> +#version 150
> +
> +layout(max_vertices = 2147483647) out;
> +
> +void main()
> +{
> +}
>

The commit message and the comment are a little misleading.  They say that
we're testing that max_vertices can't be larger than
gl_MaxGeometryOutputVertices, but in fact, we're testing that max_vertices
can't be set to INT_MAX.

It would be a pain to write the test that the comment implies (we would
have to write a C program that queries gl_MaxGeometryOutputVertices, adds
1, and then sprintfs the result into a dynamically-constructed geometry
shader), so I think it's ok to go ahead and do this test as a stopgap, but
we should change the commit message and the comment to accurately describe
what the test is doing.  Maybe change the commit message to something like
"GS: Test that max_vertices cannot be set to INT_MAX"?

And maybe add an explanatory comment to the test that says something like:

// Unfortunately, we can't easlily try to set max_vertices to
// gl_MaxGeometryOutputVertices+1, since "max_vertices=" must be
// followed by an integer-constant (not a constant expression), so as
// a stop gap, we just verify that setting max_vertices = INT_MAX
// leads to an error.

With those changes, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130930/c93240a4/attachment.html>


More information about the Piglit mailing list