diff mbox

[05/10] glsl-es-1.00: new tests for array function params and return types

Message ID 1367013224-21359-5-git-send-email-tom.gall@linaro.org
State New
Headers show

Commit Message

Tom Gall April 26, 2013, 9:53 p.m. UTC
Add to
tests/spec/glsl-es-1.00/compiler/structure-and-array-operations
a series of array tests used as function params and return types.

Signed-off-by: Tom Gall <tom.gall@linaro.org>
---
 .../array-function-parameter-implicit-size.vert    |   36 ++++++++++++++++++++
 .../array-function-parameter-unsized.vert          |   29 ++++++++++++++++
 .../array-function-return-unsized.vert             |   31 +++++++++++++++++
 .../array-function-return.vert                     |   30 ++++++++++++++++
 4 files changed, 126 insertions(+)
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-implicit-size.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-unsized.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return-unsized.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return.vert
diff mbox

Patch

diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-implicit-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-implicit-size.vert
new file mode 100644
index 0000000..f050c87
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-implicit-size.vert
@@ -0,0 +1,36 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * The GLSL ES 1.00 spec takes no position on what should
+ * happen with a undeclared array size.
+ *
+ * The GLSL ES 3.00 spec on page 136 in section 12.22 within
+ * the issues chapter says :
+ *
+ *  "float a[5];
+ * ...
+ * float b[] = a; // bi is explicity size 5 "
+ *
+ * Further, "However, any declaration that leaves the size
+ * undefined is disallowed as this would add complexity and there are
+ * no use-cases.
+ */
+
+
+float a_function(vec4[6]);
+
+void main()
+{
+  vec4 [] an_array;
+
+  an_array[0] = vec4(0);
+  an_array[1] = vec4(1);
+  an_array[2] = vec4(2);
+  an_array[3] = vec4(3);
+  an_array[4] = vec4(4);
+  an_array[5] = vec4(5);
+
+  gl_Position = vec4(a_function(an_array));
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-unsized.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-unsized.vert
new file mode 100644
index 0000000..4a536a9
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-parameter-unsized.vert
@@ -0,0 +1,29 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * The GLSL ES 1.00 spec takes no position on what should
+ * happen with a undeclared array size.
+ *
+ * The GLSL ES 3.00 spec on page 136 in section 12.22 within
+ * the issues chapter says :
+ *
+ *  "float a[5];
+ * ...
+ * float b[] = a; // bi is explicity size 5 "
+ *
+ * Further, "However, any declaration that leaves the size
+ * undefined is disallowed as this would add complexity and there are
+ * no use-cases.
+ */
+
+
+vec4 a_function(vec4 [] p);
+
+uniform vec4 [6] an_array;
+
+void main()
+{
+  gl_Position = a_function(an_array);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return-unsized.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return-unsized.vert
new file mode 100644
index 0000000..49a80e5
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return-unsized.vert
@@ -0,0 +1,31 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * Page 24, GLSL ES 1.00.17 spec:
+ *
+ * "Arrays declared as formal parameters in a function
+ * declaration must specify a size."
+ *
+ * The GLSL ES 3.00 spec on page 136 in section 12.22 within
+ * the issues chapter says :
+ *
+ *  "float a[5];
+ * ...
+ * float b[] = a; // bi is explicity size 5 "
+ *
+ * Further, "However, any declaration that leaves the size
+ * undefined is disallowed as this would add complexity and there are
+ * no use-cases.
+ */
+
+
+vec4[] a_function(vec4 [6] p);
+
+uniform vec4 [6] an_array;
+
+void main()
+{
+  gl_Position = a_function(an_array)[0];
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return.vert
new file mode 100644
index 0000000..a560685
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-function-return.vert
@@ -0,0 +1,30 @@ 
+/* [config]
+ * expect_result: pass
+ * glsles_version: 1.00
+ * [end config]
+ *
+ * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec:
+ *
+ *     "This type can be used anywhere any other type can be used, including
+ *     as the return value from a function
+ *
+ *         float[5] foo() { }
+ *
+ *     as a constructor of an array
+ *
+ *         float[5](3.4, 4.2, 5.0, 5.2, 1.1)
+ *
+ *     as an unnamed parameter
+ *
+ *         void foo(float[5])"
+ */
+
+
+vec4[2] a_function(vec4 [6]);
+
+uniform vec4 [6] an_array;
+
+void main()
+{
+  gl_Position = a_function(an_array)[0];
+}