[Piglit] [PATCH] arb_tessellation_shader: Add tests covering handling of unsized arrays
Ilia Mirkin
imirkin at alum.mit.edu
Tue Aug 26 05:16:51 PDT 2014
On Tue, Aug 26, 2014 at 5:08 AM, Chris Forbes <chrisf at ijw.co.nz> wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
> .../compiler/custom-in-length.tesc | 14 ++++++++++++++
> .../compiler/custom-in-length.tese | 14 ++++++++++++++
> .../compiler/custom-out-length-1.tesc | 16 ++++++++++++++++
> .../compiler/custom-out-length-2.tesc | 16 ++++++++++++++++
> .../compiler/custom-patch-in-length.tese | 14 ++++++++++++++
> .../compiler/custom-patch-out-length-no-conflict.tesc | 16 ++++++++++++++++
> .../compiler/custom-patch-out-length.tesc | 16 ++++++++++++++++
> .../arb_tessellation_shader/compiler/gl_in-length.tesc | 12 ++++++++++++
> .../arb_tessellation_shader/compiler/gl_in-length.tese | 12 ++++++++++++
> .../compiler/gl_out-length-before-declared.tesc | 14 ++++++++++++++
> .../arb_tessellation_shader/compiler/gl_out-length.tesc | 14 ++++++++++++++
> 11 files changed, 158 insertions(+)
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-in-length.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-in-length.tese
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-out-length-1.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-out-length-2.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-patch-in-length.tese
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length-no-conflict.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/gl_in-length.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/gl_in-length.tese
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/gl_out-length-before-declared.tesc
> create mode 100644 tests/spec/arb_tessellation_shader/compiler/gl_out-length.tesc
>
> diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-in-length.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-in-length.tesc
> new file mode 100644
> index 0000000..9f693a4
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/custom-in-length.tesc
> @@ -0,0 +1,14 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +in float xs[];
> +
> +/* Since xs is unsized, xs.length() is gl_MaxPatchVertices */
> +
> +int test[(xs.length() == gl_MaxPatchVertices) ? 1 : -1];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-in-length.tese b/tests/spec/arb_tessellation_shader/compiler/custom-in-length.tese
> new file mode 100644
> index 0000000..9f693a4
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/custom-in-length.tese
> @@ -0,0 +1,14 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +in float xs[];
> +
> +/* Since xs is unsized, xs.length() is gl_MaxPatchVertices */
> +
> +int test[(xs.length() == gl_MaxPatchVertices) ? 1 : -1];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-out-length-1.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-out-length-1.tesc
> new file mode 100644
> index 0000000..a442be9
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/custom-out-length-1.tesc
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +layout(vertices = 3) out;
> +
> +out float xs[];
> +
> +/* xs is sized by the preceding output layout declaration */
> +
> +int test[(xs.length() == 3) ? 1 : -1];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-out-length-2.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-out-length-2.tesc
> new file mode 100644
> index 0000000..c13b176
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/custom-out-length-2.tesc
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +out float xs[];
> +
> +layout(vertices = 3) out;
> +
> +/* xs is sized by the preceding output layout declaration */
> +
> +int test[(xs.length() == 3) ? 1 : -1];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-patch-in-length.tese b/tests/spec/arb_tessellation_shader/compiler/custom-patch-in-length.tese
> new file mode 100644
> index 0000000..69a04c9
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/custom-patch-in-length.tese
> @@ -0,0 +1,14 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +patch in float xs[];
> +
> +/* xs is a patch input, so is not sized to gl_MaxPatchVertices */
> +
> +int test[xs.length()];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length-no-conflict.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length-no-conflict.tesc
> new file mode 100644
> index 0000000..55c46c0
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length-no-conflict.tesc
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +layout(vertices = 3) out;
> +
> +/* xs is not a per-vertex output, so there is no conflict with the
> + * output declaration.
> + */
> +
> +patch out float xs[4];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length.tesc
> new file mode 100644
> index 0000000..ce8f9ec
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/custom-patch-out-length.tesc
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +layout(vertices = 3) out;
> +
> +patch out float xs[];
> +
> +/* xs is not a per-vertex output, so is not sized by the layout declaration! */
> +
> +int test[xs.length()];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/gl_in-length.tesc b/tests/spec/arb_tessellation_shader/compiler/gl_in-length.tesc
> new file mode 100644
> index 0000000..30e5395
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/gl_in-length.tesc
> @@ -0,0 +1,12 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +/* gl_in.length() is gl_MaxPatchVertices */
> +
> +int test[(gl_in.length() == gl_MaxPatchVertices) ? 1 : -1];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/gl_in-length.tese b/tests/spec/arb_tessellation_shader/compiler/gl_in-length.tese
> new file mode 100644
> index 0000000..30e5395
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/gl_in-length.tese
> @@ -0,0 +1,12 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +/* gl_in.length() is gl_MaxPatchVertices */
> +
> +int test[(gl_in.length() == gl_MaxPatchVertices) ? 1 : -1];
> diff --git a/tests/spec/arb_tessellation_shader/compiler/gl_out-length-before-declared.tesc b/tests/spec/arb_tessellation_shader/compiler/gl_out-length-before-declared.tesc
> new file mode 100644
> index 0000000..044eba9
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/gl_out-length-before-declared.tesc
> @@ -0,0 +1,14 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +/* Must not use gl_out.length() before it is established by the layout declaration */
> +
> +int test[gl_out.length()];
> +
> +out (vertices = 3);
I guess you meant
layout (vertices = 3) out;
?
Otherwise this looks good. At least the tests match up with your
comments. I didn't go back to check them against the spec, but they
seem to be in line with what I remember seeing there.
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> diff --git a/tests/spec/arb_tessellation_shader/compiler/gl_out-length.tesc b/tests/spec/arb_tessellation_shader/compiler/gl_out-length.tesc
> new file mode 100644
> index 0000000..bb56d24
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/compiler/gl_out-length.tesc
> @@ -0,0 +1,14 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +
> +layout(vertices = 3) out;
> +
> +/* gl_out is sized by the preceding output layout declaration */
> +
> +int test[(gl_out.length() == 3) ? 1 : -1];
> --
> 2.0.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list