[Piglit] [PATCH v2] glsl-1.10 Adds tests on how void functions are handled

Renaud Gaubert renaud at lse.epita.fr
Sat Jul 11 13:59:23 PDT 2015


Mesa currently doesn't handle void functions and segfaults on
almost all of the test cases.

This also references the bug 85252 Segfault in compiler while
processing ternary operator with void arguments:

This will be fixed with the following commit sent to mesa-dev:
[PATCH] glsl: fix Bug 85252 - Segfault in compiler while processing
ternary operator with void arguments

Signed-off-by: Renaud Gaubert <renaud at lse.epita.fr>
Reviewed-By: Gabriel Laskar <gabriel at lse.epita.fr>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85252

---
As discussed in [PATCH] glsl 1.10: Fix broken ternary void test
I've merged my 2nd patch in this one as it wasn't pushed yet.

Chris Forbes: Yes I need someone to push it for me

 .../glsl-1.10/compiler/void/void-array_subscript.vert    | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-assignment.vert  | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-equal.vert       | 16 ++++++++++++++++
 .../glsl-1.10/compiler/void/void-field_selection.vert    | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-logical_and.vert | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-logical_or.vert  | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-logical_xor.vert | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-lt.vert          | 16 ++++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-plus.vert        | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-plus_assign.vert | 16 ++++++++++++++++
 .../glsl-1.10/compiler/void/void-postfix_increment.vert  | 15 +++++++++++++++
 .../glsl-1.10/compiler/void/void-prefix_increment.vert   | 15 +++++++++++++++
 tests/spec/glsl-1.10/compiler/void/void-unary_plus.vert  | 15 +++++++++++++++
 tests/spec/glsl-1.10/execution/void-ternary.shader_test  |  3 ++-
 tests/spec/glsl-1.30/compiler/void/void-and_assign.vert  | 16 ++++++++++++++++
 tests/spec/glsl-1.30/compiler/void/void-bitwise_and.vert | 15 +++++++++++++++
 tests/spec/glsl-1.30/compiler/void/void-lshift.vert      | 15 +++++++++++++++
 tests/spec/glsl-1.30/compiler/void/void-mod.vert         | 15 +++++++++++++++
 tests/spec/glsl-1.30/compiler/void/void-mod_assign.vert  | 16 ++++++++++++++++
 tests/spec/glsl-1.30/compiler/void/void-rshift.vert      | 15 +++++++++++++++
 .../spec/glsl-1.30/compiler/void/void-shift_assign.vert  | 16 ++++++++++++++++
 tests/spec/glsl-1.30/compiler/void/void-unary_not.vert   | 15 +++++++++++++++
 tests/spec/glsl-1.30/compiler/void/void-unary_tilde.vert | 15 +++++++++++++++
 23 files changed, 338 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-array_subscript.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-assignment.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-equal.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-field_selection.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-logical_and.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-logical_or.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-logical_xor.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-lt.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-plus.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-plus_assign.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-postfix_increment.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-prefix_increment.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/void/void-unary_plus.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-and_assign.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-bitwise_and.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-lshift.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-mod.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-mod_assign.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-rshift.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-shift_assign.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-unary_not.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/void/void-unary_tilde.vert

diff --git a/tests/spec/glsl-1.10/compiler/void/void-array_subscript.vert b/tests/spec/glsl-1.10/compiler/void/void-array_subscript.vert
new file mode 100644
index 0000000..0cf3de6
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-array_subscript.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    f()[0];
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-assignment.vert b/tests/spec/glsl-1.10/compiler/void/void-assignment.vert
new file mode 100644
index 0000000..da889bd
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-assignment.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    float y = f();
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-equal.vert b/tests/spec/glsl-1.10/compiler/void/void-equal.vert
new file mode 100644
index 0000000..a107600
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-equal.vert
@@ -0,0 +1,16 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    if (f() == f())
+        f();
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-field_selection.vert b/tests/spec/glsl-1.10/compiler/void/void-field_selection.vert
new file mode 100644
index 0000000..2165d7c
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-field_selection.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    f().test;
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-logical_and.vert b/tests/spec/glsl-1.10/compiler/void/void-logical_and.vert
new file mode 100644
index 0000000..fe7bfb1
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-logical_and.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    f() && f();
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-logical_or.vert b/tests/spec/glsl-1.10/compiler/void/void-logical_or.vert
new file mode 100644
index 0000000..260e58c
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-logical_or.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    f() || 1;
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-logical_xor.vert b/tests/spec/glsl-1.10/compiler/void/void-logical_xor.vert
new file mode 100644
index 0000000..1935909
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-logical_xor.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    f() ^^ 1;
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-lt.vert b/tests/spec/glsl-1.10/compiler/void/void-lt.vert
new file mode 100644
index 0000000..aca4c72
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-lt.vert
@@ -0,0 +1,16 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    if (f() < f())
+        f();
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-plus.vert b/tests/spec/glsl-1.10/compiler/void/void-plus.vert
new file mode 100644
index 0000000..a5c6466
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-plus.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    f() + f();
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-plus_assign.vert b/tests/spec/glsl-1.10/compiler/void/void-plus_assign.vert
new file mode 100644
index 0000000..4e59b27
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-plus_assign.vert
@@ -0,0 +1,16 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    float y = 1.0;
+    y *= f();
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-postfix_increment.vert b/tests/spec/glsl-1.10/compiler/void/void-postfix_increment.vert
new file mode 100644
index 0000000..153d534
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-postfix_increment.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    f()++;
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-prefix_increment.vert b/tests/spec/glsl-1.10/compiler/void/void-prefix_increment.vert
new file mode 100644
index 0000000..6aa9332
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-prefix_increment.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    ++f();
+}
diff --git a/tests/spec/glsl-1.10/compiler/void/void-unary_plus.vert b/tests/spec/glsl-1.10/compiler/void/void-unary_plus.vert
new file mode 100644
index 0000000..7bea0b1
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/void/void-unary_plus.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.10
+ * [end config]
+ */
+
+#version 110
+
+void f(void)
+{}
+
+void main()
+{
+    +f();
+}
diff --git a/tests/spec/glsl-1.10/execution/void-ternary.shader_test b/tests/spec/glsl-1.10/execution/void-ternary.shader_test
index 157090f..1b0f082 100644
--- a/tests/spec/glsl-1.10/execution/void-ternary.shader_test
+++ b/tests/spec/glsl-1.10/execution/void-ternary.shader_test
@@ -18,6 +18,7 @@ void bad(void)
 
 void main()
 {
+    gl_Position = gl_Vertex;
     b ? good() : bad();
 }
 
@@ -45,4 +46,4 @@ void main()
 uniform int b 1
 
 draw rect -1 -1 2 2
-probe all rgba 0.0 1.0 0.0 0.0
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/compiler/void/void-and_assign.vert b/tests/spec/glsl-1.30/compiler/void/void-and_assign.vert
new file mode 100644
index 0000000..027ae1d
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-and_assign.vert
@@ -0,0 +1,16 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    int y = 1;
+    y &= f();
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-bitwise_and.vert b/tests/spec/glsl-1.30/compiler/void/void-bitwise_and.vert
new file mode 100644
index 0000000..6bd3635
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-bitwise_and.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    f() & 1;
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-lshift.vert b/tests/spec/glsl-1.30/compiler/void/void-lshift.vert
new file mode 100644
index 0000000..f50ac1f
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-lshift.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    f() << f();
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-mod.vert b/tests/spec/glsl-1.30/compiler/void/void-mod.vert
new file mode 100644
index 0000000..6e26a71
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-mod.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    f() % f();
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-mod_assign.vert b/tests/spec/glsl-1.30/compiler/void/void-mod_assign.vert
new file mode 100644
index 0000000..df7618a
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-mod_assign.vert
@@ -0,0 +1,16 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    int y = 1;
+    y %= f();
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-rshift.vert b/tests/spec/glsl-1.30/compiler/void/void-rshift.vert
new file mode 100644
index 0000000..8410cb5
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-rshift.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    f() >> f();
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-shift_assign.vert b/tests/spec/glsl-1.30/compiler/void/void-shift_assign.vert
new file mode 100644
index 0000000..c44fd51
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-shift_assign.vert
@@ -0,0 +1,16 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    int y = 1;
+    y <<= f();
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-unary_not.vert b/tests/spec/glsl-1.30/compiler/void/void-unary_not.vert
new file mode 100644
index 0000000..45a8ebb
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-unary_not.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    !f();
+}
diff --git a/tests/spec/glsl-1.30/compiler/void/void-unary_tilde.vert b/tests/spec/glsl-1.30/compiler/void/void-unary_tilde.vert
new file mode 100644
index 0000000..05f4e24
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/void/void-unary_tilde.vert
@@ -0,0 +1,15 @@
+/*[config]
+ *   expect_result: fail
+ *   glsl_version: 1.30
+ * [end config]
+ */
+
+#version 130
+
+void f(void)
+{}
+
+void main()
+{
+    ~f();
+}
-- 
2.4.5



More information about the Piglit mailing list