[Piglit] [PATCH] tests/spec/glsl-1.30: add tests for integer sign() function

Ilia Mirkin imirkin at alum.mit.edu
Fri May 23 10:23:17 PDT 2014


What's wrong with

generated_tests/spec/glsl-1.30/execution/built-in-functions/fs-sign-ivec4.shader_test

[fragment shader]
uniform ivec4 arg0;
uniform ivec4 expected;

void main()
{
  ivec4 result = sign(arg0);
  gl_FragColor = result == expected ? vec4(0.0, 1.0, 0.0, 1.0) :
vec4(1.0, 0.0, 0.0, 1.0);
}


On Fri, May 23, 2014 at 1:18 PM, Brian Paul <brianp at vmware.com> wrote:
> ---
>  .../glsl-1.30/execution/fs-sign-int4.shader_test   |   24 +++++++++++++++++
>  .../glsl-1.30/execution/vs-sign-int4.shader_test   |   27 ++++++++++++++++++++
>  2 files changed, 51 insertions(+)
>  create mode 100644 tests/spec/glsl-1.30/execution/fs-sign-int4.shader_test
>  create mode 100644 tests/spec/glsl-1.30/execution/vs-sign-int4.shader_test
>
> diff --git a/tests/spec/glsl-1.30/execution/fs-sign-int4.shader_test b/tests/spec/glsl-1.30/execution/fs-sign-int4.shader_test
> new file mode 100644
> index 0000000..423d098
> --- /dev/null
> +++ b/tests/spec/glsl-1.30/execution/fs-sign-int4.shader_test
> @@ -0,0 +1,24 @@
> +[require]
> +GLSL >= 1.30
> +
> +[vertex shader]
> +#version 130
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#version 130
> +uniform ivec4 arg0;
> +void main()
> +{
> +       ivec4 r = sign(arg0);
> +       // convert -1, 0, 1 to 0.0, 0.5, 1.0
> +       gl_FragColor = vec4(r) * 0.5 + 0.5;
> +}
> +
> +[test]
> +uniform ivec4 arg0 -5 5 0 3
> +draw rect -1 -1 2 2
> +probe rgb 1 1  0 1 0.5 0
> diff --git a/tests/spec/glsl-1.30/execution/vs-sign-int4.shader_test b/tests/spec/glsl-1.30/execution/vs-sign-int4.shader_test
> new file mode 100644
> index 0000000..4fe7702
> --- /dev/null
> +++ b/tests/spec/glsl-1.30/execution/vs-sign-int4.shader_test
> @@ -0,0 +1,27 @@
> +[require]
> +GLSL >= 1.30
> +
> +[vertex shader]
> +#version 130
> +uniform ivec4 arg0;
> +out vec4 color;
> +void main()
> +{
> +       ivec4 r = sign(arg0);
> +       // convert -1, 0, 1 to 0.0, 0.5, 1.0
> +       color = vec4(r) * 0.5 + 0.5;
> +       gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#version 130
> +in vec4 color;
> +void main()
> +{
> +       gl_FragColor = color;
> +}
> +
> +[test]
> +uniform ivec4 arg0 0 55 -13 2
> +draw rect -1 -1 2 2
> +probe rgb 1 1  0.5 1.0 0.0 1.0
> --
> 1.7.10.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list