Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/swgl-632c403fa1e5c7af/out/ps_path_tile_PATH_SSAA8.h
Warning:line 264, column 14
Value stored to 'texel1' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -O2 -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=off -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-23/lib/clang/23 -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-632c403fa1e5c7af/out -D _GLIBCXX_USE_CXX11_ABI=0 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -D _GLIBCXX_ASSERTIONS=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -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 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -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-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 -Wno-character-conversion -std=gnu++20 -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 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-11-12-001017-1011516-1 -x c++ src/gl.cc
1struct ps_path_tile_PATH_SSAA8_common {
2struct Samplers {
3 sampler2D_impl sGpuBufferF_impl;
4 int sGpuBufferF_slot;
5 isampler2D_impl sGpuBufferI_impl;
6 int sGpuBufferI_slot;
7 sampler2D_impl sPathEdges_impl;
8 int sPathEdges_slot;
9 sampler2D_impl sRenderTasks_impl;
10 int sRenderTasks_slot;
11 bool set_slot(int index, int value) {
12 switch (index) {
13 case 2:
14 sGpuBufferF_slot = value;
15 return true;
16 case 3:
17 sGpuBufferI_slot = value;
18 return true;
19 case 5:
20 sPathEdges_slot = value;
21 return true;
22 case 1:
23 sRenderTasks_slot = value;
24 return true;
25 }
26 return false;
27 }
28} samplers;
29struct AttribLocations {
30 int aPosition = NULL_ATTRIB16;
31 int aData = NULL_ATTRIB16;
32 void bind_loc(const char* name, int index) {
33 if (strcmp("aPosition", name) == 0) { aPosition = index; return; }
34 if (strcmp("aData", name) == 0) { aData = index; return; }
35 }
36 int get_loc(const char* name) const {
37 if (strcmp("aPosition", name) == 0) { return aPosition != NULL_ATTRIB16 ? aPosition : -1; }
38 if (strcmp("aData", name) == 0) { return aData != NULL_ATTRIB16 ? aData : -1; }
39 return -1;
40 }
41} attrib_locations;
42ivec4_scalar vTileData;
43vec4_scalar vColor;
44sampler2D sGpuBufferF;
45isampler2D sGpuBufferI;
46sampler2D sPathEdges;
47sampler2D sRenderTasks;
48mat4_scalar uTransform;
49void bind_textures() {
50 sGpuBufferF = lookup_sampler(&samplers.sGpuBufferF_impl, samplers.sGpuBufferF_slot);
51 sGpuBufferI = lookup_isampler(&samplers.sGpuBufferI_impl, samplers.sGpuBufferI_slot);
52 sPathEdges = lookup_sampler(&samplers.sPathEdges_impl, samplers.sPathEdges_slot);
53 sRenderTasks = lookup_sampler(&samplers.sRenderTasks_impl, samplers.sRenderTasks_slot);
54}
55};
56struct ps_path_tile_PATH_SSAA8_vert : VertexShaderImpl, ps_path_tile_PATH_SSAA8_common {
57private:
58typedef ps_path_tile_PATH_SSAA8_vert Self;
59// mat4_scalar uTransform;
60vec2 aPosition;
61struct RectWithSize_scalar {
62vec2_scalar p0;
63vec2_scalar size;
64RectWithSize_scalar() = default;
65RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){}
66};
67struct RectWithSize {
68vec2 p0;
69vec2 size;
70RectWithSize() = default;
71RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){}
72RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){
73}
74IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){
75}
76friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize(
77if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size));
78}};
79struct RectWithEndpoint_scalar {
80vec2_scalar p0;
81vec2_scalar p1;
82RectWithEndpoint_scalar() = default;
83RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){}
84};
85struct RectWithEndpoint {
86vec2 p0;
87vec2 p1;
88RectWithEndpoint() = default;
89RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){}
90RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){
91}
92IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){
93}
94friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint(
95if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1));
96}};
97// sampler2D sRenderTasks;
98struct RenderTaskData_scalar {
99RectWithEndpoint_scalar task_rect;
100vec4_scalar user_data;
101RenderTaskData_scalar() = default;
102RenderTaskData_scalar(RectWithEndpoint_scalar task_rect, vec4_scalar user_data) : task_rect(task_rect), user_data(user_data){}
103};
104struct RenderTaskData {
105RectWithEndpoint task_rect;
106vec4 user_data;
107RenderTaskData() = default;
108RenderTaskData(RectWithEndpoint task_rect, vec4 user_data) : task_rect(task_rect), user_data(user_data){}
109RenderTaskData(RectWithEndpoint_scalar task_rect, vec4_scalar user_data):task_rect(task_rect),user_data(user_data){
110}
111IMPLICIT RenderTaskData(RenderTaskData_scalar s):task_rect(s.task_rect),user_data(s.user_data){
112}
113friend RenderTaskData if_then_else(I32 c, RenderTaskData t, RenderTaskData e) { return RenderTaskData(
114if_then_else(c, t.task_rect, e.task_rect), if_then_else(c, t.user_data, e.user_data));
115}};
116struct PictureTask_scalar {
117RectWithEndpoint_scalar task_rect;
118float device_pixel_scale;
119vec2_scalar content_origin;
120PictureTask_scalar() = default;
121PictureTask_scalar(RectWithEndpoint_scalar task_rect, float device_pixel_scale, vec2_scalar content_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), content_origin(content_origin){}
122};
123struct PictureTask {
124RectWithEndpoint task_rect;
125Float device_pixel_scale;
126vec2 content_origin;
127PictureTask() = default;
128PictureTask(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 content_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), content_origin(content_origin){}
129PictureTask(RectWithEndpoint_scalar task_rect, float device_pixel_scale, vec2_scalar content_origin):task_rect(task_rect),device_pixel_scale(device_pixel_scale),content_origin(content_origin){
130}
131IMPLICIT PictureTask(PictureTask_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),content_origin(s.content_origin){
132}
133friend PictureTask if_then_else(I32 c, PictureTask t, PictureTask e) { return PictureTask(
134if_then_else(c, t.task_rect, e.task_rect), if_then_else(c, t.device_pixel_scale, e.device_pixel_scale), if_then_else(c, t.content_origin, e.content_origin));
135}};
136struct ClipArea_scalar {
137RectWithEndpoint_scalar task_rect;
138float device_pixel_scale;
139vec2_scalar screen_origin;
140ClipArea_scalar() = default;
141ClipArea_scalar(RectWithEndpoint_scalar task_rect, float device_pixel_scale, vec2_scalar screen_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), screen_origin(screen_origin){}
142};
143struct ClipArea {
144RectWithEndpoint task_rect;
145Float device_pixel_scale;
146vec2 screen_origin;
147ClipArea() = default;
148ClipArea(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 screen_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), screen_origin(screen_origin){}
149ClipArea(RectWithEndpoint_scalar task_rect, float device_pixel_scale, vec2_scalar screen_origin):task_rect(task_rect),device_pixel_scale(device_pixel_scale),screen_origin(screen_origin){
150}
151IMPLICIT ClipArea(ClipArea_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),screen_origin(s.screen_origin){
152}
153friend ClipArea if_then_else(I32 c, ClipArea t, ClipArea e) { return ClipArea(
154if_then_else(c, t.task_rect, e.task_rect), if_then_else(c, t.device_pixel_scale, e.device_pixel_scale), if_then_else(c, t.screen_origin, e.screen_origin));
155}};
156// sampler2D sGpuBufferF;
157// isampler2D sGpuBufferI;
158// sampler2D sPathEdges;
159struct PathTile_scalar {
160vec4_scalar rect;
161ivec2_scalar edges;
162int32_t backdrop;
163int32_t path_address;
164PathTile_scalar() = default;
165PathTile_scalar(vec4_scalar rect, ivec2_scalar edges, int32_t backdrop, int32_t path_address) : rect(rect), edges(edges), backdrop(backdrop), path_address(path_address){}
166};
167struct PathTile {
168vec4 rect;
169ivec2 edges;
170I32 backdrop;
171I32 path_address;
172PathTile() = default;
173PathTile(vec4 rect, ivec2 edges, I32 backdrop, I32 path_address) : rect(rect), edges(edges), backdrop(backdrop), path_address(path_address){}
174PathTile(vec4_scalar rect, ivec2_scalar edges, int32_t backdrop, int32_t path_address):rect(rect),edges(edges),backdrop(backdrop),path_address(path_address){
175}
176IMPLICIT PathTile(PathTile_scalar s):rect(s.rect),edges(s.edges),backdrop(s.backdrop),path_address(s.path_address){
177}
178friend PathTile if_then_else(I32 c, PathTile t, PathTile e) { return PathTile(
179if_then_else(c, t.rect, e.rect), if_then_else(c, t.edges, e.edges), if_then_else(c, t.backdrop, e.backdrop), if_then_else(c, t.path_address, e.path_address));
180}};
181struct PathInfo_scalar {
182int32_t render_task_address;
183int32_t fill_rule;
184float opacity;
185PathInfo_scalar() = default;
186PathInfo_scalar(int32_t render_task_address, int32_t fill_rule, float opacity) : render_task_address(render_task_address), fill_rule(fill_rule), opacity(opacity){}
187};
188struct PathInfo {
189I32 render_task_address;
190I32 fill_rule;
191Float opacity;
192PathInfo() = default;
193PathInfo(I32 render_task_address, I32 fill_rule, Float opacity) : render_task_address(render_task_address), fill_rule(fill_rule), opacity(opacity){}
194PathInfo(int32_t render_task_address, int32_t fill_rule, float opacity):render_task_address(render_task_address),fill_rule(fill_rule),opacity(opacity){
195}
196IMPLICIT PathInfo(PathInfo_scalar s):render_task_address(s.render_task_address),fill_rule(s.fill_rule),opacity(s.opacity){
197}
198friend PathInfo if_then_else(I32 c, PathInfo t, PathInfo e) { return PathInfo(
199if_then_else(c, t.render_task_address, e.render_task_address), if_then_else(c, t.fill_rule, e.fill_rule), if_then_else(c, t.opacity, e.opacity));
200}};
201struct PathPrimInfo_scalar {
202int32_t z_id;
203vec4_scalar color;
204vec4_scalar scissor;
205PathPrimInfo_scalar() = default;
206PathPrimInfo_scalar(int32_t z_id, vec4_scalar color, vec4_scalar scissor) : z_id(z_id), color(color), scissor(scissor){}
207};
208struct PathPrimInfo {
209I32 z_id;
210vec4 color;
211vec4 scissor;
212PathPrimInfo() = default;
213PathPrimInfo(I32 z_id, vec4 color, vec4 scissor) : z_id(z_id), color(color), scissor(scissor){}
214PathPrimInfo(int32_t z_id, vec4_scalar color, vec4_scalar scissor):z_id(z_id),color(color),scissor(scissor){
215}
216IMPLICIT PathPrimInfo(PathPrimInfo_scalar s):z_id(s.z_id),color(s.color),scissor(s.scissor){
217}
218friend PathPrimInfo if_then_else(I32 c, PathPrimInfo t, PathPrimInfo e) { return PathPrimInfo(
219if_then_else(c, t.z_id, e.z_id), if_then_else(c, t.color, e.color), if_then_else(c, t.scissor, e.scissor));
220}};
221vec2 vUv;
222// ivec4_scalar vTileData;
223// vec4_scalar vColor;
224ivec4_scalar aData;
225PathTile_scalar decode_path_tile(ivec4_scalar data) {
226 PathTile_scalar tile;
227 vec2_scalar offset = make_vec2(make_float((((data).x)>>(10))&(1023)), make_float(((data).x)&(1023)));
228 float extend_x = make_float((((data).x)>>(20))&(1023));
229 (tile).rect = (make_vec4((offset).x, (offset).y, (((offset).x)+(1.f))+(extend_x), ((offset).y)+(1.f)))*(16.f);
230 int32_t edge_count = (((data).z)>>(16))&(65535);
231 (tile).edges = make_ivec2((data).y, ((data).y)+(edge_count));
232 (tile).backdrop = (((data).z)&(65535))-(128);
233 (tile).path_address = (data).w;
234 return tile;
235}
236ivec2_scalar get_gpu_buffer_uv(int32_t address) {
237 return make_ivec2((make_uint(address))%(1024u), (make_uint(address))/(1024u));
238}
239ivec4_scalar fetch_from_gpu_buffer_1i(int32_t address) {
240 ivec2_scalar uv = get_gpu_buffer_uv(address);
241 return texelFetch(sGpuBufferI, uv, 0);
242}
243PathInfo_scalar fetch_path_info(int32_t address) {
244 ivec4_scalar data = fetch_from_gpu_buffer_1i(address);
245 PathInfo_scalar path;
246 (path).render_task_address = (data).x;
247 (path).fill_rule = (data).y;
248 (path).opacity = (make_float((data).z))/(65535.f);
249 return path;
250}
251PathPrimInfo_scalar fetch_path_prim_info(int32_t address) {
252 ivec4_scalar data = fetch_from_gpu_buffer_1i((address)+(1));
253 ivec4_scalar scissor = fetch_from_gpu_buffer_1i((address)+(2));
254 PathPrimInfo_scalar prim;
255 (prim).z_id = (data).x;
256 (prim).color = (make_vec4(make_float((((data).y)>>(16))&(65535)), make_float(((data).y)&(65535)), make_float((((data).z)>>(16))&(65535)), make_float(((data).z)&(65535))))/(65535.f);
257 (prim).scissor = make_vec4(scissor);
258 return prim;
259}
260RectWithEndpoint_scalar fetch_render_task_rect(int32_t index) {
261 ivec2_scalar uv = make_ivec2(make_int((2u)*((make_uint(index))%((1024u)/(2u)))), make_int((make_uint(index))/((1024u)/(2u))));
262 auto sRenderTasks_uv_fetch = texelFetchPtr(sRenderTasks, uv, 0, 1, 0, 0);
263 vec4_scalar texel0 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 0, 0);
264 vec4_scalar texel1 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 1, 0);
Value stored to 'texel1' during its initialization is never read
265 RectWithEndpoint_scalar task_rect = RectWithEndpoint_scalar((texel0).sel(X,Y), (texel0).sel(Z,W));
266 return task_rect;
267}
268ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
269 PathTile_scalar tile = decode_path_tile(aData);
270 PathInfo_scalar path = fetch_path_info((tile).path_address);
271 PathPrimInfo_scalar prim = fetch_path_prim_info((tile).path_address);
272 RectWithEndpoint_scalar task_rect = fetch_render_task_rect((path).render_task_address);
273 vec2_scalar p0 = clamp(((tile).rect).sel(X,Y), ((prim).scissor).sel(X,Y), ((prim).scissor).sel(Z,W));
274 vec2_scalar p1 = clamp(((tile).rect).sel(Z,W), ((prim).scissor).sel(X,Y), ((prim).scissor).sel(Z,W));
275 vec2 pos = mix(p0, p1, (aPosition).sel(X,Y));
276 vUv = (pos)-(((tile).rect).sel(X,Y));
277 vTileData = make_ivec4((tile).edges, (tile).backdrop, (path).fill_rule);
278 vColor = (prim).color;
279 gl_Position = (uTransform)*(make_vec4(((task_rect).p0)+(pos), make_float((prim).z_id), 1.f));
280}
281static void set_uniform_1i(VertexShaderImpl* impl, int index, int value) {
282 Self* self = (Self*)impl;
283 if (self->samplers.set_slot(index, value)) return;
284 switch (index) {
285 case 2:
286 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferF
287 break;
288 case 3:
289 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferI
290 break;
291 case 5:
292 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPathEdges
293 break;
294 case 1:
295 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
296 break;
297 case 4:
298 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
299 break;
300 }
301}
302static void set_uniform_4fv(VertexShaderImpl* impl, int index, const float *value) {
303 Self* self = (Self*)impl;
304 switch (index) {
305 case 2:
306 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferF
307 break;
308 case 3:
309 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferI
310 break;
311 case 5:
312 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPathEdges
313 break;
314 case 1:
315 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
316 break;
317 case 4:
318 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
319 break;
320 }
321}
322static void set_uniform_matrix4fv(VertexShaderImpl* impl, int index, const float *value) {
323 Self* self = (Self*)impl;
324 switch (index) {
325 case 2:
326 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferF
327 break;
328 case 3:
329 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferI
330 break;
331 case 5:
332 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPathEdges
333 break;
334 case 1:
335 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
336 break;
337 case 4:
338 self->uTransform = mat4_scalar::load_from_ptr(value);
339 break;
340 }
341}
342static void load_attribs(VertexShaderImpl* impl, VertexAttrib *attribs, uint32_t start, int instance, int count) {Self* self = (Self*)impl;
343 load_attrib(self->aPosition, attribs[self->attrib_locations.aPosition], start, instance, count);
344 load_flat_attrib(self->aData, attribs[self->attrib_locations.aData], start, instance, count);
345}
346public:
347struct InterpOutputs {
348vec2_scalar vUv;
349};
350private:
351ALWAYS_INLINE__attribute__((always_inline)) inline void store_interp_outputs(char* dest_ptr, size_t stride) {
352 for(int n = 0; n < 4; n++) {
353 auto* dest = reinterpret_cast<InterpOutputs*>(dest_ptr);
354 dest->vUv = get_nth(vUv, n);
355 dest_ptr += stride;
356 }
357}
358static void run(VertexShaderImpl* impl, char* interps, size_t interp_stride) {
359 Self* self = (Self*)impl;
360 self->main();
361 self->store_interp_outputs(interps, interp_stride);
362}
363static void init_batch(VertexShaderImpl* impl) {
364 Self* self = (Self*)impl; self->bind_textures(); }
365public:
366ps_path_tile_PATH_SSAA8_vert() {
367 set_uniform_1i_func = &set_uniform_1i;
368 set_uniform_4fv_func = &set_uniform_4fv;
369 set_uniform_matrix4fv_func = &set_uniform_matrix4fv;
370 init_batch_func = &init_batch;
371 load_attribs_func = &load_attribs;
372 run_primitive_func = &run;
373}
374};
375
376
377struct ps_path_tile_PATH_SSAA8_frag : FragmentShaderImpl, ps_path_tile_PATH_SSAA8_vert {
378private:
379typedef ps_path_tile_PATH_SSAA8_frag Self;
380#define oFragColorgl_FragColor gl_FragColor
381// vec4 oFragColor;
382struct RectWithSize_scalar {
383vec2_scalar p0;
384vec2_scalar size;
385RectWithSize_scalar() = default;
386RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){}
387};
388struct RectWithSize {
389vec2 p0;
390vec2 size;
391RectWithSize() = default;
392RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){}
393RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){
394}
395IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){
396}
397friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize(
398if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size));
399}};
400struct RectWithEndpoint_scalar {
401vec2_scalar p0;
402vec2_scalar p1;
403RectWithEndpoint_scalar() = default;
404RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){}
405};
406struct RectWithEndpoint {
407vec2 p0;
408vec2 p1;
409RectWithEndpoint() = default;
410RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){}
411RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){
412}
413IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){
414}
415friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint(
416if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1));
417}};
418// sampler2D sGpuBufferF;
419// isampler2D sGpuBufferI;
420// sampler2D sPathEdges;
421vec2 vUv;
422// ivec4_scalar vTileData;
423// vec4_scalar vColor;
424Float ssaa_sample(vec2_scalar offset, vec2 edge, Float cross_at_origin, Float y_min, Float y_max, float winding) {
425 Bool in_y_range = ((y_min)<=((offset).y))&&((y_max)>=((offset).y));
426 Float cross = ((cross_at_origin)+(((edge).x)*((offset).y)))-(((edge).y)*((offset).x));
427 return if_then_else((in_y_range)&&((cross)>=(0.f)), winding, 0.f);
428}
429Float path_even_odd(Float winding_number) {
430 return (1.f)-(abs__glsl_abs((mod(abs__glsl_abs(winding_number), 2.f))-(1.f)));
431}
432Float path_non_zero(Float winding_number) {
433 return min(abs__glsl_abs(winding_number), 1.f);
434}
435Float path_tile_coverage(vec2 uv, ivec2_scalar edges, int32_t backdrop, int32_t fill_rule) {
436 vec4 wn0 = make_vec4(make_float(backdrop));
437 vec4 wn1 = make_vec4(make_float(backdrop));
438 int32_t end = min((edges).y, ((edges).x)+(512));
439 for ( int32_t edge_idx = (edges).x;
440(edge_idx)<(end); edge_idx++) {
441 ivec2_scalar edge_uv = make_ivec2(make_int((make_uint(edge_idx))%(1024u)), make_int((make_uint(edge_idx))/(1024u)));
442 vec4_scalar edge = (texelFetch(sPathEdges, edge_uv, 0))*((255.f)/(15.f));
443 vec2_scalar p0 = (edge).sel(X,Y);
444 vec2_scalar p1 = (edge).sel(Z,W);
445 if (((p0).y)==((p1).y)) {
446 {
447 continue;
448 }
449 }
450 bool downwards = ((p1).y)>((p0).y);
451 float s = downwards ? 1.f : -(1.f);
452 vec2 upper = (downwards ? p0 : p1)-(uv);
453 vec2 lower = (downwards ? p1 : p0)-(uv);
454 Float y_min = -((lower).y);
455 Float y_max = -((upper).y);
456 auto _c2_ = ((y_min)<=((7.f)/(16.f)))&&((y_max)>=((-(7.f))/(16.f)));
457 {
458 vec2_scalar const a = make_vec2((7.f)/(16.f), (-(7.f))/(16.f));
459 vec2_scalar const b = make_vec2((-(3.f))/(16.f), (-(5.f))/(16.f));
460 vec2_scalar const c = make_vec2((1.f)/(16.f), (-(3.f))/(16.f));
461 vec2_scalar const d = make_vec2((-(7.f))/(16.f), (-(1.f))/(16.f));
462 vec2_scalar const e = make_vec2((5.f)/(16.f), (1.f)/(16.f));
463 vec2_scalar const f = make_vec2((-(1.f))/(16.f), (3.f)/(16.f));
464 vec2_scalar const g = make_vec2((-(5.f))/(16.f), (5.f)/(16.f));
465 vec2_scalar const h = make_vec2((3.f)/(16.f), (7.f)/(16.f));
466 vec2 v = (lower)-(upper);
467 Float cross_at_origin = (((v).x)*((upper).y))-(((upper).x)*((v).y));
468 (wn0).x = if_then_else(_c2_,(wn0).x+ssaa_sample(a, v, cross_at_origin, y_min, y_max, s),(wn0).x);
469 (wn0).y = if_then_else(_c2_,(wn0).y+ssaa_sample(b, v, cross_at_origin, y_min, y_max, s),(wn0).y);
470 (wn0).z = if_then_else(_c2_,(wn0).z+ssaa_sample(c, v, cross_at_origin, y_min, y_max, s),(wn0).z);
471 (wn0).w = if_then_else(_c2_,(wn0).w+ssaa_sample(d, v, cross_at_origin, y_min, y_max, s),(wn0).w);
472 (wn1).x = if_then_else(_c2_,(wn1).x+ssaa_sample(e, v, cross_at_origin, y_min, y_max, s),(wn1).x);
473 (wn1).y = if_then_else(_c2_,(wn1).y+ssaa_sample(f, v, cross_at_origin, y_min, y_max, s),(wn1).y);
474 (wn1).z = if_then_else(_c2_,(wn1).z+ssaa_sample(g, v, cross_at_origin, y_min, y_max, s),(wn1).z);
475 (wn1).w = if_then_else(_c2_,(wn1).w+ssaa_sample(h, v, cross_at_origin, y_min, y_max, s),(wn1).w);
476 }
477 }
478 Float mask;
479 if (((fill_rule)&(1))==(0)) {
480 {
481 mask = (((((((path_even_odd((wn0).x))+(path_even_odd((wn0).y)))+(path_even_odd((wn0).z)))+(path_even_odd((wn0).w)))+(path_even_odd((wn1).x)))+(path_even_odd((wn1).y)))+(path_even_odd((wn1).z)))+(path_even_odd((wn1).w));
482 }
483 } else {
484 mask = (((((((path_non_zero((wn0).x))+(path_non_zero((wn0).y)))+(path_non_zero((wn0).z)))+(path_non_zero((wn0).w)))+(path_non_zero((wn1).x)))+(path_non_zero((wn1).y)))+(path_non_zero((wn1).z)))+(path_non_zero((wn1).w));
485 }
486 mask *= 0.125f;
487 if (((fill_rule)&(2))!=(0)) {
488 {
489 mask = (1.f)-(mask);
490 }
491 }
492 return mask;
493}
494ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
495 Float coverage = path_tile_coverage(vUv, (vTileData).sel(X,Y), (vTileData).z, (vTileData).w);
496 oFragColorgl_FragColor = (vColor)*(coverage);
497}
498typedef ps_path_tile_PATH_SSAA8_vert::InterpOutputs InterpInputs;
499InterpInputs interp_step;
500struct InterpPerspective {
501vec2 vUv;
502};
503InterpPerspective interp_perspective;
504static 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_;
505 self->vUv = init_interp(init->vUv, step->vUv);
506 self->interp_step.vUv = step->vUv * 4.0f;
507}
508static 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_;
509 Float w = 1.0f / self->gl_FragCoord.w;
510 self->interp_perspective.vUv = init_interp(init->vUv, step->vUv);
511 self->vUv = self->interp_perspective.vUv * w;
512 self->interp_step.vUv = step->vUv * 4.0f;
513}
514ALWAYS_INLINE__attribute__((always_inline)) inline void step_interp_inputs(int steps = 4) {
515 float chunks = steps * 0.25f;
516 vUv += interp_step.vUv * chunks;
517}
518ALWAYS_INLINE__attribute__((always_inline)) inline void step_perspective_inputs(int steps = 4) {
519 step_perspective(steps);
520 float chunks = steps * 0.25f;
521 Float w = 1.0f / gl_FragCoord.w;
522 interp_perspective.vUv += interp_step.vUv * chunks;
523 vUv = w * interp_perspective.vUv;
524}
525static void run(FragmentShaderImpl* impl) {
526 Self* self = (Self*)impl;
527 self->main();
528 self->step_interp_inputs();
529}
530static void skip(FragmentShaderImpl* impl, int steps) {
531 Self* self = (Self*)impl;
532 self->step_interp_inputs(steps);
533}
534static void run_perspective(FragmentShaderImpl* impl) {
535 Self* self = (Self*)impl;
536 self->main();
537 self->step_perspective_inputs();
538}
539static void skip_perspective(FragmentShaderImpl* impl, int steps) {
540 Self* self = (Self*)impl;
541 self->step_perspective_inputs(steps);
542}
543public:
544ps_path_tile_PATH_SSAA8_frag() {
545 init_span_func = &read_interp_inputs;
546 run_func = &run;
547 skip_func = &skip;
548 enable_perspective();
549 init_span_w_func = &read_perspective_inputs;
550 run_w_func = &run_perspective;
551 skip_w_func = &skip_perspective;
552}
553};
554
555struct ps_path_tile_PATH_SSAA8_program : ProgramImpl, ps_path_tile_PATH_SSAA8_frag {
556int get_uniform(const char *name) const override {
557 if (strcmp("sGpuBufferF", name) == 0) { return 2; }
558 if (strcmp("sGpuBufferI", name) == 0) { return 3; }
559 if (strcmp("sPathEdges", name) == 0) { return 5; }
560 if (strcmp("sRenderTasks", name) == 0) { return 1; }
561 if (strcmp("uTransform", name) == 0) { return 4; }
562 return -1;
563}
564void bind_attrib(const char* name, int index) override {
565 attrib_locations.bind_loc(name, index);
566}
567int get_attrib(const char* name) const override {
568 return attrib_locations.get_loc(name);
569}
570size_t interpolants_size() const override { return sizeof(InterpOutputs); }
571VertexShaderImpl* get_vertex_shader() override {
572 return this;
573}
574FragmentShaderImpl* get_fragment_shader() override {
575 return this;
576}
577const char* get_name() const override { return "ps_path_tile_PATH_SSAA8"; }
578static ProgramImpl* loader() { return new ps_path_tile_PATH_SSAA8_program; }
579};
580