blob: c995ee2ae520663dccb6fd694a151324d16cc223 [file] [log] [blame]
Rex Xu48edadf2015-12-31 16:11:41 +08001#version 450
2#extension GL_ARB_sparse_texture2: enable
3
4uniform sampler2D s2D;
5uniform sampler3D s3D;
6uniform sampler2DShadow s2DShadow;
7uniform samplerCubeShadow sCubeShadow;
8uniform sampler2DArrayShadow s2DArrayShadow;
9uniform sampler2DRectShadow s2DRectShadow;
10uniform samplerCubeArrayShadow sCubeArrayShadow;
11uniform sampler2DMS s2DMS;
12
13uniform isamplerCube isCube;
14uniform isampler2DArray is2DArray;
15
16uniform usamplerCubeArray usCubeArray;
17uniform usampler2DRect us2DRect;
18
Rex Xu5eafa472016-02-19 22:24:03 +080019layout(rgba32f) uniform image2D i2D;
20layout(rgba32i) uniform iimage3D ii3D;
21layout(rgba32f) uniform image2DMS i2DMS;
22
John Kessenich6c292d32016-02-15 20:58:50 -070023in vec2 c2;
24in vec3 c3;
25in vec4 c4;
Rex Xu48edadf2015-12-31 16:11:41 +080026
Rex Xu5eafa472016-02-19 22:24:03 +080027in flat ivec2 ic2;
28in flat ivec3 ic3;
29
John Kessenich6c292d32016-02-15 20:58:50 -070030in flat ivec2 offsets[4];
Rex Xu48edadf2015-12-31 16:11:41 +080031
32out vec4 outColor;
33
34void main()
35{
36 int resident = 0;
37 vec4 texel = vec4(0.0);
38 ivec4 itexel = ivec4(0);
39 uvec4 utexel = uvec4(0);
40
41 resident |= sparseTextureARB(s2D, c2, texel);
42 resident |= sparseTextureARB(s3D, c3, texel, 2.0);
43 resident |= sparseTextureARB(isCube, c3, itexel);
44 resident |= sparseTextureARB(s2DShadow, c3, texel.x);
45 resident |= sparseTextureARB(sCubeArrayShadow, c4, 1.0, texel.x);
46
47 resident |= sparseTextureLodARB(s2D, c2, 2.0, texel);
48 resident |= sparseTextureLodARB(usCubeArray, c4, 1.0, utexel);
49 resident |= sparseTextureLodARB(s2DShadow, c3, 2.0, texel.y);
50
51 resident |= sparseTextureOffsetARB(s3D, c3, ivec3(2), texel, 2.0);
52 resident |= sparseTextureOffsetARB(us2DRect, c2, ivec2(3), utexel);
53 resident |= sparseTextureOffsetARB(s2DArrayShadow, c4, ivec2(5), texel.z);
54
55 resident |= sparseTexelFetchARB(s2D, ivec2(c2), 2, texel);
56 resident |= sparseTexelFetchARB(us2DRect, ivec2(c2), utexel);
57 resident |= sparseTexelFetchARB(s2DMS, ivec2(c2), 4, texel);
58
59 resident |= sparseTexelFetchOffsetARB(s3D, ivec3(c3), 2, ivec3(4), texel);
60 resident |= sparseTexelFetchOffsetARB(us2DRect, ivec2(c2), ivec2(3), utexel);
61
62 resident |= sparseTextureLodOffsetARB(s2D, c2, 2.0, ivec2(5), texel);
63 resident |= sparseTextureLodOffsetARB(is2DArray, c3, 2.0, ivec2(6), itexel);
64 resident |= sparseTextureLodOffsetARB(s2DShadow, c3, 2.0, ivec2(7), texel.z);
65
66 resident |= sparseTextureGradARB(s3D, c3, c3, c3, texel);
67 resident |= sparseTextureGradARB(sCubeShadow, c4, c3, c3, texel.y);
68 resident |= sparseTextureGradARB(usCubeArray, c4, c3, c3, utexel);
69
70 resident |= sparseTextureGradOffsetARB(s2D, c2, c2, c2, ivec2(5), texel);
71 resident |= sparseTextureGradOffsetARB(s2DRectShadow, c3, c2, c2, ivec2(6), texel.w);
72 resident |= sparseTextureGradOffsetARB(is2DArray, c3, c2, c2, ivec2(2), itexel);
73
74 resident |= sparseTextureGatherARB(s2D, c2, texel);
75 resident |= sparseTextureGatherARB(is2DArray, c3, itexel, 2);
76 resident |= sparseTextureGatherARB(s2DArrayShadow, c3, 2.0, texel);
77
78 resident |= sparseTextureGatherOffsetARB(s2D, c2, ivec2(4), texel);
79 resident |= sparseTextureGatherOffsetARB(is2DArray, c3, ivec2(5), itexel, 2);
Rex Xu5eafa472016-02-19 22:24:03 +080080 resident |= sparseTextureGatherOffsetARB(s2DRectShadow, c2, 2.0, ivec2(7), texel);
Rex Xu48edadf2015-12-31 16:11:41 +080081
82 resident |= sparseTextureGatherOffsetsARB(s2D, c2, offsets, texel);
83 resident |= sparseTextureGatherOffsetsARB(is2DArray, c3, offsets, itexel, 2);
Rex Xu5eafa472016-02-19 22:24:03 +080084 resident |= sparseTextureGatherOffsetsARB(s2DRectShadow, c2, 2.0, offsets, texel);
85
86 resident |= sparseImageLoadARB(i2D, ic2, texel);
87 resident |= sparseImageLoadARB(ii3D, ic3, itexel);
88 resident |= sparseImageLoadARB(i2DMS, ic2, 3, texel);
Rex Xu48edadf2015-12-31 16:11:41 +080089
90 outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
91}