arb_arrays_of_arrays: add nested struct indirect test

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

Commit Message

'Timothy Arceri' via Patchwork Forward Sept. 17, 2015, 11:06 a.m.
This tests that Mesa generates the correct uniform offset for indirects
for the two scenarios where a member of AoA will have an impact.

 1) A member is an AoA
 2) A member is an AoA of structs
---
 ...struct-arrays-nonconst-nested-array.shader_test | 100 +++++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/fs-nested-struct-arrays-nonconst-nested-array.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-nested-struct-arrays-nonconst-nested-array.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-nested-struct-arrays-nonconst-nested-array.shader_test
new file mode 100644
index 0000000..260f1a9
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-nested-struct-arrays-nonconst-nested-array.shader_test
@@ -0,0 +1,100 @@ 
+# This test verifies that dynamic uniform indexing of samplers within
+# a nested struct array for the fragment shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_gpu_shader5: require
+
+struct S_inner {
+   sampler2D tex;
+   sampler2D tex2;
+};
+
+struct S {
+   S_inner si[2][2];
+   sampler2D tex[2][3];
+   sampler2D final_member[2];
+};
+
+uniform S s;
+
+uniform int n;
+uniform int select;
+
+out vec4 color;
+
+void main()
+{
+   if (select == 0)
+      color = texture(s.tex[n][n], vec2(0.75, 0.25));
+   else if (select == 1)
+      color = texture(s.si[n][n].tex, vec2(0.75, 0.25)) + texture(s.si[n][n].tex2, vec2(0.75, 0.25));
+   else if (select == 2)
+      color = texture(s.final_member[n], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s.final_member[0] 1
+uniform int s.tex[1][1] 2
+uniform int s.si[0][0].tex 3
+uniform int s.si[1][1].tex 4
+uniform int s.si[0][0].tex2 5
+uniform int s.si[1][1].tex2 6
+
+texture checkerboard 1 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 1.0, 0.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 3 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 0.25, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 4 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.25, 0.25, 0.25, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 5 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 0.75, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 6 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.75, 0.75, 0.75, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+uniform int select 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 select 1
+uniform int n 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 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)
+
+uniform int select 2
+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)