[Piglit] [PATCH] Test bad interaction with optimizer and "array" accesses to vector elements

Ian Romanick idr at freedesktop.org
Tue Jan 29 17:19:38 PST 2013


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

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Chris Wolfe <cwolfe at chromium.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53256
---
 .../shaders/glsl-vs-channel-overwrite.shader_test  | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 tests/shaders/glsl-vs-channel-overwrite.shader_test

diff --git a/tests/shaders/glsl-vs-channel-overwrite.shader_test b/tests/shaders/glsl-vs-channel-overwrite.shader_test
new file mode 100644
index 0000000..9fb3da5
--- /dev/null
+++ b/tests/shaders/glsl-vs-channel-overwrite.shader_test
@@ -0,0 +1,42 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+attribute vec3 vertex;
+uniform mat4 mvp = mat4(1.);
+
+void main()
+{
+    vec4 tmp;
+
+    /* These two blocks of code should produce the same result, but for some
+     * reason the tmp[3] assignment in the first version gets eliminated by
+     * one of Mesa's optimization passes.
+     */
+#if 1
+    tmp[3] = 1.0;
+    tmp.xyz = vertex;
+#else
+    tmp.w = 1.0;
+    tmp.xyz = vertex;
+#endif
+    gl_Position = mvp * tmp;
+}
+
+[fragment shader]
+void main()
+{
+    gl_FragColor = vec4(0., 1., 0., 1.);
+}
+
+[vertex data]
+vertex/float/3
+ 1.0  1.0  1.0
+-1.0  1.0  1.0
+-1.0 -1.0  1.0
+ 1.0 -1.0  1.0
+
+[test]
+draw arrays GL_TRIANGLE_FAN 0 4
+relative probe rgb (.5, .5) (0.0, 1.0, 0.0)
-- 
1.7.11.7



More information about the Piglit mailing list