summaryrefslogtreecommitdiff
path: root/tests/spec
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2014-05-16 22:11:34 +1200
committerChris Forbes <chrisf@ijw.co.nz>2014-07-20 13:38:00 +1200
commit068b81ab88f4b68dec0d2b25dd1fa2ebfa766876 (patch)
tree18a58b1f3473a436701e650e19062c17cf8e1164 /tests/spec
parent3fcb68759ade0b586881b854cae8fba75e518bc9 (diff)
arb_gpu_shader5: Add initial tests for dynamically uniform UBO indexing
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'tests/spec')
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-const.shader_test63
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-nonconst.shader_test68
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-simple.shader_test58
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-const.shader_test81
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-nonconst.shader_test86
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-simple.shader_test76
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-const.shader_test74
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-nonconst.shader_test79
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-mixed-with-const-access.shader_test75
-rw-r--r--tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-simple.shader_test69
10 files changed, 729 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-const.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-const.shader_test
new file mode 100644
index 000000000..fcb474128
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-const.shader_test
@@ -0,0 +1,63 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the fragment shader behaves correctly, when the block member is a
+# const-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color[2];
+} arr[4];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+ color = arr[n].color[1];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 1.0 1.0 1.0
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-nonconst.shader_test
new file mode 100644
index 000000000..21790b3e4
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-nonconst.shader_test
@@ -0,0 +1,68 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the fragment shader behaves correctly, when the block member is a
+# nonconst-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color[2];
+} arr[4];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+ color = arr[n].color[m];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color[0] 0.0 1.0 0.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 2
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color[0] 1.0 1.0 1.0 1.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+
+uniform int n 0
+uniform int m 1
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+uniform int m 0
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+uniform int m 1
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+uniform int m 0
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-simple.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-simple.shader_test
new file mode 100644
index 000000000..008adf2c2
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-simple.shader_test
@@ -0,0 +1,58 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the fragment shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color;
+} arr[4];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+ color = arr[n].color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color 1.0 1.0 1.0 1.0
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-const.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-const.shader_test
new file mode 100644
index 000000000..a373ba508
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-const.shader_test
@@ -0,0 +1,81 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the geometry shader behaves correctly, when the block member is a
+# const-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[geometry shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color[2];
+} arr[4];
+
+uniform int n;
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+out vec4 color;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ color = arr[n].color[1];
+ EmitVertex();
+ }
+ EndPrimitive();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 1.0 1.0 1.0
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-nonconst.shader_test
new file mode 100644
index 000000000..e9d322ae0
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-nonconst.shader_test
@@ -0,0 +1,86 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the geometry shader behaves correctly, when the block member is a
+# nonconst-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[geometry shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color[2];
+} arr[4];
+
+uniform int n;
+uniform int m;
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+out vec4 color;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ color = arr[n].color[m];
+ EmitVertex();
+ }
+ EndPrimitive();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color[0] 0.0 1.0 0.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 2
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color[0] 1.0 1.0 1.0 1.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+
+uniform int n 0
+uniform int m 1
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+uniform int m 0
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+uniform int m 1
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+uniform int m 0
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-simple.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-simple.shader_test
new file mode 100644
index 000000000..f30417a85
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-simple.shader_test
@@ -0,0 +1,76 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the geometry shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[geometry shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color;
+} arr[4];
+
+uniform int n;
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+out vec4 color;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ color = arr[n].color;
+ EmitVertex();
+ }
+ EndPrimitive();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color 1.0 1.0 1.0 1.0
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-const.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-const.shader_test
new file mode 100644
index 000000000..5bfedd152
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-const.shader_test
@@ -0,0 +1,74 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the vertex shader behaves correctly, when the block member is a
+# const-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color[2];
+} arr[4];
+
+uniform int n;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ color = arr[n].color[1];
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 1.0 1.0 1.0
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-nonconst.shader_test
new file mode 100644
index 000000000..6bbdd92d0
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-nonconst.shader_test
@@ -0,0 +1,79 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the vertex shader behaves correctly, when the block member is a
+# nonconst-indexed array.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color[2];
+} arr[4];
+
+uniform int n;
+uniform int m;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ color = arr[n].color[m];
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color[0] 0.0 1.0 0.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 2
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color[0] 1.0 1.0 1.0 1.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+
+uniform int n 0
+uniform int m 1
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+uniform int m 0
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+uniform int m 1
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+uniform int m 0
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-mixed-with-const-access.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-mixed-with-const-access.shader_test
new file mode 100644
index 000000000..ca349d8cf
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-mixed-with-const-access.shader_test
@@ -0,0 +1,75 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the vertex shader behaves correctly, when mixed with a constant-
+# indexed access earlier in the shader.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color;
+} arr[4];
+
+uniform int n;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ if (arr[1].color != vec4(0.0, 1.0, 0.0, 0.0))
+ color = vec4(1.0, 0.0, 1.0, 0.0);
+ else
+ color = arr[n].color;
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color 1.0 1.0 1.0 1.0
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
+
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-simple.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-simple.shader_test
new file mode 100644
index 000000000..c64aa46c0
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-simple.shader_test
@@ -0,0 +1,69 @@
+# This test verifies that dynamically uniform indexing of UBO arrays
+# in the vertex shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color;
+} arr[4];
+
+uniform int n;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ color = arr[n].color;
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color 1.0 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color 0.0 1.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color 0.0 0.0 1.0 0.0
+ubo array index 3
+uniform vec4 block.color 1.0 1.0 1.0 1.0
+
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 2
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 3
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)