diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test
new file mode 100644
index 0000000..2972fa3
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions.shader_test
@@ -0,0 +1,32 @@
+[require]
+GLSL >= 1.20
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 texcoords;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 texcoords;
+uniform sampler2D tex[2][2][2];
+
+void main()
+{
+	gl_FragColor = texture2D(tex[1][0][1], texcoords.xy);
+}
+
+[test]
+uniform int tex[1][0][1] 1
+texture rgbw 1 (8, 8)
+draw rect -1 -1 2 2
+relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
+relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
+relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
+relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index.shader_test
new file mode 100644
index 0000000..6043f42
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-const-index.shader_test
@@ -0,0 +1,32 @@
+[require]
+GLSL >= 1.20
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 texcoords;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 texcoords;
+uniform sampler2D tex[2][2];
+
+void main()
+{
+	gl_FragColor = texture2D(tex[1][1], texcoords.xy);
+}
+
+[test]
+uniform int tex[1][1] 1
+texture rgbw 1 (8, 8)
+draw rect -1 -1 2 2
+relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
+relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
+relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
+relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test
new file mode 100644
index 0000000..9ed59dd
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index.shader_test
@@ -0,0 +1,47 @@
+# Normally, uniform array variables are initialized by array literals.
+#
+# However, samplers are different. Consider a declaration such as:
+#
+#   layout(binding = 5) uniform sampler2D[3];
+#
+# The initializer value is a single integer (5), while the storage has 3
+# array elements. The proper behavior is to increment one for each
+# element; they should be initialized to 5, 6, and 7.
+
+[require]
+GLSL >= 1.40
+GL_ARB_arrays_of_arrays
+GL_ARB_shading_language_420pack
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+in vec4 piglit_vertex;
+out vec4 texcoords;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	texcoords = (piglit_vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_shading_language_420pack: enable
+
+layout(binding = 0) uniform sampler2D tex[2][2][2];
+
+in vec4 texcoords;
+out vec4 color;
+
+void main()
+{
+	color = texture2D(tex[0][1][1], texcoords.xy);
+}
+
+[test]
+texture rgbw 3 (8, 8)
+draw rect -1 -1 2 2
+relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
+relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
+relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
+relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-non-const-index.shader_test
new file mode 100644
index 0000000..88ab686
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-non-const-index.shader_test
@@ -0,0 +1,79 @@
+# Normally, uniform array variables are initialized by array literals.
+#
+# However, samplers are different. Consider a declaration such as:
+#
+#   layout(binding = 5) uniform sampler2D[3];
+#
+# The initializer value is a single integer (5), while the storage has 3
+# array elements. The proper behavior is to increment one for each
+# element; they should be initialized to 5, 6, and 7.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+GL_ARB_arrays_of_arrays
+GL_ARB_shading_language_420pack
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shading_language_420pack : enable
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_arrays_of_arrays: enable
+
+layout(binding = 0) uniform sampler2D tex[2][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+	color = texture(tex[n][m], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/fs-mixed-const-and-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index.shader_test
new file mode 100644
index 0000000..f993e76
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index.shader_test
@@ -0,0 +1,60 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the fragment shader behaves correctly.
+
+[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: enable
+
+uniform sampler2D s[2][2];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+	color = texture(s[n][1], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0] 0
+uniform int s[0][1] 1
+uniform int s[1][0] 2
+uniform int s[1][1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+uniform int n 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 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/sampler/fs-mixed-const-and-non-const-index2.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index2.shader_test
new file mode 100644
index 0000000..05ce652
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-mixed-const-and-non-const-index2.shader_test
@@ -0,0 +1,67 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the fragment shader behaves correctly.
+
+[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: enable
+
+uniform sampler2D s[2][2];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+	color = texture(s[1][n], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0] 0
+uniform int s[0][1] 1
+uniform int s[1][0] 2
+uniform int s[1][1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+uniform int n 0
+draw rect -1 0 1 1
+# real outcome?
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+#uniform int n 0
+#draw rect 0 -1 1 1
+#relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.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)
+
+
+
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-non-const-index.shader_test
new file mode 100644
index 0000000..9aa1f64
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-non-const-index.shader_test
@@ -0,0 +1,75 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the fragment shader behaves correctly.
+
+[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: enable
+
+uniform sampler2D s[2][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+	color = texture(s[n][m], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0] 0
+uniform int s[0][1] 1
+uniform int s[1][0] 2
+uniform int s[1][1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/fs-struct-const-index-sampler-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index-sampler-const-index.shader_test
new file mode 100644
index 0000000..00c5cab
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index-sampler-const-index.shader_test
@@ -0,0 +1,36 @@
+[require]
+GLSL >= 1.20
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 texcoords;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 texcoords; 
+struct S {
+   sampler2D tex[2][2];
+};
+
+uniform S i[2][2];
+
+void main()
+{
+	gl_FragColor = texture2D(i[1][1].tex[1][1], texcoords.xy);
+}
+
+[test]
+uniform int i[1][1].tex[1][1] 1
+texture rgbw 1 (8, 8)
+draw rect -1 -1 2 2
+relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
+relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
+relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
+relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test
new file mode 100644
index 0000000..38111fa
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.20
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+varying vec4 texcoords;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 texcoords; 
+struct S {
+   sampler2D tex;
+};
+
+uniform S i[2][2];
+
+void main()
+{
+	gl_FragColor = texture2D(i[1][1].tex, texcoords.xy);
+}
+
+[test]
+uniform int i[1][1].tex 1
+texture rgbw 1 (8, 8)
+draw rect -1 -1 2 2
+relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
+relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
+relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
+relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index-const-index.shader_test
new file mode 100644
index 0000000..0eeb7ee
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index-const-index.shader_test
@@ -0,0 +1,77 @@
+# This test verifies that dynamically uniform indexing of sampler 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
+
+struct S {
+   sampler2D tex[2];
+};
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+	color = texture(s[n][m].tex[1], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0].tex[1] 0
+uniform int s[0][1].tex[1] 1
+uniform int s[1][0].tex[1] 2
+uniform int s[1][1].tex[1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/fs-struct-non-const-index-sampler-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index-sampler-non-const-index.shader_test
new file mode 100644
index 0000000..d8edf65
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index-sampler-non-const-index.shader_test
@@ -0,0 +1,77 @@
+# This test verifies that dynamically uniform indexing of sampler 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
+
+struct S {
+   sampler2D tex[2];
+};
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+	color = texture(s[n][1].tex[m], vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][1].tex[0] 0
+uniform int s[0][1].tex[1] 1
+uniform int s[1][1].tex[0] 2
+uniform int s[1][1].tex[1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/fs-struct-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index.shader_test
new file mode 100644
index 0000000..22ab511
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-non-const-index.shader_test
@@ -0,0 +1,79 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the fragment shader behaves correctly.
+
+[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: enable
+
+struct S {
+   sampler2D tex;
+};
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+out vec4 color;
+
+void main()
+{
+	color = texture(s[n][m].tex, vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0].tex 0
+uniform int s[0][1].tex 1
+uniform int s[1][0].tex 2
+uniform int s[1][1].tex 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/vs-const-index-three-dimensions.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-const-index-three-dimensions.shader_test
new file mode 100644
index 0000000..1636605
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-const-index-three-dimensions.shader_test
@@ -0,0 +1,32 @@
+[require]
+GLSL >= 1.20
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+uniform sampler2D tex[2][2][2];
+varying vec4 colour;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+	colour = texture2D(tex[1][0][1], gl_Vertex.xy);
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 colour;
+
+void main()
+{
+	gl_FragColor = colour;
+}
+
+[test]
+uniform int tex[1][0][1] 1
+texture rgbw 1 (8, 8)
+draw rect -1 -1 2 2
+relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0)
+relative probe rgb (1.0, 0.0) (0.0, 1.0, 0.0)
+relative probe rgb (0.0, 1.0) (0.0, 0.0, 1.0)
+relative probe rgb (1.0, 1.0) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-const-index.shader_test
new file mode 100644
index 0000000..d0387d4
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-const-index.shader_test
@@ -0,0 +1,32 @@
+[require]
+GLSL >= 1.20
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+uniform sampler2D tex[2][2];
+varying vec4 colour;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+	colour = texture2D(tex[1][1], gl_Vertex.xy);
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+varying vec4 colour;
+
+void main()
+{
+	gl_FragColor = colour;
+}
+
+[test]
+uniform int tex[1][1] 1
+texture rgbw 1 (8, 8)
+draw rect -1 -1 2 2
+relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0)
+relative probe rgb (1.0, 0.0) (0.0, 1.0, 0.0)
+relative probe rgb (0.0, 1.0) (0.0, 0.0, 1.0)
+relative probe rgb (1.0, 1.0) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-non-const-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-non-const-index.shader_test
new file mode 100644
index 0000000..d9ecb0f
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-non-const-index.shader_test
@@ -0,0 +1,87 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the vertex shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s[2][2];
+
+uniform int n;
+uniform int m;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	color = texture(s[n][m], vec2(0.75, 0.25));
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+	out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0] 0
+uniform int s[0][1] 1
+uniform int s[1][0] 2
+uniform int s[1][1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/vs-struct-nonconst-sampler-const.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-sampler-const.shader_test
new file mode 100644
index 0000000..95ee76a
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-sampler-const.shader_test
@@ -0,0 +1,91 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the vertex shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_gpu_shader5: require
+
+struct S {
+   sampler2D tex[2];
+};
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	color = texture(s[n][m].tex[1], vec2(0.75, 0.25));
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+	out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0].tex[1] 0
+uniform int s[0][1].tex[1] 1
+uniform int s[1][0].tex[1] 2
+uniform int s[1][1].tex[1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/vs-struct-nonconst-sampler-nonconst.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-sampler-nonconst.shader_test
new file mode 100644
index 0000000..88d3daa
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-sampler-nonconst.shader_test
@@ -0,0 +1,91 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the vertex shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_gpu_shader5: require
+
+struct S {
+   sampler2D tex[2];
+};
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	color = texture(s[n][1].tex[m], vec2(0.75, 0.25));
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+	out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][1].tex[0] 0
+uniform int s[0][1].tex[1] 1
+uniform int s[1][1].tex[0] 2
+uniform int s[1][1].tex[1] 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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/sampler/vs-struct-nonconst.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test
new file mode 100644
index 0000000..9013811
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test
@@ -0,0 +1,91 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the vertex shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_gpu_shader5: require
+
+struct S {
+   sampler2D tex;
+};
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	color = texture(s[n][m].tex, vec2(0.75, 0.25));
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+	out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0][0].tex 0
+uniform int s[0][1].tex 1
+uniform int s[1][0].tex 2
+uniform int s[1][1].tex 3
+
+texture checkerboard 0 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 1 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 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.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) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+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 1
+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)
