Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/swgl-19ea748e17a3c52a/out/composite_TEXTURE_RECT.h
Warning:line 93, column 16
Value stored to 'texture_size' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name gl.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -fapprox-func -funsafe-math-optimizations -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -fno-rounding-math -mrecip=none -complex-range=basic -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/gfx/wr/swgl -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/root/firefox-clang/gfx/wr/swgl -resource-dir /usr/lib/llvm-21/lib/clang/21 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /root/firefox-clang/gfx/wr/swgl/../webrender/res -I src -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/swgl-19ea748e17a3c52a/out -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D _GLIBCXX_ASSERTIONS -D DEBUG=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -D MOZILLA_CONFIG_H -U MOZILLA_CONFIG_H -D _GLIBCXX_USE_CXX11_ABI=0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-21/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-deprecated-this-capture -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -std=c++17 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2025-06-27-100320-3286336-1 -x c++ src/gl.cc
1struct composite_TEXTURE_RECT_common {
2struct Samplers {
3 sampler2DRect_impl sColor0_impl;
4 int sColor0_slot;
5 bool set_slot(int index, int value) {
6 switch (index) {
7 case 2:
8 sColor0_slot = value;
9 return true;
10 }
11 return false;
12 }
13} samplers;
14struct AttribLocations {
15 int aPosition = NULL_ATTRIB16;
16 int aDeviceRect = NULL_ATTRIB16;
17 int aDeviceClipRect = NULL_ATTRIB16;
18 int aColor = NULL_ATTRIB16;
19 int aParams = NULL_ATTRIB16;
20 int aFlip = NULL_ATTRIB16;
21 int aDeviceRoundedClipRect = NULL_ATTRIB16;
22 int aDeviceRoundedClipRadii = NULL_ATTRIB16;
23 int aUvRect0 = NULL_ATTRIB16;
24 void bind_loc(const char* name, int index) {
25 if (strcmp("aPosition", name) == 0) { aPosition = index; return; }
26 if (strcmp("aDeviceRect", name) == 0) { aDeviceRect = index; return; }
27 if (strcmp("aDeviceClipRect", name) == 0) { aDeviceClipRect = index; return; }
28 if (strcmp("aColor", name) == 0) { aColor = index; return; }
29 if (strcmp("aParams", name) == 0) { aParams = index; return; }
30 if (strcmp("aFlip", name) == 0) { aFlip = index; return; }
31 if (strcmp("aDeviceRoundedClipRect", name) == 0) { aDeviceRoundedClipRect = index; return; }
32 if (strcmp("aDeviceRoundedClipRadii", name) == 0) { aDeviceRoundedClipRadii = index; return; }
33 if (strcmp("aUvRect0", name) == 0) { aUvRect0 = index; return; }
34 }
35 int get_loc(const char* name) const {
36 if (strcmp("aPosition", name) == 0) { return aPosition != NULL_ATTRIB16 ? aPosition : -1; }
37 if (strcmp("aDeviceRect", name) == 0) { return aDeviceRect != NULL_ATTRIB16 ? aDeviceRect : -1; }
38 if (strcmp("aDeviceClipRect", name) == 0) { return aDeviceClipRect != NULL_ATTRIB16 ? aDeviceClipRect : -1; }
39 if (strcmp("aColor", name) == 0) { return aColor != NULL_ATTRIB16 ? aColor : -1; }
40 if (strcmp("aParams", name) == 0) { return aParams != NULL_ATTRIB16 ? aParams : -1; }
41 if (strcmp("aFlip", name) == 0) { return aFlip != NULL_ATTRIB16 ? aFlip : -1; }
42 if (strcmp("aDeviceRoundedClipRect", name) == 0) { return aDeviceRoundedClipRect != NULL_ATTRIB16 ? aDeviceRoundedClipRect : -1; }
43 if (strcmp("aDeviceRoundedClipRadii", name) == 0) { return aDeviceRoundedClipRadii != NULL_ATTRIB16 ? aDeviceRoundedClipRadii : -1; }
44 if (strcmp("aUvRect0", name) == 0) { return aUvRect0 != NULL_ATTRIB16 ? aUvRect0 : -1; }
45 return -1;
46 }
47} attrib_locations;
48vec2_scalar vRoundedClipParams;
49vec4_scalar vRoundedClipRadii;
50vec4_scalar vColor;
51vec4_scalar vUVBounds;
52sampler2DRect sColor0;
53mat4_scalar uTransform;
54void bind_textures() {
55 sColor0 = lookup_sampler(&samplers.sColor0_impl, samplers.sColor0_slot);
56}
57};
58struct composite_TEXTURE_RECT_vert : VertexShaderImpl, composite_TEXTURE_RECT_common {
59private:
60typedef composite_TEXTURE_RECT_vert Self;
61// mat4_scalar uTransform;
62vec2 aPosition;
63// sampler2DRect sColor0;
64// sampler2DRect sColor1;
65// sampler2DRect sColor2;
66vec2 vNormalizedWorldPos;
67// vec2_scalar vRoundedClipParams;
68// vec4_scalar vRoundedClipRadii;
69vec2 vUv;
70// vec4_scalar vColor;
71// vec4_scalar vUVBounds;
72vec4_scalar aDeviceRect;
73vec4_scalar aDeviceClipRect;
74vec4_scalar aColor;
75vec4_scalar aParams;
76vec2_scalar aFlip;
77vec4_scalar aDeviceRoundedClipRect;
78vec4_scalar aDeviceRoundedClipRadii;
79vec4_scalar aUvRect0;
80ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
81 vec4_scalar device_rect = mix((aDeviceRect).sel(X,Y,Z,W), (aDeviceRect).sel(Z,W,X,Y), (aFlip).sel(X,Y,X,Y));
82 vec2 world_pos = mix((device_rect).sel(X,Y), (device_rect).sel(Z,W), (aPosition).sel(X,Y));
83 vec2 clipped_world_pos = clamp(world_pos, (aDeviceClipRect).sel(X,Y), (aDeviceClipRect).sel(Z,W));
84 vec2_scalar half_clip_box_size = (0.5f)*(((aDeviceRoundedClipRect).sel(Z,W))-((aDeviceRoundedClipRect).sel(X,Y)));
85 vNormalizedWorldPos = (((aDeviceRoundedClipRect).sel(X,Y))+(half_clip_box_size))-(clipped_world_pos);
86 vRoundedClipParams = half_clip_box_size;
87 vRoundedClipRadii = aDeviceRoundedClipRadii;
88 vec2 uv = ((clipped_world_pos)-((device_rect).sel(X,Y)))/(((device_rect).sel(Z,W))-((device_rect).sel(X,Y)));
89 uv = mix((aUvRect0).sel(X,Y), (aUvRect0).sel(Z,W), uv);
90 vec4_scalar uvBounds = make_vec4(min((aUvRect0).sel(X,Y), (aUvRect0).sel(Z,W)), max((aUvRect0).sel(X,Y), (aUvRect0).sel(Z,W)));
91 if ((make_int((aParams).y))==(1)) {
92 {
93 vec2_scalar texture_size = make_vec2(1.f, 1.f);
Value stored to 'texture_size' during its initialization is never read
94 uvBounds += make_vec4(0.5f, 0.5f, -(0.5f), -(0.5f));
95 }
96 }
97 vUv = uv;
98 vUVBounds = uvBounds;
99 vColor = aColor;
100 gl_Position = (uTransform)*(make_vec4(clipped_world_pos, 0.f, 1.f));
101}
102static void set_uniform_1i(VertexShaderImpl* impl, int index, int value) {
103 Self* self = (Self*)impl;
104 if (self->samplers.set_slot(index, value)) return;
105 switch (index) {
106 case 2:
107 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
108 break;
109 case 1:
110 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
111 break;
112 }
113}
114static void set_uniform_4fv(VertexShaderImpl* impl, int index, const float *value) {
115 Self* self = (Self*)impl;
116 switch (index) {
117 case 2:
118 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
119 break;
120 case 1:
121 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
122 break;
123 }
124}
125static void set_uniform_matrix4fv(VertexShaderImpl* impl, int index, const float *value) {
126 Self* self = (Self*)impl;
127 switch (index) {
128 case 2:
129 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
130 break;
131 case 1:
132 self->uTransform = mat4_scalar::load_from_ptr(value);
133 break;
134 }
135}
136static void load_attribs(VertexShaderImpl* impl, VertexAttrib *attribs, uint32_t start, int instance, int count) {Self* self = (Self*)impl;
137 load_attrib(self->aPosition, attribs[self->attrib_locations.aPosition], start, instance, count);
138 load_flat_attrib(self->aDeviceRect, attribs[self->attrib_locations.aDeviceRect], start, instance, count);
139 load_flat_attrib(self->aDeviceClipRect, attribs[self->attrib_locations.aDeviceClipRect], start, instance, count);
140 load_flat_attrib(self->aColor, attribs[self->attrib_locations.aColor], start, instance, count);
141 load_flat_attrib(self->aParams, attribs[self->attrib_locations.aParams], start, instance, count);
142 load_flat_attrib(self->aFlip, attribs[self->attrib_locations.aFlip], start, instance, count);
143 load_flat_attrib(self->aDeviceRoundedClipRect, attribs[self->attrib_locations.aDeviceRoundedClipRect], start, instance, count);
144 load_flat_attrib(self->aDeviceRoundedClipRadii, attribs[self->attrib_locations.aDeviceRoundedClipRadii], start, instance, count);
145 load_flat_attrib(self->aUvRect0, attribs[self->attrib_locations.aUvRect0], start, instance, count);
146}
147public:
148struct InterpOutputs {
149vec2_scalar vNormalizedWorldPos;
150vec2_scalar vUv;
151};
152private:
153ALWAYS_INLINE__attribute__((always_inline)) inline void store_interp_outputs(char* dest_ptr, size_t stride) {
154 for(int n = 0; n < 4; n++) {
155 auto* dest = reinterpret_cast<InterpOutputs*>(dest_ptr);
156 dest->vNormalizedWorldPos = get_nth(vNormalizedWorldPos, n);
157 dest->vUv = get_nth(vUv, n);
158 dest_ptr += stride;
159 }
160}
161static void run(VertexShaderImpl* impl, char* interps, size_t interp_stride) {
162 Self* self = (Self*)impl;
163 self->main();
164 self->store_interp_outputs(interps, interp_stride);
165}
166static void init_batch(VertexShaderImpl* impl) {
167 Self* self = (Self*)impl; self->bind_textures(); }
168public:
169composite_TEXTURE_RECT_vert() {
170 set_uniform_1i_func = &set_uniform_1i;
171 set_uniform_4fv_func = &set_uniform_4fv;
172 set_uniform_matrix4fv_func = &set_uniform_matrix4fv;
173 init_batch_func = &init_batch;
174 load_attribs_func = &load_attribs;
175 run_primitive_func = &run;
176}
177};
178
179
180struct composite_TEXTURE_RECT_frag : FragmentShaderImpl, composite_TEXTURE_RECT_vert {
181private:
182typedef composite_TEXTURE_RECT_frag Self;
183#define oFragColorgl_FragColor gl_FragColor
184// vec4 oFragColor;
185// sampler2DRect sColor0;
186// sampler2DRect sColor1;
187// sampler2DRect sColor2;
188vec2 vNormalizedWorldPos;
189// vec2_scalar vRoundedClipParams;
190// vec4_scalar vRoundedClipRadii;
191vec2 vUv;
192// vec4_scalar vColor;
193// vec4_scalar vUVBounds;
194float compute_aa_range(vec2 position) {
195 return recip((fwidth(position)).x);
196}
197Float sd_round_box(vec2 pos, vec2_scalar half_box_size, vec4 radii) {
198 (radii).lsel(X,Y) = if_then_else(((pos).x)>(0.f), (radii).sel(X,Y), (radii).sel(Z,W));
199 (radii).x = if_then_else(((pos).y)>(0.f), (radii).x, (radii).y);
200 vec2 q = ((abs__glsl_abs(pos))-(half_box_size))+((radii).x);
201 return ((min(max((q).x, (q).y), 0.f))+(length(max(q, 0.f))))-((radii).x);
202}
203Float distance_aa(float aa_range, Float signed_distance) {
204 Float dist = (signed_distance)*(aa_range);
205 return clamp((0.5f)-(dist), 0.f, 1.f);
206}
207void write_output(vec4 color) {
208 oFragColorgl_FragColor = color;
209}
210ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
211 vec2 uv = clamp(vUv, (vUVBounds).sel(X,Y), (vUVBounds).sel(Z,W));
212 vec4 texel = texture(sColor0, (uv).sel(X,Y));
213 vec4 color = (vColor)*(texel);
214 float aa_range = compute_aa_range(vNormalizedWorldPos);
215 Float dist = sd_round_box(vNormalizedWorldPos, vRoundedClipParams, vRoundedClipRadii);
216 Float clip_alpha = distance_aa(aa_range, dist);
217 color *= clip_alpha;
218 write_output(color);
219}
220void swgl_drawSpanRGBA8() {
221 if (any(greaterThan(vRoundedClipRadii, make_vec4(0.f)))) {
222 {
223 return;
224 }
225 }
226 vec4_scalar color = vColor;
227 vec4_scalar uvBounds = vUVBounds;
228 if ((color)!=(make_vec4(1.f))) {
229 {
230 swgl_commitTextureColorRGBA8(sColor0, vUv, uvBounds, color)do { if (sColor0->filter == TextureFilter::LINEAR) { do { auto
packed_color = packColor(swgl_OutRGBA8, color); int len = (swgl_SpanLength
); int drawn = 0; if (LinearFilter filter = needsTextureLinear
(sColor0, vUv, len)) { if (blend_key) { drawn = blendTextureLinear
<true>(sColor0, vUv, len, uvBounds, packed_color, swgl_OutRGBA8
, filter); } else { drawn = blendTextureLinear<false>(sColor0
, vUv, len, uvBounds, packed_color, swgl_OutRGBA8, filter); }
} else if (blend_key) { drawn = blendTextureNearestFast<true
>(sColor0, vUv, len, uvBounds, packed_color, swgl_OutRGBA8
); } else { drawn = blendTextureNearestFast<false>(sColor0
, vUv, len, uvBounds, packed_color, swgl_OutRGBA8); } swgl_OutRGBA8
+= drawn; swgl_SpanLength -= drawn; } while (0); } else { do
{ auto packed_color = packColor(swgl_OutRGBA8, color); int drawn
= 0; if (needsNearestFallback(sColor0, vUv, swgl_SpanLength)
) { if (blend_key) { drawn = blendTextureNearestRepeat<true
, false>( sColor0, vUv, swgl_SpanLength, 0.0f, uvBounds, packed_color
, swgl_OutRGBA8); } else { drawn = blendTextureNearestRepeat<
false, false>( sColor0, vUv, swgl_SpanLength, 0.0f, uvBounds
, packed_color, swgl_OutRGBA8); } } else if (blend_key) { drawn
= blendTextureNearestFast<true>(sColor0, vUv, swgl_SpanLength
, uvBounds, packed_color, swgl_OutRGBA8); } else { drawn = blendTextureNearestFast
<false>(sColor0, vUv, swgl_SpanLength, uvBounds, packed_color
, swgl_OutRGBA8); } swgl_OutRGBA8 += drawn; swgl_SpanLength -=
drawn; } while (0); } } while (0)
;
231 }
232 } else {
233 swgl_commitTextureRGBA8(sColor0, vUv, uvBounds)do { if (sColor0->filter == TextureFilter::LINEAR) { do { auto
packed_color = packColor(swgl_OutRGBA8, NoColor()); int len =
(swgl_SpanLength); int drawn = 0; if (LinearFilter filter = needsTextureLinear
(sColor0, vUv, len)) { if (blend_key) { drawn = blendTextureLinear
<true>(sColor0, vUv, len, uvBounds, packed_color, swgl_OutRGBA8
, filter); } else { drawn = blendTextureLinear<false>(sColor0
, vUv, len, uvBounds, packed_color, swgl_OutRGBA8, filter); }
} else if (blend_key) { drawn = blendTextureNearestFast<true
>(sColor0, vUv, len, uvBounds, packed_color, swgl_OutRGBA8
); } else { drawn = blendTextureNearestFast<false>(sColor0
, vUv, len, uvBounds, packed_color, swgl_OutRGBA8); } swgl_OutRGBA8
+= drawn; swgl_SpanLength -= drawn; } while (0); } else { do
{ auto packed_color = packColor(swgl_OutRGBA8, NoColor()); int
drawn = 0; if (needsNearestFallback(sColor0, vUv, swgl_SpanLength
)) { if (blend_key) { drawn = blendTextureNearestRepeat<true
, false>( sColor0, vUv, swgl_SpanLength, 0.0f, uvBounds, packed_color
, swgl_OutRGBA8); } else { drawn = blendTextureNearestRepeat<
false, false>( sColor0, vUv, swgl_SpanLength, 0.0f, uvBounds
, packed_color, swgl_OutRGBA8); } } else if (blend_key) { drawn
= blendTextureNearestFast<true>(sColor0, vUv, swgl_SpanLength
, uvBounds, packed_color, swgl_OutRGBA8); } else { drawn = blendTextureNearestFast
<false>(sColor0, vUv, swgl_SpanLength, uvBounds, packed_color
, swgl_OutRGBA8); } swgl_OutRGBA8 += drawn; swgl_SpanLength -=
drawn; } while (0); } } while (0)
;
234 }
235}
236typedef composite_TEXTURE_RECT_vert::InterpOutputs InterpInputs;
237InterpInputs interp_step;
238struct InterpPerspective {
239vec2 vNormalizedWorldPos;
240vec2 vUv;
241};
242InterpPerspective interp_perspective;
243static void read_interp_inputs(FragmentShaderImpl* impl, const void* init_, const void* step_) {Self* self = (Self*)impl;const InterpInputs* init = (const InterpInputs*)init_;const InterpInputs* step = (const InterpInputs*)step_;
244 self->vNormalizedWorldPos = init_interp(init->vNormalizedWorldPos, step->vNormalizedWorldPos);
245 self->interp_step.vNormalizedWorldPos = step->vNormalizedWorldPos * 4.0f;
246 self->vUv = init_interp(init->vUv, step->vUv);
247 self->interp_step.vUv = step->vUv * 4.0f;
248}
249static void read_perspective_inputs(FragmentShaderImpl* impl, const void* init_, const void* step_) {Self* self = (Self*)impl;const InterpInputs* init = (const InterpInputs*)init_;const InterpInputs* step = (const InterpInputs*)step_;
250 Float w = 1.0f / self->gl_FragCoord.w;
251 self->interp_perspective.vNormalizedWorldPos = init_interp(init->vNormalizedWorldPos, step->vNormalizedWorldPos);
252 self->vNormalizedWorldPos = self->interp_perspective.vNormalizedWorldPos * w;
253 self->interp_step.vNormalizedWorldPos = step->vNormalizedWorldPos * 4.0f;
254 self->interp_perspective.vUv = init_interp(init->vUv, step->vUv);
255 self->vUv = self->interp_perspective.vUv * w;
256 self->interp_step.vUv = step->vUv * 4.0f;
257}
258ALWAYS_INLINE__attribute__((always_inline)) inline void step_interp_inputs(int steps = 4) {
259 float chunks = steps * 0.25f;
260 vNormalizedWorldPos += interp_step.vNormalizedWorldPos * chunks;
261 vUv += interp_step.vUv * chunks;
262}
263ALWAYS_INLINE__attribute__((always_inline)) inline void step_perspective_inputs(int steps = 4) {
264 step_perspective(steps);
265 float chunks = steps * 0.25f;
266 Float w = 1.0f / gl_FragCoord.w;
267 interp_perspective.vNormalizedWorldPos += interp_step.vNormalizedWorldPos * chunks;
268 vNormalizedWorldPos = w * interp_perspective.vNormalizedWorldPos;
269 interp_perspective.vUv += interp_step.vUv * chunks;
270 vUv = w * interp_perspective.vUv;
271}
272static void run(FragmentShaderImpl* impl) {
273 Self* self = (Self*)impl;
274 self->main();
275 self->step_interp_inputs();
276}
277static void skip(FragmentShaderImpl* impl, int steps) {
278 Self* self = (Self*)impl;
279 self->step_interp_inputs(steps);
280}
281static void run_perspective(FragmentShaderImpl* impl) {
282 Self* self = (Self*)impl;
283 self->main();
284 self->step_perspective_inputs();
285}
286static void skip_perspective(FragmentShaderImpl* impl, int steps) {
287 Self* self = (Self*)impl;
288 self->step_perspective_inputs(steps);
289}
290static int draw_span_RGBA8(FragmentShaderImpl* impl) {
291 Self* self = (Self*)impl; DISPATCH_DRAW_SPAN(self, RGBA8)do { int total = self->swgl_SpanLength; self->swgl_drawSpanRGBA8
(); int drawn = total - self->swgl_SpanLength; if (drawn) self
->step_interp_inputs(drawn); return drawn; } while (0)
; }
292public:
293composite_TEXTURE_RECT_frag() {
294 init_span_func = &read_interp_inputs;
295 run_func = &run;
296 skip_func = &skip;
297 draw_span_RGBA8_func = &draw_span_RGBA8;
298 enable_perspective();
299 init_span_w_func = &read_perspective_inputs;
300 run_w_func = &run_perspective;
301 skip_w_func = &skip_perspective;
302}
303};
304
305struct composite_TEXTURE_RECT_program : ProgramImpl, composite_TEXTURE_RECT_frag {
306int get_uniform(const char *name) const override {
307 if (strcmp("sColor0", name) == 0) { return 2; }
308 if (strcmp("uTransform", name) == 0) { return 1; }
309 return -1;
310}
311void bind_attrib(const char* name, int index) override {
312 attrib_locations.bind_loc(name, index);
313}
314int get_attrib(const char* name) const override {
315 return attrib_locations.get_loc(name);
316}
317size_t interpolants_size() const override { return sizeof(InterpOutputs); }
318VertexShaderImpl* get_vertex_shader() override {
319 return this;
320}
321FragmentShaderImpl* get_fragment_shader() override {
322 return this;
323}
324const char* get_name() const override { return "composite_TEXTURE_RECT"; }
325static ProgramImpl* loader() { return new composite_TEXTURE_RECT_program; }
326};
327