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

Timothy Arceri t_arceri at yahoo.com.au
Tue Jan 7 00:34:37 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  | 37 ++++++++++++++++++++++
 6 files changed, 178 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..4d5bba0
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/compiler/subroutine.vert
@@ -0,0 +1,37 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.50
+ * require_extensions: GL_ARB_arrays_of_arrays
+ * require_extensions: GL_ARB_shader_subroutine
+ * require_extensions: GL_ARB_gpu_shader5
+ * [end config]
+ */
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_shader_subroutine: enable
+#extension GL_ARB_gpu_shader5: 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.8.3.1



More information about the Piglit mailing list