[Piglit] [PATCH] mesa_shader_integer_mix: Add tests for mix on integers and bools.

Paul Berry stereotype441 at gmail.com
Mon Sep 9 11:28:08 PDT 2013


On 6 September 2013 17:59, Matt Turner <mattst88 at gmail.com> wrote:

> ---
>  tests/all.tests                                    |  6 ++++
>  .../execution/fs-mix-bvec4.shader_test             | 36
> +++++++++++++++++++
>  .../execution/fs-mix-ivec4.shader_test             | 36
> +++++++++++++++++++
>  .../execution/fs-mix-uvec4.shader_test             | 36
> +++++++++++++++++++
>  .../execution/vs-mix-bvec4.shader_test             | 41
> ++++++++++++++++++++++
>  .../execution/vs-mix-ivec4.shader_test             | 41
> ++++++++++++++++++++++
>  .../execution/vs-mix-uvec4.shader_test             | 41
> ++++++++++++++++++++++
>  7 files changed, 237 insertions(+)
>  create mode 100644
> tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
>  create mode 100644
> tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
>  create mode 100644
> tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
>  create mode 100644
> tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
>  create mode 100644
> tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
>  create mode 100644
> tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 22c009c..d5b457b 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2344,6 +2344,12 @@ ext_fog_coord = Group()
>  spec['EXT_fog_coord'] = ext_fog_coord
>  add_plain_test(ext_fog_coord, 'ext_fog_coord-modes')
>
> +mesa_shader_integer_mix = Group()
> +spec['MESA_shader_integer_mix'] = mesa_shader_integer_mix
> +add_shader_test_dir(spec['MESA_shader_integer_mix'],
> +                   os.path.join(testsDir, 'spec',
> 'mesa_shader_integer_mix'),
> +                   recursive=True)
> +
>  nv_texture_barrier = Group()
>  spec['NV_texture_barrier'] = nv_texture_barrier
>  add_plain_test(nv_texture_barrier, 'blending-in-shader')
> diff --git
> a/tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
> b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
> new file mode 100644
> index 0000000..febe0ad
> --- /dev/null
> +++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
> @@ -0,0 +1,36 @@
> +# From the MESA_shader_integer_mix spec:
> +#
> +#     Selects which vector each returned component comes
> +#     from. For a component of a that is false, the
> +#     corresponding component of x is returned. For a
> +#     component of a that is true, the corresponding
> +#     component of y is returned.
> +
> +[require]
> +GLSL >= 1.30
> +GL_MESA_shader_integer_mix
> +
> +[vertex shader]
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#extension GL_MESA_shader_integer_mix: enable
> +
> +uniform bvec4 a, b;
> +uniform bvec4 selector;
> +
> +void main()
> +{
> +       gl_FragColor = vec4(mix(a, b, selector));
> +}
> +
> +[test]
> +uniform ivec4 a 1 1 0 1
> +uniform ivec4 b 0 1 1 0
> +uniform ivec4 selector 1 1 0 0
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git
> a/tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
> b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
> new file mode 100644
> index 0000000..bcc76f9
> --- /dev/null
> +++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
> @@ -0,0 +1,36 @@
> +# From the MESA_shader_integer_mix spec:
> +#
> +#     Selects which vector each returned component comes
> +#     from. For a component of a that is false, the
> +#     corresponding component of x is returned. For a
> +#     component of a that is true, the corresponding
> +#     component of y is returned.
> +
> +[require]
> +GLSL >= 1.30
> +GL_MESA_shader_integer_mix
> +
> +[vertex shader]
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#extension GL_MESA_shader_integer_mix: enable
> +
> +uniform ivec4 a, b;
> +uniform bvec4 selector;
> +
> +void main()
> +{
> +       gl_FragColor = vec4(mix(a, b, selector));
> +}
> +
> +[test]
> +uniform ivec4 a 1 1 0 1
> +uniform ivec4 b 0 1 1 0
> +uniform ivec4 selector 1 1 0 0
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
>

For the ivec4 and uvec4 tests, I would feel a little more comfortable if we
used some values other than 1 and 0, just to reassure ourselves that the
implementation doesn't accidentally implement these functions using logic
that only works on bools.

With that fixed, the patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


> diff --git
> a/tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
> b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
> new file mode 100644
> index 0000000..061633c
> --- /dev/null
> +++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
> @@ -0,0 +1,36 @@
> +# From the MESA_shader_integer_mix spec:
> +#
> +#     Selects which vector each returned component comes
> +#     from. For a component of a that is false, the
> +#     corresponding component of x is returned. For a
> +#     component of a that is true, the corresponding
> +#     component of y is returned.
> +
> +[require]
> +GLSL >= 1.30
> +GL_MESA_shader_integer_mix
> +
> +[vertex shader]
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#extension GL_MESA_shader_integer_mix: enable
> +
> +uniform uvec4 a, b;
> +uniform bvec4 selector;
> +
> +void main()
> +{
> +       gl_FragColor = vec4(mix(a, b, selector));
> +}
> +
> +[test]
> +uniform uvec4 a 1 1 0 1
> +uniform uvec4 b 0 1 1 0
> +uniform ivec4 selector 1 1 0 0
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git
> a/tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
> b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
> new file mode 100644
> index 0000000..fa3de5d
> --- /dev/null
> +++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
> @@ -0,0 +1,41 @@
> +# From the MESA_shader_integer_mix spec:
> +#
> +#     Selects which vector each returned component comes
> +#     from. For a component of a that is false, the
> +#     corresponding component of x is returned. For a
> +#     component of a that is true, the corresponding
> +#     component of y is returned.
> +
> +[require]
> +GLSL >= 1.30
> +GL_MESA_shader_integer_mix
> +
> +[vertex shader]
> +#extension GL_MESA_shader_integer_mix: enable
> +
> +out vec4 color;
> +uniform bvec4 a, b;
> +uniform bvec4 selector;
> +
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +
> +       color = vec4(mix(a, b, selector));
> +}
> +
> +[fragment shader]
> +in vec4 color;
> +
> +void main()
> +{
> +       gl_FragColor = color;
> +}
> +
> +[test]
> +uniform ivec4 a 1 1 0 1
> +uniform ivec4 b 0 1 1 0
> +uniform ivec4 selector 1 1 0 0
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git
> a/tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
> b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
> new file mode 100644
> index 0000000..c99cb05
> --- /dev/null
> +++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
> @@ -0,0 +1,41 @@
> +# From the MESA_shader_integer_mix spec:
> +#
> +#     Selects which vector each returned component comes
> +#     from. For a component of a that is false, the
> +#     corresponding component of x is returned. For a
> +#     component of a that is true, the corresponding
> +#     component of y is returned.
> +
> +[require]
> +GLSL >= 1.30
> +GL_MESA_shader_integer_mix
> +
> +[vertex shader]
> +#extension GL_MESA_shader_integer_mix: enable
> +
> +out vec4 color;
> +uniform ivec4 a, b;
> +uniform bvec4 selector;
> +
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +
> +       color = vec4(mix(a, b, selector));
> +}
> +
> +[fragment shader]
> +in vec4 color;
> +
> +void main()
> +{
> +       gl_FragColor = color;
> +}
> +
> +[test]
> +uniform ivec4 a 1 1 0 1
> +uniform ivec4 b 0 1 1 0
> +uniform ivec4 selector 1 1 0 0
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git
> a/tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test
> b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test
> new file mode 100644
> index 0000000..818f8b1
> --- /dev/null
> +++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test
> @@ -0,0 +1,41 @@
> +# From the MESA_shader_integer_mix spec:
> +#
> +#     Selects which vector each returned component comes
> +#     from. For a component of a that is false, the
> +#     corresponding component of x is returned. For a
> +#     component of a that is true, the corresponding
> +#     component of y is returned.
> +
> +[require]
> +GLSL >= 1.30
> +GL_MESA_shader_integer_mix
> +
> +[vertex shader]
> +#extension GL_MESA_shader_integer_mix: enable
> +
> +out vec4 color;
> +uniform uvec4 a, b;
> +uniform bvec4 selector;
> +
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +
> +       color = vec4(mix(a, b, selector));
> +}
> +
> +[fragment shader]
> +in vec4 color;
> +
> +void main()
> +{
> +       gl_FragColor = color;
> +}
> +
> +[test]
> +uniform uvec4 a 1 1 0 1
> +uniform uvec4 b 0 1 1 0
> +uniform ivec4 selector 1 1 0 0
> +
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 1.0 0.0 1.0
> --
> 1.8.3.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130909/a757906e/attachment-0001.html>


More information about the Piglit mailing list