• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450
2#extension GL_ARB_sparse_texture2: enable
3
4uniform sampler2D               s2D;
5uniform isampler2D             is2D;
6uniform usampler2D             us2D;
7
8layout(rgba32f)  uniform  image2D i2D;
9layout(rgba32i)  uniform iimage2DMS ii2DMS;
10layout(rgba32ui) uniform uimage3D ui3D;
11
12in vec2 c2;
13in vec3 c3;
14in vec4 c4;
15
16in flat ivec2 ic2;
17in flat ivec3 ic3;
18
19in flat ivec2 offsets[4];
20
21out vec4 outColor;
22
23void main()
24{
25    int   resident = 0;
26    vec4  texel  = vec4(0.0);
27    ivec4 itexel = ivec4(0);
28    uvec4 utexel = uvec4(0);
29
30    resident |= sparseTextureARB(s2D,  c2, texel);
31    resident |= sparseTextureARB(is2D, c2, texel);
32    resident |= sparseTextureARB(us2D, c2, texel);
33
34    resident |= sparseTextureLodARB( s2D, c2, 2.0, texel);
35    resident |= sparseTextureLodARB(is2D, c2, 2.0, texel);
36    resident |= sparseTextureLodARB(us2D, c2, 2.0, texel);
37
38    resident |= sparseTexelFetchARB( s2D, ivec2(c2), 2, texel);
39    resident |= sparseTexelFetchARB(is2D, ivec2(c2), 2, texel);
40    resident |= sparseTexelFetchARB(us2D, ivec2(c2), 2, texel);
41
42    resident |= sparseImageLoadARB(i2D, ic2, texel);
43    resident |= sparseImageLoadARB(ii2DMS, ic2, 3, texel);
44    resident |= sparseImageLoadARB(ui3D, ic3, utexel);
45
46    outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
47}