[Piglit] [PATCH 3/3] arb_gpu_shader5: Add initial tests for dynamically uniform UBO indexing
Chris Forbes
chrisf at ijw.co.nz
Sat Jul 19 17:22:10 PDT 2014
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
.../ubo_array_indexing/fs-array-const.shader_test | 63 ++++++++++++++++
.../fs-array-nonconst.shader_test | 68 +++++++++++++++++
.../ubo_array_indexing/fs-simple.shader_test | 58 +++++++++++++++
.../ubo_array_indexing/gs-array-const.shader_test | 81 ++++++++++++++++++++
.../gs-array-nonconst.shader_test | 86 ++++++++++++++++++++++
.../ubo_array_indexing/gs-simple.shader_test | 76 +++++++++++++++++++
.../ubo_array_indexing/vs-array-const.shader_test | 74 +++++++++++++++++++
.../vs-array-nonconst.shader_test | 79 ++++++++++++++++++++
.../vs-mixed-with-const-access.shader_test | 75 +++++++++++++++++++
.../ubo_array_indexing/vs-simple.shader_test | 69 +++++++++++++++++
10 files changed, 729 insertions(+)
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-const.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-array-nonconst.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-simple.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-const.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-array-nonconst.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-simple.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-const.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-array-nonconst.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-mixed-with-const-access.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-simple.shader_test
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 0000000..fcb4741
--- /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 0000000..21790b3
--- /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 0000000..008adf2
--- /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 0000000..a373ba5
--- /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 0000000..e9d322a
--- /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 0000000..f30417a
--- /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 0000000..5bfedd1
--- /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 0000000..6bbdd92
--- /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 0000000..ca349d8
--- /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 0000000..c64aa46
--- /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)
--
2.0.1
More information about the Piglit
mailing list