new file mode 100644
@@ -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)