[Piglit] [PATCH] Test inlining of notEqual() triggering constant folding.

Paul Berry stereotype441 at gmail.com
Wed Oct 26 18:38:14 PDT 2011


These tests exercise a bug found in Mesa: if function inlining caused
an execution of notEqual() to be constant-folded, an assertion failure
would occur.
---
 .../execution/fs-inline-notequal.shader_test       |   25 +++++++++++++++++++
 .../execution/vs-inline-notequal.shader_test       |   26 ++++++++++++++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.10/execution/fs-inline-notequal.shader_test
 create mode 100644 tests/spec/glsl-1.10/execution/vs-inline-notequal.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-inline-notequal.shader_test b/tests/spec/glsl-1.10/execution/fs-inline-notequal.shader_test
new file mode 100644
index 0000000..6def318
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-inline-notequal.shader_test
@@ -0,0 +1,25 @@
+# This test exercises a bug found in Mesa: if function inlining caused
+# an execution of notEqual() to be constant-folded, an assertion
+# failure would occur.
+
+[vertex shader]
+void main()
+{
+  gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+bvec4 foo(vec4 x, vec4 y)
+{
+  return notEqual(x, y);
+}
+
+void main()
+{
+  gl_FragColor = vec4(foo(vec4(0.0, 0.0, 1.0, 1.0),
+                          vec4(0.0, 1.0, 1.0, 0.0)));
+}
+
+[test]
+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-inline-notequal.shader_test b/tests/spec/glsl-1.10/execution/vs-inline-notequal.shader_test
new file mode 100644
index 0000000..a2a0923
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-inline-notequal.shader_test
@@ -0,0 +1,26 @@
+# This test exercises a bug found in Mesa: if function inlining caused
+# an execution of notEqual() to be constant-folded, an assertion
+# failure would occur.
+
+[vertex shader]
+bvec4 foo(vec4 x, vec4 y)
+{
+  return notEqual(x, y);
+}
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_FrontColor = vec4(foo(vec4(0.0, 0.0, 1.0, 1.0),
+                           vec4(0.0, 1.0, 1.0, 0.0)));
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.7.6.4



More information about the Piglit mailing list