[Piglit] [PATCH] Test implicit type conversion of out parameters.
Ian Romanick
idr at freedesktop.org
Tue Aug 2 18:42:30 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 08/02/2011 05:34 PM, Paul Berry wrote:
> This patch adds four tests of the proper behavior of function out
> parameters when used in a context that requires implicit type
> conversion.
Do all of these pass on other implementations?
> ---
> .../spec/glsl-1.20/compiler/qualifiers/out-03.vert | 17 ++++++++++
> .../execution/qualifiers/vs-out-01.shader_test | 27 ++++++++++++++++
> .../execution/qualifiers/vs-out-02.shader_test | 28 +++++++++++++++++
> .../execution/qualifiers/vs-out-03.shader_test | 32 ++++++++++++++++++++
I think it would be better for these to have long, descriptive names.
How about:
vs-out-int-to-float
vs-out-int-to-float-return
vs-out-int-int-float-to-float-float-float-return
We don't have any out-parameter tests, and I feel like we should have a
ton. Giving them descriptive names helps ensure that similar tests get
grouped together. With numbers, we might add vs-out-57 that should be
grouped next to vs-out-05.
Even though I've created a lot of them, I find the foo-01 tests to be
really unsatisfactory in piglit logs, especially when one of them fails.
With the non-constant array tests (which I still need to push), it was
really helpful, for example, to see that all of names with some certain
pattern (e.g., vs-*-col-wr) failed. It helped focus debugging efforts.
> 4 files changed, 104 insertions(+), 0 deletions(-)
> create mode 100644 tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert
> create mode 100644 tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test
> create mode 100644 tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test
> create mode 100644 tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test
>
> diff --git a/tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert b/tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert
> new file mode 100644
> index 0000000..135333b
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/compiler/qualifiers/out-03.vert
> @@ -0,0 +1,17 @@
> +/*
> + * [config]
> + * glsl_version: 1.20
> + * expect_result: pass
> + * [end_config]
> + */
> +
> +#version 120
> +
> +void f(out int x);
> +
> +void
> +main() {
> + float x;
> + f(x);
> + gl_Position = gl_Vertex;
> +}
> diff --git a/tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test
> new file mode 100644
> index 0000000..43f2721
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-01.shader_test
> @@ -0,0 +1,27 @@
> +[require]
> +GLSL >= 1.20
> +
> +[vertex shader]
> +#version 120
> +void f(out int x)
> +{
> + x = 4;
> +}
> +
> +void main()
> +{
> + gl_Position = gl_Vertex;
> + float value;
> + f(value);
> + gl_FrontColor = vec4(1.0/value);
> +}
> +
> +[fragment shader]
> +void main()
> +{
> + gl_FragColor = gl_Color;
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.25 0.25 0.25 0.25
> diff --git a/tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test
> new file mode 100644
> index 0000000..3d3da7c
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-02.shader_test
> @@ -0,0 +1,28 @@
> +[require]
> +GLSL >= 1.20
> +
> +[vertex shader]
> +#version 120
> +float f(out int x)
> +{
> + x = 4;
> + return 0.5;
> +}
> +
> +void main()
> +{
> + gl_Position = gl_Vertex;
> + float value1;
> + float value2 = f(value1);
> + gl_FrontColor = vec4(1.0/value1, value2, 0.0, 0.0);
> +}
> +
> +[fragment shader]
> +void main()
> +{
> + gl_FragColor = gl_Color;
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.25 0.5 0.0 0.0
> diff --git a/tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test
> new file mode 100644
> index 0000000..bc188e1
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/execution/qualifiers/vs-out-03.shader_test
> @@ -0,0 +1,32 @@
> +[require]
> +GLSL >= 1.20
> +
> +[vertex shader]
> +#version 120
> +float f(out int x, out int y, out float z)
> +{
> + x = 4;
> + y = 5;
> + z = 0.75;
> + return 0.5;
> +}
> +
> +void main()
> +{
> + gl_Position = gl_Vertex;
> + float value1;
> + float value2;
> + float value3;
> + float value4 = f(value1, value2, value3);
> + gl_FrontColor = vec4(1.0/value1, 1.0/value2, value3, value4);
> +}
> +
> +[fragment shader]
> +void main()
> +{
> + gl_FragColor = gl_Color;
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0.25 0.2 0.75 0.5
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk44p4YACgkQX1gOwKyEAw8WnACfUGKqsKMYdVXuv36TcG1ViGrN
e7EAn3kW/5A1xH8yTRXmaB34ZCjVVJPd
=u/ld
-----END PGP SIGNATURE-----
More information about the Piglit
mailing list