• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450
2#extension GL_ARB_sparse_texture_clamp: enable
3
4uniform sampler2D               s2D;
5uniform sampler3D               s3D;
6uniform sampler2DShadow         s2DShadow;
7uniform samplerCubeShadow       sCubeShadow;
8uniform sampler2DArrayShadow    s2DArrayShadow;
9uniform sampler2DRectShadow     s2DRectShadow;
10uniform samplerCubeArrayShadow  sCubeArrayShadow;
11
12uniform isamplerCube            isCube;
13uniform isampler2DArray         is2DArray;
14
15uniform usamplerCubeArray       usCubeArray;
16uniform usampler2DRect          us2DRect;
17
18in vec2 c2;
19in vec3 c3;
20in vec4 c4;
21
22in float lodClamp;
23
24out vec4 outColor;
25
26void main()
27{
28    int   resident = 0;
29    vec4  texel  = vec4(0.0);
30    ivec4 itexel = ivec4(0);
31    uvec4 utexel = uvec4(0);
32
33    resident |= sparseTextureClampARB(s2D, c2, lodClamp, texel);
34    resident |= sparseTextureClampARB(s3D, c3, lodClamp, texel, 2.0);
35    resident |= sparseTextureClampARB(isCube, c3, lodClamp, itexel);
36    resident |= sparseTextureClampARB(s2DShadow, c3, lodClamp, texel.x);
37    resident |= sparseTextureClampARB(sCubeArrayShadow, c4, 1.0, lodClamp, texel.x);
38
39    texel   += textureClampARB(s2D, c2, lodClamp);
40    texel   += textureClampARB(s3D, c3, lodClamp, 2.0);
41    itexel  += textureClampARB(isCube, c3, lodClamp);
42    texel.x += textureClampARB(s2DShadow, c3, lodClamp);
43    texel.x += textureClampARB(sCubeArrayShadow, c4, 1.0, lodClamp);
44
45    resident |= sparseTextureOffsetClampARB(s3D, c3, ivec3(2), lodClamp, texel, 2.0);
46    resident |= sparseTextureOffsetClampARB(us2DRect, c2, ivec2(3), lodClamp, utexel);
47    resident |= sparseTextureOffsetClampARB(s2DArrayShadow, c4, ivec2(5), lodClamp, texel.z);
48
49    texel   += textureOffsetClampARB(s3D, c3, ivec3(2), lodClamp, 2.0);
50    utexel  += textureOffsetClampARB(us2DRect, c2, ivec2(3), lodClamp);
51    texel.z += textureOffsetClampARB(s2DArrayShadow, c4, ivec2(5), lodClamp);
52
53    resident |= sparseTextureGradClampARB(s3D, c3, c3, c3, lodClamp, texel);
54    resident |= sparseTextureGradClampARB(sCubeShadow, c4, c3, c3, lodClamp, texel.y);
55    resident |= sparseTextureGradClampARB(usCubeArray, c4, c3, c3, lodClamp, utexel);
56
57    texel   += textureGradClampARB(s3D, c3, c3, c3, lodClamp);
58    texel.y += textureGradClampARB(sCubeShadow, c4, c3, c3, lodClamp);
59    utexel  += textureGradClampARB(usCubeArray, c4, c3, c3, lodClamp);
60
61    resident |= sparseTextureGradOffsetClampARB(s2D, c2, c2, c2, ivec2(5), lodClamp, texel);
62    resident |= sparseTextureGradOffsetClampARB(s2DRectShadow, c3, c2, c2, ivec2(6), lodClamp, texel.w);
63    resident |= sparseTextureGradOffsetClampARB(is2DArray, c3, c2, c2, ivec2(2), lodClamp, itexel);
64
65    texel   += textureGradOffsetClampARB(s2D, c2, c2, c2, ivec2(5), lodClamp);
66    texel.w += textureGradOffsetClampARB(s2DRectShadow, c3, c2, c2, ivec2(6), lodClamp);
67    itexel  += textureGradOffsetClampARB(is2DArray, c3, c2, c2, ivec2(2), lodClamp);
68
69    outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
70}