From: Nicolai Hähnle <[email protected]>

Compared to the other array bounds tests, this one exercises a larger array
size.

The motivation is for Radeon, where arrays can be lowered either into the
register file or into "real" memory. The larger array in this test will be
sure to hit real memory.
---
 tests/shaders/glsl-array-bounds-13.shader_test | 33 ++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 tests/shaders/glsl-array-bounds-13.shader_test

diff --git a/tests/shaders/glsl-array-bounds-13.shader_test 
b/tests/shaders/glsl-array-bounds-13.shader_test
new file mode 100644
index 0000000..95aa550
--- /dev/null
+++ b/tests/shaders/glsl-array-bounds-13.shader_test
@@ -0,0 +1,33 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader passthrough]
+
+[fragment shader]
+/* Verify that out-of-bounds access to an array does not result in any sort of
+ * program interruption.
+ *
+ * This test case uses a larger array, to cover drivers that have different
+ * lowering paths for different array sizes.
+ *
+ * In this test case the array index will not be constant folded.
+ */
+#version 120
+
+uniform int idx;
+float array[32];
+
+void main()
+{
+   /* Ensure that there can be no constant folding due to undefined values. */
+   array[0] = 0.0;
+   array[1] = 1.0;
+   gl_FragColor = vec4(0.0, 1.0, 0.0, array[idx]);
+}
+
+[test]
+uniform int idx -2
+clear color 0.0 0.0 0.0 0.0
+clear
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
-- 
2.7.4

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

Reply via email to