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

Ian Romanick idr at freedesktop.org
Mon Mar 23 12:11:48 PDT 2015


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

These match the notEqual tests of the previous commit.  These tests
currently pass on the i965 driver, but one of my ideas for fixing the
notEqual case broken the equal case.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../execution/fs-equal-of-expression.shader_test   | 35 ++++++++++++++++++++++
 .../execution/vs-equal-of-expression.shader_test   | 27 +++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/execution/fs-equal-of-expression.shader_test
 create mode 100644 tests/spec/glsl-1.10/execution/vs-equal-of-expression.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-equal-of-expression.shader_test b/tests/spec/glsl-1.10/execution/fs-equal-of-expression.shader_test
new file mode 100644
index 0000000..c6f70af
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-equal-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(2.0, 13.0, 1.0, 0.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(equal(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-equal-of-expression.shader_test b/tests/spec/glsl-1.10/execution/vs-equal-of-expression.shader_test
new file mode 100644
index 0000000..8dc29cb
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-equal-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(equal(piglit_vertex.w * a, vec4(0)));
+    gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+    gl_FragColor = color;
+}
+
+[test]
+uniform vec4 a 38.2 0.0 1.2 0.0
+
+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