[Piglit] [PATCH] glsl-1.10: return lowering tests

Timothy Arceri timothy.arceri at collabora.com
Tue Dec 20 03:32:43 UTC 2016


---
 .../vs-nested-return-sibling-if.shader_test        | 53 ++++++++++++++++++++++
 .../vs-nested-return-sibling-if2.shader_test       | 53 ++++++++++++++++++++++
 .../vs-nested-return-sibling-loop.shader_test      | 53 ++++++++++++++++++++++
 .../vs-nested-return-sibling-loop2.shader_test     | 53 ++++++++++++++++++++++
 4 files changed, 212 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/execution/vs-nested-return-sibling-if.shader_test
 create mode 100644 tests/spec/glsl-1.10/execution/vs-nested-return-sibling-if2.shader_test
 create mode 100644 tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop.shader_test
 create mode 100644 tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop2.shader_test

diff --git a/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-if.shader_test b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-if.shader_test
new file mode 100644
index 0000000..067db42
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-if.shader_test
@@ -0,0 +1,53 @@
+# This is designed to test return lowering and check if we handle
+# things correctly when an if contains a nested return as well as a sibling
+# if without a return.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int a;
+uniform int b;
+uniform int c;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+  if (a == 1) {
+    if (b == 1) {
+       colour = vec4(0.0, 1.0, 0.0, 1.0);
+    }
+
+    if (c == 1) {
+      gl_FrontColor = vec4(1.0, 1.0, 0.0, 1.0);
+      return;
+    }
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int a 1
+uniform int b 1
+uniform int c 1
+
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 0.0 1.0
+
+uniform int a 1
+uniform int b 1
+uniform int c 0
+
+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-nested-return-sibling-if2.shader_test b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-if2.shader_test
new file mode 100644
index 0000000..b3d45f6
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-if2.shader_test
@@ -0,0 +1,53 @@
+# This is designed to test return lowering and check if we handle
+# things correctly when an if contains a nested return as well as a sibling
+# if without a return.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int a;
+uniform int b;
+uniform int c;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+  if (a == 1) {
+    if (c == 1) {
+      gl_FrontColor = vec4(1.0, 1.0, 0.0, 1.0);
+      return;
+    }
+
+    if (b == 1) {
+       colour = vec4(0.0, 1.0, 0.0, 1.0);
+    }
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int a 1
+uniform int b 1
+uniform int c 1
+
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 0.0 1.0
+
+uniform int a 1
+uniform int b 1
+uniform int c 0
+
+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-nested-return-sibling-loop.shader_test b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop.shader_test
new file mode 100644
index 0000000..8ab24af
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop.shader_test
@@ -0,0 +1,53 @@
+# This is designed to test return lowering and check if we handle
+# things correctly when an if contains a nested return as well as a sibling
+# loop without a return.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int a;
+uniform int b;
+uniform int c;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+  if (a == 1) {
+    do {
+       colour = vec4(0.0, 1.0, 0.0, 1.0);
+    } while (b == 2);
+
+    while (c == 1) {
+      gl_FrontColor = vec4(1.0, 1.0, 0.0, 1.0);
+      return;
+    }
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int a 1
+uniform int b 1
+uniform int c 1
+
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 0.0 1.0
+
+uniform int a 1
+uniform int b 1
+uniform int c 0
+
+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-nested-return-sibling-loop2.shader_test b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop2.shader_test
new file mode 100644
index 0000000..2ca786b
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-nested-return-sibling-loop2.shader_test
@@ -0,0 +1,53 @@
+# This is designed to test return lowering and check if we handle
+# things correctly when an if contains a nested return as well as a sibling
+# loop without a return.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int a;
+uniform int b;
+uniform int c;
+
+void main()
+{
+  gl_Position = gl_Vertex;
+
+  vec4 colour = vec4(1.0, 0.0, 0.0, 1.0);
+
+  if (a == 1) {
+    while (c == 1) {
+      gl_FrontColor = vec4(1.0, 1.0, 0.0, 1.0);
+      return;
+    }
+
+    do {
+       colour = vec4(0.0, 1.0, 0.0, 1.0);
+    } while (b == 2);
+  }
+
+  gl_FrontColor = colour;
+}
+
+[fragment shader]
+void main()
+{
+  gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+
+uniform int a 1
+uniform int b 1
+uniform int c 1
+
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 0.0 1.0
+
+uniform int a 1
+uniform int b 1
+uniform int c 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3



More information about the Piglit mailing list