1#version 450 core
2
3#extension GL_ARB_sparse_texture2: enable
4#extension GL_AMD_texture_gather_bias_lod: enable
5
6uniform sampler2D           s2D;
7uniform sampler2DArray      s2DArray;
8uniform samplerCube         sCube;
9uniform samplerCubeArray    sCubeArray;
10
11in vec2 c2;
12in vec3 c3;
13in vec4 c4;
14
15in float lod;
16in float bias;
17
18out vec4 fragColor;
19
20void main()
21{
22    vec4 texel  = vec4(0.0);
23    vec4 result = vec4(0.0);
24
25    const ivec2 offsets[4] = { ivec2(0, 0), ivec2(0, 1), ivec2(1, 0), ivec2(1, 1) };
26
27    texel += textureGather(s2D,        c2, 0, bias);
28    texel += textureGather(s2DArray,   c3, 1, bias);
29    texel += textureGather(sCube,      c3, 2, bias);
30    texel += textureGather(sCubeArray, c4, 3, bias);
31
32    texel += textureGatherOffset(s2D,        c2, offsets[0], 0, bias);
33    texel += textureGatherOffset(s2DArray,   c3, offsets[1], 1, bias);
34
35    texel += textureGatherOffsets(s2D,        c2, offsets, 0, bias);
36    texel += textureGatherOffsets(s2DArray,   c3, offsets, 1, bias);
37
38    sparseTextureGatherARB(s2D,        c2, result, 0, bias);
39    texel += result;
40    sparseTextureGatherARB(s2DArray,   c3, result, 1, bias);
41    texel += result;
42    sparseTextureGatherARB(sCube,      c3, result, 2, bias);
43    texel += result;
44    sparseTextureGatherARB(sCubeArray, c4, result, 2, bias);
45    texel += result;
46
47    sparseTextureGatherOffsetARB(s2D,      c2, offsets[0], result, 0, bias);
48    texel += result;
49    sparseTextureGatherOffsetARB(s2DArray, c3, offsets[1], result, 1, bias);
50    texel += result;
51
52    sparseTextureGatherOffsetsARB(s2D,      c2, offsets, result, 0, bias);
53    texel += result;
54    sparseTextureGatherOffsetsARB(s2DArray, c3, offsets, result, 1, bias);
55    texel += result;
56
57    texel += textureGatherLodAMD(s2D,        c2, lod);
58    texel += textureGatherLodAMD(s2DArray,   c3, lod, 1);
59    texel += textureGatherLodAMD(sCube,      c3, lod, 2);
60    texel += textureGatherLodAMD(sCubeArray, c4, lod, 3);
61
62    texel += textureGatherLodOffsetAMD(s2D,        c2, lod, offsets[0]);
63    texel += textureGatherLodOffsetAMD(s2DArray,   c3, lod, offsets[1], 1);
64
65    texel += textureGatherLodOffsetsAMD(s2D,       c2, lod, offsets);
66    texel += textureGatherLodOffsetsAMD(s2DArray,  c3, lod, offsets, 1);
67
68    sparseTextureGatherLodAMD(s2D,        c2, lod, result);
69    texel += result;
70    sparseTextureGatherLodAMD(s2DArray,   c3, lod, result, 1);
71    texel += result;
72    sparseTextureGatherLodAMD(sCube,      c3, lod, result, 2);
73    texel += result;
74    sparseTextureGatherLodAMD(sCubeArray, c4, lod, result, 2);
75    texel += result;
76
77    sparseTextureGatherLodOffsetAMD(s2D,      c2, lod, offsets[0], result);
78    texel += result;
79    sparseTextureGatherLodOffsetAMD(s2DArray, c3, lod, offsets[1], result, 1);
80    texel += result;
81
82    sparseTextureGatherLodOffsetsAMD(s2D,      c2, lod, offsets, result);
83    texel += result;
84    sparseTextureGatherLodOffsetsAMD(s2DArray, c3, lod, offsets, result, 1);
85    texel += result;
86
87    fragColor = texel;
88}
89