[Piglit] [PATCH] glsl-1.30: add test for default in switch not after all case statements
Jose Fonseca
jfonseca at vmware.com
Fri Apr 12 14:55:04 PDT 2013
----- Original Message -----
> From: Roland Scheidegger <sroland at vmware.com>
>
> By the looks of it "default" is not required to appear as last statement
> in a switch expression, and c rules should be followed (which is probably
> a mess to implement thanks to fallthrough).
> Seems to fail with mesa glsl compiler (at least with tgsi translation).
> ---
> .../switch/fs-default_notlast.shader_test | 33
> ++++++++++++++++++++
> 1 file changed, 33 insertions(+)
> create mode 100644
> tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test
>
> diff --git
> a/tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test
> b/tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test
> new file mode 100644
> index 0000000..385fd78
> --- /dev/null
> +++ b/tests/spec/glsl-1.30/execution/switch/fs-default_notlast.shader_test
> @@ -0,0 +1,33 @@
> +[require]
> +GLSL >= 1.30
> +
> +[vertex shader]
> +#version 130
> +void main()
> +{
> + gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#version 130
> +
> +uniform int i;
> +
> +void main()
> +{
> + vec4 tmp = vec4(0.0, 0.0, 0.0, 0.0);
> + switch (i) {
> + default:
> + tmp = vec4(0.5, 0.0, 0.5, 0.0);
> + case 0:
> + gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
> + break;
> + }
> + gl_FragColor = gl_FragColor + tmp;
> +}
> +
> +[test]
> +uniform int i 0
> +draw rect -1 -1 2 2
> +
> +probe all rgba 0 1 0 0
> --
> 1.7.9.5
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
More information about the Piglit
mailing list