[Piglit] [PATCH 6/7] tests/spec: ARB_arrays_of_arrays redeclaration and subroutine tests

Timothy Arceri t_arceri at yahoo.com.au
Mon Jan 6 15:05:18 PST 2014


Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
---
 .../compiler/redeclaration-initializer.vert        |   31 ++++++++++++++++++
 .../compiler/redeclaration-too-small.vert          |   29 +++++++++++++++++
 .../compiler/redeclaration-too-small2.vert         |   23 ++++++++++++++
 .../compiler/redeclaration.vert                    |   29 +++++++++++++++++
 .../compiler/redeclaration2.vert                   |   29 +++++++++++++++++
 .../arb_arrays_of_arrays/compiler/subroutine.vert  |   33 ++++++++++++++++++++
 6 files changed, 174 insertions(+)
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/redeclaration2.vert
 create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/subroutine.vert

diff --git a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert
new file mode 100644
index 0000000..8108cd0
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-initializer.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ *     "It is legal to declare an array without a size and then later
+ *     re-declare the same name as an array of the same type and specify a
+ *     size."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float a_function(float[3][2]);
+
+void main()
+{
+  float [][2] an_array;
+
+  an_array[0][1] = 0.0;
+  an_array[1][1] = 1.0;
+  an_array[2][0] = 2.0;
+
+  float [][2] an_array = float[][2](float[2](0.0, 1.0),
+                                    float[2](0.0, 1.0),
+                                    float[2](0.0, 1.0));
+
+  gl_Position = vec4(a_function(an_array));
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert
new file mode 100644
index 0000000..deebdb3
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small.vert
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ *     "It is legal to declare an array without a size and then later
+ *     re-declare the same name as an array of the same type and specify a
+ *     size."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float a_function(float[2][3]);
+
+void main()
+{
+  float [][3] an_array;
+
+  an_array[0][2] = 0.0;
+  an_array[1][2] = 1.0;
+  an_array[2][2] = 2.0;
+
+  float [2][3] an_array;
+
+  gl_Position = vec4(a_function(an_array));
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert
new file mode 100644
index 0000000..14a78a2
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration-too-small2.vert
@@ -0,0 +1,23 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float x[][2];
+
+void foo() { x[3][1] = 2.; }
+
+// The left most array must be at least 4 elements because of
+// the previous access to x[3][1].
+float x[][2] = float[][2](float[2](1., 2.),
+                          float[2](1., 2.));
+
+void main()
+{
+	foo();
+	gl_Position = vec4(x[0][0]);
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert
new file mode 100644
index 0000000..57bf467
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration.vert
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ *     "It is legal to declare an array without a size and then later
+ *     re-declare the same name as an array of the same type and specify a
+ *     size."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float a_function(float[3][3]);
+
+void main()
+{
+  float [][3] an_array;
+
+  an_array[0][2] = 0.0;
+  an_array[1][2] = 1.0;
+  an_array[2][2] = 2.0;
+
+  float [3][3] an_array;
+
+  gl_Position = vec4(a_function(an_array));
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/redeclaration2.vert b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration2.vert
new file mode 100644
index 0000000..b31500a
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/redeclaration2.vert
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ *     "It is legal to declare an array without a size and then later
+ *     re-declare the same name as an array of the same type and specify a
+ *     size."
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+float x[][2];
+
+void foo() { x[1][1] = 2.; }
+
+// The left most array must be at least 2 elements because
+// of the previous access to x[2][1].
+float x[][2] = float[][2](float[2](1., 2.),
+                          float[2](1., 2.));
+
+void main()
+{
+	foo();
+	gl_Position = vec4(x[0][0]);
+}
diff --git a/tests/spec/arb_arrays_of_arrays/compiler/subroutine.vert b/tests/spec/arb_arrays_of_arrays/compiler/subroutine.vert
new file mode 100644
index 0000000..d6ccf89
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/subroutine.vert
@@ -0,0 +1,33 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * [end config]
+ */
+#version 120
+#extension GL_ARB_arrays_of_arrays: enable
+
+subroutine vec4[3][2] basicSubRoutine();
+
+subroutine (basicSubRoutine) vec4[3][2] option1() {
+  vec4 a[3][2] = vec4[3][2](vec4[2](vec4(0.0), vec4(1.0)),
+                            vec4[2](vec4(0.0), vec4(1.0)),
+                            vec4[2](vec4(0.0), vec4(1.0)));
+  return a;
+}
+ 
+subroutine (basicSubRoutine) vec4[3][2] option2() {
+  vec4 a[3][2] = vec4[3][2](vec4[2](vec4(1.0), vec4(0.0)),
+                            vec4[2](vec4(1.0), vec4(0.0)),
+                            vec4[2](vec4(1.0), vec4(0.0)));
+  return a;
+}
+
+subroutine uniform basicSubRoutine subRoutineSelection;
+
+void main()
+{
+  vec4[3][2] a = subRoutineSelection();
+
+  gl_Position = a[0][0];
+}
-- 
1.7.9.5



More information about the Piglit mailing list