From: Dave Airlie <airl...@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 <airl...@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

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to