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

Dave Airlie airlied at gmail.com
Tue Oct 8 01:22:08 CEST 2013


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.

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]
+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
+uniform int arg1 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.5 0.0 1.0
-- 
1.8.3.1



More information about the Piglit mailing list