[Piglit] [PATCH] shaders: add test for bool casting of large integers.

Ian Romanick idr at freedesktop.org
Tue Oct 8 18:30:12 CEST 2013


On 10/07/2013 04:22 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> I noticed the TGSI convertor just does INEG then AND 0x3f800000, which works
> for small values, but fails for larger ints.
> 
> This seems to fail on nvidia (4.3.0 NVIDIA 325.15) and on ironlake with mesa
> 9.2.

If you repost the patch, could you CC Wen Su <wsu at nvidia.com>?

Also, is there a bugzilla for this issue?

> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  tests/shaders/glsl-fs-i2b-large-int.shader_test | 32 +++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>  create mode 100644 tests/shaders/glsl-fs-i2b-large-int.shader_test
> 
> diff --git a/tests/shaders/glsl-fs-i2b-large-int.shader_test b/tests/shaders/glsl-fs-i2b-large-int.shader_test
> new file mode 100644
> index 0000000..96369da
> --- /dev/null
> +++ b/tests/shaders/glsl-fs-i2b-large-int.shader_test
> @@ -0,0 +1,32 @@
> +# validate a bug in the TGSI conversion where it just did AND (float)1.0
> +# but for large integers this would fail, we should clamp to 1 first
> +# looks like nobody passes this from my first pass testing.
> +
> +[require]
> +GLSL >= 1.30
> +
> +[vertex shader]

Use [vertex shader passthrough].

> +void main()
> +{
> +	gl_Position = gl_Vertex;
> +}
> +
> +[fragment shader]
> +#version 130
> +
> +uniform int arg0;
> +uniform int arg1;
> +
> +void main()
> +{
> +	bool t = bool(arg0);
> +	bool f = bool(arg1);
> +
> +	gl_FragColor = vec4(1.0 - float(t), float(t) / 2.0, float(f), 1.0 - float(f));
> +}
> +
> +[test]
> +uniform int arg0 0x0ff00001

This value seems magic.  Why did you pick that?  Are there other large
values that should also be tested.

> +uniform int arg1 0
> +draw rect -1 -1 2 2
> +probe all rgba 0.0 0.5 0.0 1.0
> 



More information about the Piglit mailing list