[Piglit] [PATCH] Test "double negative" corner case in copy propagation.

Paul Berry stereotype441 at gmail.com
Thu Sep 15 09:16:39 PDT 2011


This patch adds two tests that exercise a subtle corner case bug found
in Mesa with i965: If a value is negated, and then negated again, then
copy propagation would fail to un-do the negation.

The bug only exists on i965 vertex shaders, but I went ahead and
added the equivalent fragment shader test for completeness.
---
 .../execution/fs-double-negative.shader_test       |   31 +++++++++++++++++++
 .../execution/vs-double-negative.shader_test       |   32 ++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.10/execution/fs-double-negative.shader_test
 create mode 100644 tests/spec/glsl-1.10/execution/vs-double-negative.shader_test

diff --git a/tests/spec/glsl-1.10/execution/fs-double-negative.shader_test b/tests/spec/glsl-1.10/execution/fs-double-negative.shader_test
new file mode 100644
index 0000000..c73be7b
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/fs-double-negative.shader_test
@@ -0,0 +1,31 @@
+# [description]
+# This test exercises a corner case of copy propagation found in Mesa:
+# double negation of a value should restore the original value.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+#version 110
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 110
+
+uniform float x;
+
+void main(void)
+{
+	float y = -x;
+	float z = -y;
+	gl_FragColor = vec4(0.5 + x, 0.5 + y, 0.5 + z, 1.0);
+}
+
+[test]
+uniform float x 0.25
+draw rect -1 -1 2 2
+probe all rgba 0.75 0.25 0.75 1.0
diff --git a/tests/spec/glsl-1.10/execution/vs-double-negative.shader_test b/tests/spec/glsl-1.10/execution/vs-double-negative.shader_test
new file mode 100644
index 0000000..da99fc2
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-double-negative.shader_test
@@ -0,0 +1,32 @@
+# [description]
+# This test exercises a corner case of copy propagation found in Mesa:
+# double negation of a value should restore the original value.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+#version 110
+
+uniform float x;
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	float y = -x;
+	float z = -y;
+	gl_FrontColor = vec4(0.5 + x, 0.5 + y, 0.5 + z, 1.0);
+}
+
+[fragment shader]
+#version 110
+void main(void)
+{
+	gl_FragColor = gl_Color;
+}
+
+[test]
+uniform float x 0.25
+draw rect -1 -1 2 2
+probe all rgba 0.75 0.25 0.75 1.0
-- 
1.7.6



More information about the Piglit mailing list