diff mbox

[V2] arb_arrays_of_arrays: add some simple ubo AoA tests

Message ID 1443338265-2950-1-git-send-email-t_arceri@yahoo.com.au
State New
Headers show

Commit Message

'Timothy Arceri' via Patchwork Forward Sept. 27, 2015, 7:17 a.m. UTC
V2: fix constant index test now that Mesa layout bug fixed,
add mix const/non-const test
---
 .../execution/ubo/fs-const.shader_test             | 41 ++++++++++++
 .../ubo/fs-mixed-const-nonconst.shader_test        | 67 +++++++++++++++++++
 .../execution/ubo/fs-nonconst.shader_test          | 76 ++++++++++++++++++++++
 3 files changed, 184 insertions(+)
 create mode 100644 tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test
 create mode 100644 tests/spec/arb_arrays_of_arrays/execution/ubo/fs-mixed-const-nonconst.shader_test
 create mode 100644 tests/spec/arb_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test
diff mbox

Patch

diff --git a/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test
new file mode 100644
index 0000000..81d48a0
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-const.shader_test
@@ -0,0 +1,41 @@ 
+# This test verifies that 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_arrays_of_arrays
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+
+uniform block {
+	vec4 color[2];
+} arr[4][2];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+	color = arr[3][0].color[1] + arr[1][1].color[0];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 3
+uniform vec4 block.color[0] 0.0 1.0 0.0 0.0
+uniform vec4 block.color[1] 1.0 0.0 0.0 0.0
+
+ubo array index 6
+uniform vec4 block.color[0] 1.0 0.0 0.0 0.0
+uniform vec4 block.color[1] 0.0 0.0 1.0 0.0
+
+draw rect -1 -1 1 1
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (0.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-mixed-const-nonconst.shader_test b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-mixed-const-nonconst.shader_test
new file mode 100644
index 0000000..a3523ca
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-mixed-const-nonconst.shader_test
@@ -0,0 +1,67 @@ 
+# 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
+GL_ARB_arrays_of_arrays
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_arrays_of_arrays: require
+
+uniform block {
+	vec4 color[2];
+} arr[3][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+	color = arr[n][1].color[m];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 1
+uniform vec4 block.color[0] 1.0 0.0 0.0 0.0
+uniform vec4 block.color[1] 0.0 1.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] 0.0 1.0 0.0 0.0
+ubo array index 5
+uniform vec4 block.color[0] 0.0 0.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 1.0 1.0 0.0
+
+uniform int n 0
+uniform int m 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
+uniform int m 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
+uniform int m 0
+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 2
+uniform int m 1
+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_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test
new file mode 100644
index 0000000..be90ee7
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/ubo/fs-nonconst.shader_test
@@ -0,0 +1,76 @@ 
+# 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
+GL_ARB_arrays_of_arrays
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_arrays_of_arrays: require
+
+uniform block {
+	vec4 color[2];
+} arr[3][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+	color = arr[n][m].color[m];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color[0] 1.0 0.0 0.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.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 0.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.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] 0.0 1.0 1.0 0.0
+ubo array index 4
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 0.0 1.0 1.0 0.0
+ubo array index 5
+uniform vec4 block.color[0] 0.0 1.0 1.0 0.0
+uniform vec4 block.color[1] 1.0 1.0 1.0 0.0
+
+uniform int n 0
+uniform int m 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 0
+uniform int m 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 1
+uniform int m 0
+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 2
+uniform int m 1
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)