[Piglit] [PATCH 04/10] ARB_gpu_shader5: add compiler tests for textureGather*()

Chris Forbes chrisf at ijw.co.nz
Tue Oct 15 10:47:06 CEST 2013


This extension adds the following new variants:

- shadow sampler support
- rectangle sampler support
- nonconstant texture offsets
- constant component select parameter
- independent offsets per texel support

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 tests/all.tests                                    |  2 +
 .../fs-gather-comp-float-samplers.frag             | 28 ++++++++
 .../fs-gather-comp-int-samplers.frag               | 28 ++++++++
 .../fs-gather-comp-uint-samplers.frag              | 28 ++++++++
 .../fs-gather-float-samplers.frag                  | 28 ++++++++
 .../builtin-functions/fs-gather-int-samplers.frag  | 28 ++++++++
 .../fs-gather-shadow-samplers.frag                 | 30 +++++++++
 .../builtin-functions/fs-gather-uint-samplers.frag | 28 ++++++++
 .../fs-gatherOffset-comp-float-samplers.frag       | 25 ++++++++
 .../fs-gatherOffset-comp-int-samplers.frag         | 25 ++++++++
 .../fs-gatherOffset-comp-uint-samplers.frag        | 25 ++++++++
 .../fs-gatherOffset-float-samplers.frag            | 25 ++++++++
 .../fs-gatherOffset-int-samplers.frag              | 25 ++++++++
 .../fs-gatherOffset-shadow-samplers.frag           | 26 ++++++++
 .../fs-gatherOffset-uint-samplers.frag             | 25 ++++++++
 .../fs-gatherOffset-uniform-offset.frag            | 21 ++++++
 .../builtin-functions/fs-gatherOffsets.frag        | 75 ++++++++++++++++++++++
 .../vs-gather-comp-float-samplers.vert             | 28 ++++++++
 .../vs-gather-comp-int-samplers.vert               | 28 ++++++++
 .../vs-gather-comp-must-be-constexpr.vert          | 18 ++++++
 .../vs-gather-comp-uint-samplers.vert              | 28 ++++++++
 .../vs-gather-float-samplers.vert                  | 28 ++++++++
 .../builtin-functions/vs-gather-int-samplers.vert  | 28 ++++++++
 .../vs-gather-offsets-must-be-constexpr.vert       | 16 +++++
 .../vs-gather-shadow-samplers.vert                 | 30 +++++++++
 .../builtin-functions/vs-gather-uint-samplers.vert | 28 ++++++++
 .../vs-gatherOffset-comp-float-samplers.vert       | 25 ++++++++
 .../vs-gatherOffset-comp-int-samplers.vert         | 25 ++++++++
 .../vs-gatherOffset-comp-uint-samplers.vert        | 25 ++++++++
 .../vs-gatherOffset-float-samplers.vert            | 25 ++++++++
 .../vs-gatherOffset-int-samplers.vert              | 25 ++++++++
 .../vs-gatherOffset-shadow-samplers.vert           | 26 ++++++++
 .../vs-gatherOffset-uint-samplers.vert             | 25 ++++++++
 .../vs-gatherOffset-uniform-offset.vert            | 21 ++++++
 .../builtin-functions/vs-gatherOffsets.vert        | 75 ++++++++++++++++++++++
 35 files changed, 976 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-float-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-int-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-uint-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-float-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-int-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-shadow-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-uint-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-float-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-int-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-uint-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-float-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-int-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-shadow-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uint-samplers.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uniform-offset.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffsets.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-float-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-int-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-must-be-constexpr.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-uint-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-float-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-int-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-offsets-must-be-constexpr.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-shadow-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-uint-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-float-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-int-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-uint-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-float-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-int-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-shadow-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uint-samplers.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uniform-offset.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffsets.vert

diff --git a/tests/all.tests b/tests/all.tests
index 5343c2b..2363cae 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1311,6 +1311,8 @@ spec['ARB_gpu_shader5'] = arb_gpu_shader5
 add_shader_test_dir(arb_gpu_shader5,
                     testsDir + '/spec/arb_gpu_shader5',
                     recursive=True)
+import_glsl_parser_tests(arb_gpu_shader5,
+                         testsDir + '/spec/arb_gpu_shader5', [''])
 
 arb_texture_query_levels = Group()
 spec['ARB_texture_query_levels'] = arb_texture_query_levels
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-float-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-float-samplers.frag
new file mode 100644
index 0000000..6c679f3
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-float-samplers.frag
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform samplerCube sCube;
+uniform samplerCubeArray sCubeArray;
+uniform sampler2DRect s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGather(s2D,		vec2(0), 0);
+	res += textureGather(s2DArray,		vec3(0), 1);
+	res += textureGather(sCube,		vec3(0), 2);
+	res += textureGather(sCubeArray,	vec4(0), 3);
+	res += textureGather(s2DRect,		vec2(0), 0);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-int-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-int-samplers.frag
new file mode 100644
index 0000000..b7683a6
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-int-samplers.frag
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isamplerCube sCube;
+uniform isamplerCubeArray sCubeArray;
+uniform isampler2DRect s2DRect;
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGather(s2D,		vec2(0), 0);
+	res += textureGather(s2DArray,		vec3(0), 1);
+	res += textureGather(sCube,		vec3(0), 2);
+	res += textureGather(sCubeArray,	vec4(0), 3);
+	res += textureGather(s2DRect,		vec2(0), 0);
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-uint-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-uint-samplers.frag
new file mode 100644
index 0000000..c5958e5
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-comp-uint-samplers.frag
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usamplerCube sCube;
+uniform usamplerCubeArray sCubeArray;
+uniform usampler2DRect s2DRect;
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGather(s2D,		vec2(0), 0);
+	res += textureGather(s2DArray,		vec3(0), 1);
+	res += textureGather(sCube,		vec3(0), 2);
+	res += textureGather(sCubeArray,	vec4(0), 3);
+	res += textureGather(s2DRect,		vec2(0), 0);
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-float-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-float-samplers.frag
new file mode 100644
index 0000000..e9576c8
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-float-samplers.frag
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform samplerCube sCube;
+uniform samplerCubeArray sCubeArray;
+uniform sampler2DRect s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGather(s2D,		vec2(0));
+	res += textureGather(s2DArray,		vec3(0));
+	res += textureGather(sCube,		vec3(0));
+	res += textureGather(sCubeArray,	vec4(0));
+	res += textureGather(s2DRect,		vec2(0));
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-int-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-int-samplers.frag
new file mode 100644
index 0000000..33380ad
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-int-samplers.frag
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isamplerCube sCube;
+uniform isamplerCubeArray sCubeArray;
+uniform isampler2DRect s2DRect;
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGather(s2D,		vec2(0));
+	res += textureGather(s2DArray,		vec3(0));
+	res += textureGather(sCube,		vec3(0));
+	res += textureGather(sCubeArray,	vec4(0));
+	res += textureGather(s2DRect,		vec2(0));
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-shadow-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-shadow-samplers.frag
new file mode 100644
index 0000000..5b820a1
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-shadow-samplers.frag
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform sampler2DShadow s2D;
+uniform sampler2DArrayShadow s2DArray;
+uniform samplerCubeShadow sCube;
+uniform samplerCubeArrayShadow sCubeArray;
+uniform sampler2DRectShadow s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	float refz = 0.5;
+
+	res += textureGather(s2D,		vec2(0), refz);
+	res += textureGather(s2DArray,		vec3(0), refz);
+	res += textureGather(sCube,		vec3(0), refz);
+	res += textureGather(sCubeArray,	vec4(0), refz);
+	res += textureGather(s2DRect,		vec2(0), refz);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-uint-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-uint-samplers.frag
new file mode 100644
index 0000000..b5567b2
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gather-uint-samplers.frag
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usamplerCube sCube;
+uniform usamplerCubeArray sCubeArray;
+uniform usampler2DRect s2DRect;
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGather(s2D,		vec2(0));
+	res += textureGather(s2DArray,		vec3(0));
+	res += textureGather(sCube,		vec3(0));
+	res += textureGather(sCubeArray,	vec4(0));
+	res += textureGather(s2DRect,		vec2(0));
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-float-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-float-samplers.frag
new file mode 100644
index 0000000..c49bedc
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-float-samplers.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform sampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGatherOffset(s2D,			vec2(0), offset, 0);
+	res += textureGatherOffset(s2DArray,		vec3(0), offset, 1);
+	res += textureGatherOffset(s2DRect,		vec2(0), offset, 2);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-int-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-int-samplers.frag
new file mode 100644
index 0000000..d914150
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-int-samplers.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset, 0);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset, 1);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset, 2);
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-uint-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-uint-samplers.frag
new file mode 100644
index 0000000..daceb3a
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-comp-uint-samplers.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset, 0);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset, 1);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset, 2);
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-float-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-float-samplers.frag
new file mode 100644
index 0000000..658ec66
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-float-samplers.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform sampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGatherOffset(s2D,			vec2(0), offset);
+	res += textureGatherOffset(s2DArray,		vec3(0), offset);
+	res += textureGatherOffset(s2DRect,		vec2(0), offset);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-int-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-int-samplers.frag
new file mode 100644
index 0000000..9f0d00c
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-int-samplers.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset);
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-shadow-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-shadow-samplers.frag
new file mode 100644
index 0000000..de88335
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-shadow-samplers.frag
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2DShadow s2D;
+uniform sampler2DArrayShadow s2DArray;
+uniform sampler2DRectShadow s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	float refz = 0.5;
+	ivec2 offset = ivec2(-8, 7);
+
+	res += textureGatherOffset(s2D,		vec2(0), refz, offset);
+	res += textureGatherOffset(s2DArray,	vec3(0), refz, offset);
+	res += textureGatherOffset(s2DRect,	vec2(0), refz, offset);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uint-samplers.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uint-samplers.frag
new file mode 100644
index 0000000..46c0f83
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uint-samplers.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset);
+
+	gl_FragColor = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uniform-offset.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uniform-offset.frag
new file mode 100644
index 0000000..3747d1d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uniform-offset.frag
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform ivec2 offset;		/* ARB_gpu_shader5 allows this to be uniform
+				   rather than constexpr */
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGatherOffset(s2D,	vec2(0), offset);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffsets.frag b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffsets.frag
new file mode 100644
index 0000000..f5b1c97
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffsets.frag
@@ -0,0 +1,75 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform sampler2DRect s2DRect;
+
+uniform isampler2D is2D;
+uniform isampler2DArray is2DArray;
+uniform isampler2DRect is2DRect;
+
+uniform usampler2D us2D;
+uniform usampler2DArray us2DArray;
+uniform usampler2DRect us2DRect;
+
+uniform sampler2DShadow ss2D;
+uniform sampler2DArrayShadow ss2DArray;
+uniform sampler2DRectShadow ss2DRect;
+
+const ivec2[] offsets = ivec2[](
+	ivec2(-8, 7),
+	ivec2(-8, -8),
+	ivec2(7, -8),
+	ivec2(7, 7)
+);
+
+const float refz = 0.5;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	/* float samplers, no component select */
+	res += textureGatherOffsets(s2D,		vec2(0), offsets);
+	res += textureGatherOffsets(s2DArray,		vec3(0), offsets);
+	res += textureGatherOffsets(s2DRect,		vec2(0), offsets);
+
+	/* float samplers, component select */
+	res += textureGatherOffsets(s2D,		vec2(0), offsets, 0);
+	res += textureGatherOffsets(s2DArray,		vec3(0), offsets, 1);
+	res += textureGatherOffsets(s2DRect,		vec2(0), offsets, 2);
+
+	/* int samplers, no component select */
+	res += textureGatherOffsets(is2D,		vec2(0), offsets);
+	res += textureGatherOffsets(is2DArray,		vec3(0), offsets);
+	res += textureGatherOffsets(is2DRect,		vec2(0), offsets);
+
+	/* int samplers, component select */
+	res += textureGatherOffsets(is2D,		vec2(0), offsets, 0);
+	res += textureGatherOffsets(is2DArray,		vec3(0), offsets, 1);
+	res += textureGatherOffsets(is2DRect,		vec2(0), offsets, 2);
+
+	/* uint samplers, no component select */
+	res += textureGatherOffsets(us2D,		vec2(0), offsets);
+	res += textureGatherOffsets(us2DArray,		vec3(0), offsets);
+	res += textureGatherOffsets(us2DRect,		vec2(0), offsets);
+
+	/* uint samplers, component select */
+	res += textureGatherOffsets(us2D,		vec2(0), offsets, 0);
+	res += textureGatherOffsets(us2DArray,		vec3(0), offsets, 1);
+	res += textureGatherOffsets(us2DRect,		vec2(0), offsets, 2);
+
+	/* shadow samplers, no component select (none available) */
+	res += textureGatherOffsets(ss2D,		vec2(0), refz, offsets);
+	res += textureGatherOffsets(ss2DArray,		vec3(0), refz, offsets);
+	res += textureGatherOffsets(ss2DRect,		vec2(0), refz, offsets);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-float-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-float-samplers.vert
new file mode 100644
index 0000000..1174175
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-float-samplers.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform samplerCube sCube;
+uniform samplerCubeArray sCubeArray;
+uniform sampler2DRect s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGather(s2D,		vec2(0), 0);
+	res += textureGather(s2DArray,		vec3(0), 1);
+	res += textureGather(sCube,		vec3(0), 2);
+	res += textureGather(sCubeArray,	vec4(0), 3);
+	res += textureGather(s2DRect,		vec2(0), 0);
+
+	gl_Position = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-int-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-int-samplers.vert
new file mode 100644
index 0000000..3f6647f
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-int-samplers.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isamplerCube sCube;
+uniform isamplerCubeArray sCubeArray;
+uniform isampler2DRect s2DRect;
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGather(s2D,		vec2(0), 0);
+	res += textureGather(s2DArray,		vec3(0), 1);
+	res += textureGather(sCube,		vec3(0), 2);
+	res += textureGather(sCubeArray,	vec4(0), 3);
+	res += textureGather(s2DRect,		vec2(0), 0);
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-must-be-constexpr.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-must-be-constexpr.vert
new file mode 100644
index 0000000..1dc13d7
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-must-be-constexpr.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform sampler2D s2D;
+
+in int component_select;	/* not a const expr! */
+
+void main()
+{
+	gl_Position = textureGather(s2D, vec2(0), component_select);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-uint-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-uint-samplers.vert
new file mode 100644
index 0000000..4ecde23
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-comp-uint-samplers.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usamplerCube sCube;
+uniform usamplerCubeArray sCubeArray;
+uniform usampler2DRect s2DRect;
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGather(s2D,		vec2(0), 0);
+	res += textureGather(s2DArray,		vec3(0), 1);
+	res += textureGather(sCube,		vec3(0), 2);
+	res += textureGather(sCubeArray,	vec4(0), 3);
+	res += textureGather(s2DRect,		vec2(0), 0);
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-float-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-float-samplers.vert
new file mode 100644
index 0000000..94e100e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-float-samplers.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform samplerCube sCube;
+uniform samplerCubeArray sCubeArray;
+uniform sampler2DRect s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGather(s2D,		vec2(0));
+	res += textureGather(s2DArray,		vec3(0));
+	res += textureGather(sCube,		vec3(0));
+	res += textureGather(sCubeArray,	vec4(0));
+	res += textureGather(s2DRect,		vec2(0));
+
+	gl_Position = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-int-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-int-samplers.vert
new file mode 100644
index 0000000..335e609
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-int-samplers.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isamplerCube sCube;
+uniform isamplerCubeArray sCubeArray;
+uniform isampler2DRect s2DRect;
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGather(s2D,		vec2(0));
+	res += textureGather(s2DArray,		vec3(0));
+	res += textureGather(sCube,		vec3(0));
+	res += textureGather(sCubeArray,	vec4(0));
+	res += textureGather(s2DRect,		vec2(0));
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-offsets-must-be-constexpr.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-offsets-must-be-constexpr.vert
new file mode 100644
index 0000000..b00a20b
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-offsets-must-be-constexpr.vert
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform ivec2[4] offsets;
+
+void main()
+{
+	gl_Position = textureGatherOffsets(s2D, vec2(0), offsets);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-shadow-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-shadow-samplers.vert
new file mode 100644
index 0000000..d37b16c
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-shadow-samplers.vert
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform sampler2DShadow s2D;
+uniform sampler2DArrayShadow s2DArray;
+uniform samplerCubeShadow sCube;
+uniform samplerCubeArrayShadow sCubeArray;
+uniform sampler2DRectShadow s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	float refz = 0.5;
+
+	res += textureGather(s2D,		vec2(0), refz);
+	res += textureGather(s2DArray,		vec3(0), refz);
+	res += textureGather(sCube,		vec3(0), refz);
+	res += textureGather(sCubeArray,	vec4(0), refz);
+	res += textureGather(s2DRect,		vec2(0), refz);
+
+	gl_Position = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-uint-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-uint-samplers.vert
new file mode 100644
index 0000000..5b72c9d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gather-uint-samplers.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_texture_cube_map_array
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+#extension GL_ARB_texture_cube_map_array: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usamplerCube sCube;
+uniform usamplerCubeArray sCubeArray;
+uniform usampler2DRect s2DRect;
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGather(s2D,		vec2(0));
+	res += textureGather(s2DArray,		vec3(0));
+	res += textureGather(sCube,		vec3(0));
+	res += textureGather(sCubeArray,	vec4(0));
+	res += textureGather(s2DRect,		vec2(0));
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-float-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-float-samplers.vert
new file mode 100644
index 0000000..0cb939f
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-float-samplers.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform sampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGatherOffset(s2D,			vec2(0), offset, 0);
+	res += textureGatherOffset(s2DArray,		vec3(0), offset, 1);
+	res += textureGatherOffset(s2DRect,		vec2(0), offset, 2);
+
+	gl_Position = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-int-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-int-samplers.vert
new file mode 100644
index 0000000..3d9e97e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-int-samplers.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset, 0);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset, 1);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset, 2);
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-uint-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-uint-samplers.vert
new file mode 100644
index 0000000..99f75aa
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-comp-uint-samplers.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset, 0);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset, 1);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset, 2);
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-float-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-float-samplers.vert
new file mode 100644
index 0000000..7d251ec
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-float-samplers.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform sampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGatherOffset(s2D,			vec2(0), offset);
+	res += textureGatherOffset(s2DArray,		vec3(0), offset);
+	res += textureGatherOffset(s2DRect,		vec2(0), offset);
+
+	gl_Position = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-int-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-int-samplers.vert
new file mode 100644
index 0000000..df0d41f
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-int-samplers.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform isampler2D s2D;
+uniform isampler2DArray s2DArray;
+uniform isampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	ivec4 res = ivec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset);
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-shadow-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-shadow-samplers.vert
new file mode 100644
index 0000000..74f9f28
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-shadow-samplers.vert
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2DShadow s2D;
+uniform sampler2DArrayShadow s2DArray;
+uniform sampler2DRectShadow s2DRect;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	float refz = 0.5;
+	ivec2 offset = ivec2(-8, 7);
+
+	res += textureGatherOffset(s2D,		vec2(0), refz, offset);
+	res += textureGatherOffset(s2DArray,	vec3(0), refz, offset);
+	res += textureGatherOffset(s2DRect,	vec2(0), refz, offset);
+
+	gl_Position = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uint-samplers.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uint-samplers.vert
new file mode 100644
index 0000000..75d762f
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uint-samplers.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform usampler2D s2D;
+uniform usampler2DArray s2DArray;
+uniform usampler2DRect s2DRect;
+
+const ivec2 offset = ivec2(-8, 7);
+
+void main()
+{
+	uvec4 res = uvec4(0);
+
+	res += textureGatherOffset(s2D,		vec2(0), offset);
+	res += textureGatherOffset(s2DArray,	vec3(0), offset);
+	res += textureGatherOffset(s2DRect,	vec2(0), offset);
+
+	gl_Position = vec4(res);
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uniform-offset.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uniform-offset.vert
new file mode 100644
index 0000000..bf13257
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffset-uniform-offset.vert
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform ivec2 offset;		/* ARB_gpu_shader5 allows this to be uniform
+				   rather than constexpr */
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += textureGatherOffset(s2D,	vec2(0), offset);
+
+	gl_Position = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffsets.vert b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffsets.vert
new file mode 100644
index 0000000..e87f484
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/builtin-functions/vs-gatherOffsets.vert
@@ -0,0 +1,75 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform sampler2D s2D;
+uniform sampler2DArray s2DArray;
+uniform sampler2DRect s2DRect;
+
+uniform isampler2D is2D;
+uniform isampler2DArray is2DArray;
+uniform isampler2DRect is2DRect;
+
+uniform usampler2D us2D;
+uniform usampler2DArray us2DArray;
+uniform usampler2DRect us2DRect;
+
+uniform sampler2DShadow ss2D;
+uniform sampler2DArrayShadow ss2DArray;
+uniform sampler2DRectShadow ss2DRect;
+
+const ivec2[] offsets = ivec2[](
+	ivec2(-8, 7),
+	ivec2(-8, -8),
+	ivec2(7, -8),
+	ivec2(7, 7)
+);
+
+const float refz = 0.5;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	/* float samplers, no component select */
+	res += textureGatherOffsets(s2D,		vec2(0), offsets);
+	res += textureGatherOffsets(s2DArray,		vec3(0), offsets);
+	res += textureGatherOffsets(s2DRect,		vec2(0), offsets);
+
+	/* float samplers, component select */
+	res += textureGatherOffsets(s2D,		vec2(0), offsets, 0);
+	res += textureGatherOffsets(s2DArray,		vec3(0), offsets, 1);
+	res += textureGatherOffsets(s2DRect,		vec2(0), offsets, 2);
+
+	/* int samplers, no component select */
+	res += textureGatherOffsets(is2D,		vec2(0), offsets);
+	res += textureGatherOffsets(is2DArray,		vec3(0), offsets);
+	res += textureGatherOffsets(is2DRect,		vec2(0), offsets);
+
+	/* int samplers, component select */
+	res += textureGatherOffsets(is2D,		vec2(0), offsets, 0);
+	res += textureGatherOffsets(is2DArray,		vec3(0), offsets, 1);
+	res += textureGatherOffsets(is2DRect,		vec2(0), offsets, 2);
+
+	/* uint samplers, no component select */
+	res += textureGatherOffsets(us2D,		vec2(0), offsets);
+	res += textureGatherOffsets(us2DArray,		vec3(0), offsets);
+	res += textureGatherOffsets(us2DRect,		vec2(0), offsets);
+
+	/* uint samplers, component select */
+	res += textureGatherOffsets(us2D,		vec2(0), offsets, 0);
+	res += textureGatherOffsets(us2DArray,		vec3(0), offsets, 1);
+	res += textureGatherOffsets(us2DRect,		vec2(0), offsets, 2);
+
+	/* shadow samplers, no component select (none available) */
+	res += textureGatherOffsets(ss2D,		vec2(0), refz, offsets);
+	res += textureGatherOffsets(ss2DArray,		vec3(0), refz, offsets);
+	res += textureGatherOffsets(ss2DRect,		vec2(0), refz, offsets);
+
+	gl_Position = res;
+}
-- 
1.8.4



More information about the Piglit mailing list