File: spv.1.4.sparseTexture.frag

package info (click to toggle)
glslang 16.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 51,712 kB
  • sloc: cpp: 92,305; yacc: 4,320; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (47 lines) | stat: -rw-r--r-- 1,370 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#version 450
#extension GL_ARB_sparse_texture2: enable

uniform sampler2D               s2D;
uniform isampler2D             is2D;
uniform usampler2D             us2D;

layout(rgba32f)  uniform  image2D i2D;
layout(rgba32i)  uniform iimage2DMS ii2DMS;
layout(rgba32ui) uniform uimage3D ui3D;

in vec2 c2;
in vec3 c3;
in vec4 c4;

in flat ivec2 ic2;
in flat ivec3 ic3;

in flat ivec2 offsets[4];

out vec4 outColor;

void main()
{
    int   resident = 0;
    vec4  texel  = vec4(0.0);
    ivec4 itexel = ivec4(0);
    uvec4 utexel = uvec4(0);

    resident |= sparseTextureARB(s2D,  c2, texel);
    resident |= sparseTextureARB(is2D, c2, texel);
    resident |= sparseTextureARB(us2D, c2, texel);

    resident |= sparseTextureLodARB( s2D, c2, 2.0, texel);
    resident |= sparseTextureLodARB(is2D, c2, 2.0, texel);
    resident |= sparseTextureLodARB(us2D, c2, 2.0, texel);

    resident |= sparseTexelFetchARB( s2D, ivec2(c2), 2, texel);
    resident |= sparseTexelFetchARB(is2D, ivec2(c2), 2, texel);
    resident |= sparseTexelFetchARB(us2D, ivec2(c2), 2, texel);

    resident |= sparseImageLoadARB(i2D, ic2, texel);
    resident |= sparseImageLoadARB(ii2DMS, ic2, 3, texel);
    resident |= sparseImageLoadARB(ui3D, ic3, utexel);

    outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
}