diff options
author | Timothy Arceri <t_arceri@yahoo.com.au> | 2015-09-17 21:06:24 +1000 |
---|---|---|
committer | Timothy Arceri <t_arceri@yahoo.com.au> | 2015-10-16 09:11:23 +1100 |
commit | 34cd099cb4f921c0c8280af3ad1c6c53a75f63a2 (patch) | |
tree | 057afb9436a4775d1b2f8412fc489e2da43ea040 | |
parent | 848084d31a0ae4cd9cbcdad33c8ed574bc49bb99 (diff) |
arb_arrays_of_arrays: add nested struct indirect test
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
-rw-r--r-- | tests/spec/arb_arrays_of_arrays/execution/sampler/fs-nested-struct-arrays-nonconst-nested-array.shader_test | 100 |
1 files changed, 100 insertions, 0 deletions
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 000000000..260f1a931 --- /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) |