[Piglit] RFC [PATCH] shader: Test to check conditional component access in loops

Gert Wollny gw.fossdev at gmail.com
Thu Aug 3 08:19:41 UTC 2017


Hello all,

this is my first message to the list. About the patch below:

Commit message:
"This test verifies whether the optimizer, and here specifically
the register merge step keeps the according register for the whole
loop alife."

I  created the test proposing a new register merge algorithm. I'm not
sure though, whether the location for the test is correct in the piglit
file hierarchy.

many thanks for any commens,
Gert

---
 .../glsl-partial-write-in-if-in-loop.shader_test   | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 tests/shaders/glsl-partial-write-in-if-in-loop.shader_test

diff --git a/tests/shaders/glsl-partial-write-in-if-in-loop.shader_test b/tests/shaders/glsl-partial-write-in-if-in-loop.shader_test
new file mode 100644
index 000000000..25e27c45d
--- /dev/null
+++ b/tests/shaders/glsl-partial-write-in-if-in-loop.shader_test
@@ -0,0 +1,38 @@
+# test that a temporary that is written partially in a condition
+# within a loop is properly kept alife for the full loop
+[require]
+GLSL >= 1.10
+
+[fragment shader]
+uniform int n;
+uniform float m;
+
+void main()
+{
+    vec4 u = vec4(0.1, 0.2, 0.1, 0.1);
+    vec4 v;
+    vec4 k;
+
+    int a = 1;
+
+    do {
+        k.x = float(a) * 0.1;
+        k.y = m;
+        if (a == 1) {
+            k.zw = u.zw;
+        }
+	a= a+1;
+	float b = 2.0 * k.y;
+	v = vec4(k.x, b, 2.0 * k.zw);
+        u.z = 0.0; 
+    } while (a <= n);
+
+    gl_FragColor = v;
+}
+
+[test]
+uniform int n 2
+uniform float m 0.5
+
+draw rect -1 -1 2 2
+probe all rgba  0.2 1.0 0.2 0.2
-- 
2.13.0



More information about the Piglit mailing list