1#version 450
2
3#extension GL_NV_shader_texture_footprint : require
4
5
6layout (location = 0) in vec2 P2;
7layout (location = 2) in vec3 P3;
8layout (location = 3) in flat int granularity;
9layout (location = 4) in float lodClamp;
10layout (location = 5) in float lod;
11layout (location = 6) in vec2 dx;
12layout (location = 8) in vec2 dy;
13layout (location = 9) in float bias;
14
15uniform sampler2D sample2D;
16uniform sampler3D sample3D;
17
18buffer result2D {
19    bool ret2D;
20    uvec2 anchor2D;
21    uvec2 offset2D;
22    uvec2 mask2D;
23    uint lod2D;
24    uint granularity2D;
25};
26
27buffer result3D {
28    bool ret3D;
29    uvec3 anchor3D;
30    uvec3 offset3D;
31    uvec2 mask3D;
32    uint lod3D;
33    uint granularity3D;
34};
35
36void main() {
37 gl_TextureFootprint2DNV fp2D;
38 gl_TextureFootprint3DNV fp3D;
39
40 ret2D = textureFootprintNV(sample2D, P2, granularity, true, fp2D);
41 anchor2D = fp2D.anchor;
42 offset2D = fp2D.offset;
43 mask2D = fp2D.mask;
44 lod2D = fp2D.lod;
45 granularity2D = fp2D.granularity;
46
47 ret2D = textureFootprintNV(sample2D, P2, granularity, true, fp2D, bias);
48 anchor2D += fp2D.anchor;
49 offset2D += fp2D.offset;
50 mask2D += fp2D.mask;
51 lod2D += fp2D.lod;
52 granularity2D += fp2D.granularity;
53
54 ret2D = textureFootprintClampNV(sample2D, P2, lodClamp, granularity, true, fp2D);
55 anchor2D += fp2D.anchor;
56 offset2D += fp2D.offset;
57 mask2D += fp2D.mask;
58 lod2D += fp2D.lod;
59 granularity2D += fp2D.granularity;
60
61 ret2D = textureFootprintClampNV(sample2D, P2, lodClamp, granularity, true, fp2D, bias);
62 anchor2D += fp2D.anchor;
63 offset2D += fp2D.offset;
64 mask2D += fp2D.mask;
65 lod2D += fp2D.lod;
66 granularity2D += fp2D.granularity;
67
68 ret2D = textureFootprintLodNV(sample2D, P2, lod, granularity, true, fp2D);
69 anchor2D += fp2D.anchor;
70 offset2D += fp2D.offset;
71 mask2D += fp2D.mask;
72 lod2D += fp2D.lod;
73 granularity2D += fp2D.granularity;
74
75 ret2D = textureFootprintGradNV(sample2D, P2, dx, dy, granularity, true, fp2D);
76 anchor2D += fp2D.anchor;
77 offset2D += fp2D.offset;
78 mask2D += fp2D.mask;
79 lod2D += fp2D.lod;
80 granularity2D += fp2D.granularity;
81
82 ret2D = textureFootprintGradClampNV(sample2D, P2, dx, dy, lodClamp, granularity, true, fp2D);
83 anchor2D += fp2D.anchor;
84 offset2D += fp2D.offset;
85 mask2D += fp2D.mask;
86 lod2D += fp2D.lod;
87 granularity2D += fp2D.granularity;
88
89 ret3D = textureFootprintNV(sample3D, P3, granularity, true, fp3D);
90 anchor3D = fp3D.anchor;
91 offset3D = fp3D.offset;
92 mask3D = fp3D.mask;
93 lod3D = fp3D.lod;
94 granularity3D = fp3D.granularity;
95
96 ret3D = textureFootprintNV(sample3D, P3, granularity, true, fp3D, bias);
97 anchor3D += fp3D.anchor;
98 offset3D += fp3D.offset;
99 mask3D += fp3D.mask;
100 lod3D += fp3D.lod;
101 granularity3D += fp3D.granularity;
102
103 ret3D = textureFootprintClampNV(sample3D, P3, lodClamp, granularity, true, fp3D);
104 anchor3D += fp3D.anchor;
105 offset3D += fp3D.offset;
106 mask3D += fp3D.mask;
107 lod3D += fp3D.lod;
108 granularity3D += fp3D.granularity;
109
110 ret3D = textureFootprintClampNV(sample3D, P3, lodClamp, granularity, true, fp3D, bias);
111 anchor3D += fp3D.anchor;
112 offset3D += fp3D.offset;
113 mask3D += fp3D.mask;
114 lod3D += fp3D.lod;
115 granularity3D += fp3D.granularity;
116
117 ret3D = textureFootprintLodNV(sample3D, P3, lod, granularity, true, fp3D);
118 anchor3D += fp3D.anchor;
119 offset3D += fp3D.offset;
120 mask3D += fp3D.mask;
121 lod3D += fp3D.lod;
122 granularity3D += fp3D.granularity;
123}