diff mbox

[02/10] glsl-es-1.00: array tests using a variety of indexes

Message ID 1367013224-21359-2-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 constant index array tests including valid, negative
and outside of the range.

Signed-off-by: Tom Gall <tom.gall@linaro.org>
---
 .../array-constant-index-implicit-size.vert        |   29 ++++++++++++++++++++
 .../array-constant-index-negative.vert             |   18 ++++++++++++
 .../array-constant-index-too-large.vert            |   18 ++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-implicit-size.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-negative.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-too-large.vert
diff mbox

Patch

diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-implicit-size.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-implicit-size.vert
new file mode 100644
index 0000000..d46fdc7
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-implicit-size.vert
@@ -0,0 +1,29 @@ 
+/* [config]
+ * expect_result: pass
+ * glsles_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."
+ */
+
+
+/* Assume the array is sized in a different compilation unit.
+ */
+vec4 [] an_array;
+
+void main()
+{
+  gl_Position = an_array[2];
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-negative.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-negative.vert
new file mode 100644
index 0000000..2384705
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-negative.vert
@@ -0,0 +1,18 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From page 24 of the GLSL ES 1.00.17 spec:
+ *
+ *     "It is also illegal to index an array with a negative constant
+ *     expression."
+ */
+
+
+uniform vec4 [6] an_array;
+
+void main()
+{
+  gl_Position = an_array[-1];
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-too-large.vert b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-too-large.vert
new file mode 100644
index 0000000..f3838ea
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/structure-and-array-operations/array-constant-index-too-large.vert
@@ -0,0 +1,18 @@ 
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.00
+ * [end config]
+ *
+ * From Page 24 of the GLSL ES 1.00.17 spec:
+ *
+ * "It is illegal to index an array with an integral constant expression
+ *  greater than or equal to it's declared size."
+ */
+
+
+uniform vec4 [6] an_array;
+
+void main()
+{
+  gl_Position = an_array[6];
+}