From: Ian Romanick <[email protected]>

The "big-enough" test verifies that the compiler accepts an initializer
can be used to size an array after an access (to the previously
implicitly size) array has been seen when the access would have been
in-bounds in the sized array.

The "too-small" test verifies that the compiler rejects an initializer
can be used to size an array after an access (to the previously
implicitly size) array has been seen when the access would have been
out-of-bounds in the sized array.

Signed-off-by: Ian Romanick <[email protected]>
Cc: Timothy Arceri <[email protected]>
---
 .../array-resize-after-access-big-enough.vert        | 20 ++++++++++++++++++++
 .../array-resize-after-access-too-small.vert         | 20 ++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 
tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert
 create mode 100644 
tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert

diff --git 
a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert
 
b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert
new file mode 100644
index 0000000..1e21b2d
--- /dev/null
+++ 
b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert
@@ -0,0 +1,20 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.20
+ * [end config]
+ */
+#version 120
+
+float x[];
+
+void foo() { x[1] = 2.; }
+
+// The array must be at least 2 elements because of the previous
+// access to x[1].
+float x[] = float[2](1., 2.);
+
+void main()
+{
+       foo();
+       gl_Position = vec4(x[0]);
+}
diff --git 
a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert
 
b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert
new file mode 100644
index 0000000..ebee5e6
--- /dev/null
+++ 
b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert
@@ -0,0 +1,20 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.20
+ * [end config]
+ */
+#version 120
+
+float x[];
+
+void foo() { x[3] = 2.; }
+
+// The array must be at least 4 elements because of the previous
+// access to x[3].
+float x[] = float[2](1., 2.);
+
+void main()
+{
+       foo();
+       gl_Position = vec4(x[0]);
+}
-- 
1.8.1.4

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to