[Piglit] [PATCH 4/4] glsl-1.10: Test bool-to-float-cast of notEqual of an expression

Ian Romanick idr at freedesktop.org
Mon Mar 23 12:02:07 PDT 2015


From: Ian Romanick <ian.d.romanick at intel.com>

The fragment shader test reproduces a recently added bug in the i965
driver on GEN4 and GEN5 platforms.  The optimization tries to be clever
when comparison is with a constant value of zero.  However, the
generated comparison was inverted, so everything went wrong.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89722
---
 .../fs-notEqual-of-expression.shader_test          | 35 ++++++++++++++++++++++
 .../vs-notEqual-of-expression.shader_test          | 27 +++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/execution/fs-notEqual-of-expression.shader_test
 create mode 100644 tests/spec/glsl-1.10/execution/vs-notEqual-of-expression.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-notEqual-of-expression.shader_test b/tests/spec/glsl-1.10/execution/fs-notEqual-of-expression.shader_test
new file mode 100644
index 0000000..0211fc6
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-notEqual-of-expression.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+varying vec4 c;
+attribute vec4 piglit_vertex;
+
+void main()
+{
+    c = vec4(38.2, 2.0, 0.0, 1.0);
+    gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+uniform vec4 a;
+uniform float b;
+
+varying vec4 c;
+
+void main()
+{
+    /* This tickles a bug in the i965 driver on GEN4 and GEN5 platforms.  An
+     * optimization tries to be clever doing a float cast of comparison with a
+     * constant value of zero.  However, the generated comparison was
+     * inverted, so everything went wrong.
+     */
+    gl_FragColor = vec4(notEqual(a * c, vec4(b, 13, 0, 0)));
+}
+
+[test]
+uniform vec4 a 1.0 1.0 1.0 1.0
+uniform float b 38.2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.10/execution/vs-notEqual-of-expression.shader_test b/tests/spec/glsl-1.10/execution/vs-notEqual-of-expression.shader_test
new file mode 100644
index 0000000..1c77c3c
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-notEqual-of-expression.shader_test
@@ -0,0 +1,27 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform vec4 a;
+varying vec4 color;
+attribute vec4 piglit_vertex;
+
+void main()
+{
+    color = vec4(notEqual(piglit_vertex.w * a, vec4(0)));
+    gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+    gl_FragColor = color;
+}
+
+[test]
+uniform vec4 a 0.0 38.2 0.0 1.2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.1.0



More information about the Piglit mailing list