Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/swgl-250521f66641ef82/out/cs_svg_filter_node.h
Warning:line 975, column 3
Value stored to 'ret_mask' 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-250521f66641ef82/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/15/../../../../include/c++/15 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/x86_64-linux-gnu/c++/15 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/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/15/../../../../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-07-16-093543-1626485-1 -x c++ src/gl.cc
1struct cs_svg_filter_node_common {
2struct Samplers {
3 sampler2D_impl sClipMask_impl;
4 int sClipMask_slot;
5 sampler2D_impl sColor0_impl;
6 int sColor0_slot;
7 sampler2D_impl sColor1_impl;
8 int sColor1_slot;
9 sampler2D_impl sGpuBufferF_impl;
10 int sGpuBufferF_slot;
11 isampler2D_impl sGpuBufferI_impl;
12 int sGpuBufferI_slot;
13 sampler2D_impl sPrimitiveHeadersF_impl;
14 int sPrimitiveHeadersF_slot;
15 isampler2D_impl sPrimitiveHeadersI_impl;
16 int sPrimitiveHeadersI_slot;
17 sampler2D_impl sRenderTasks_impl;
18 int sRenderTasks_slot;
19 sampler2D_impl sTransformPalette_impl;
20 int sTransformPalette_slot;
21 bool set_slot(int index, int value) {
22 switch (index) {
23 case 8:
24 sClipMask_slot = value;
25 return true;
26 case 9:
27 sColor0_slot = value;
28 return true;
29 case 10:
30 sColor1_slot = value;
31 return true;
32 case 3:
33 sGpuBufferF_slot = value;
34 return true;
35 case 4:
36 sGpuBufferI_slot = value;
37 return true;
38 case 5:
39 sPrimitiveHeadersF_slot = value;
40 return true;
41 case 6:
42 sPrimitiveHeadersI_slot = value;
43 return true;
44 case 1:
45 sRenderTasks_slot = value;
46 return true;
47 case 2:
48 sTransformPalette_slot = value;
49 return true;
50 }
51 return false;
52 }
53} samplers;
54struct AttribLocations {
55 int aPosition = NULL_ATTRIB16;
56 int aData = NULL_ATTRIB16;
57 int aFilterTargetRect = NULL_ATTRIB16;
58 int aFilterInput1ContentScaleAndOffset = NULL_ATTRIB16;
59 int aFilterInput2ContentScaleAndOffset = NULL_ATTRIB16;
60 int aFilterInput1TaskAddress = NULL_ATTRIB16;
61 int aFilterInput2TaskAddress = NULL_ATTRIB16;
62 int aFilterKindAndInputCount = NULL_ATTRIB16;
63 int aFilterExtraDataAddress = NULL_ATTRIB16;
64 void bind_loc(const char* name, int index) {
65 if (strcmp("aPosition", name) == 0) { aPosition = index; return; }
66 if (strcmp("aData", name) == 0) { aData = index; return; }
67 if (strcmp("aFilterTargetRect", name) == 0) { aFilterTargetRect = index; return; }
68 if (strcmp("aFilterInput1ContentScaleAndOffset", name) == 0) { aFilterInput1ContentScaleAndOffset = index; return; }
69 if (strcmp("aFilterInput2ContentScaleAndOffset", name) == 0) { aFilterInput2ContentScaleAndOffset = index; return; }
70 if (strcmp("aFilterInput1TaskAddress", name) == 0) { aFilterInput1TaskAddress = index; return; }
71 if (strcmp("aFilterInput2TaskAddress", name) == 0) { aFilterInput2TaskAddress = index; return; }
72 if (strcmp("aFilterKindAndInputCount", name) == 0) { aFilterKindAndInputCount = index; return; }
73 if (strcmp("aFilterExtraDataAddress", name) == 0) { aFilterExtraDataAddress = index; return; }
74 }
75 int get_loc(const char* name) const {
76 if (strcmp("aPosition", name) == 0) { return aPosition != NULL_ATTRIB16 ? aPosition : -1; }
77 if (strcmp("aData", name) == 0) { return aData != NULL_ATTRIB16 ? aData : -1; }
78 if (strcmp("aFilterTargetRect", name) == 0) { return aFilterTargetRect != NULL_ATTRIB16 ? aFilterTargetRect : -1; }
79 if (strcmp("aFilterInput1ContentScaleAndOffset", name) == 0) { return aFilterInput1ContentScaleAndOffset != NULL_ATTRIB16 ? aFilterInput1ContentScaleAndOffset : -1; }
80 if (strcmp("aFilterInput2ContentScaleAndOffset", name) == 0) { return aFilterInput2ContentScaleAndOffset != NULL_ATTRIB16 ? aFilterInput2ContentScaleAndOffset : -1; }
81 if (strcmp("aFilterInput1TaskAddress", name) == 0) { return aFilterInput1TaskAddress != NULL_ATTRIB16 ? aFilterInput1TaskAddress : -1; }
82 if (strcmp("aFilterInput2TaskAddress", name) == 0) { return aFilterInput2TaskAddress != NULL_ATTRIB16 ? aFilterInput2TaskAddress : -1; }
83 if (strcmp("aFilterKindAndInputCount", name) == 0) { return aFilterKindAndInputCount != NULL_ATTRIB16 ? aFilterKindAndInputCount : -1; }
84 if (strcmp("aFilterExtraDataAddress", name) == 0) { return aFilterExtraDataAddress != NULL_ATTRIB16 ? aFilterExtraDataAddress : -1; }
85 return -1;
86 }
87} attrib_locations;
88vec4_scalar vTransformBounds;
89vec4_scalar vInput1UvRect;
90vec4_scalar vInput2UvRect;
91ivec4_scalar vData;
92vec4_scalar vFilterData0;
93ivec2_scalar vFilterInputCountFilterKindVec;
94vec2_scalar vFloat0;
95mat4_scalar vColorMat;
96sampler2D sClipMask;
97sampler2D sColor0;
98sampler2D sColor1;
99sampler2D sGpuBufferF;
100isampler2D sGpuBufferI;
101sampler2D sPrimitiveHeadersF;
102isampler2D sPrimitiveHeadersI;
103sampler2D sRenderTasks;
104sampler2D sTransformPalette;
105mat4_scalar uTransform;
106void bind_textures() {
107 sClipMask = lookup_sampler(&samplers.sClipMask_impl, samplers.sClipMask_slot);
108 sColor0 = lookup_sampler(&samplers.sColor0_impl, samplers.sColor0_slot);
109 sColor1 = lookup_sampler(&samplers.sColor1_impl, samplers.sColor1_slot);
110 sGpuBufferF = lookup_sampler(&samplers.sGpuBufferF_impl, samplers.sGpuBufferF_slot);
111 sGpuBufferI = lookup_isampler(&samplers.sGpuBufferI_impl, samplers.sGpuBufferI_slot);
112 sPrimitiveHeadersF = lookup_sampler(&samplers.sPrimitiveHeadersF_impl, samplers.sPrimitiveHeadersF_slot);
113 sPrimitiveHeadersI = lookup_isampler(&samplers.sPrimitiveHeadersI_impl, samplers.sPrimitiveHeadersI_slot);
114 sRenderTasks = lookup_sampler(&samplers.sRenderTasks_impl, samplers.sRenderTasks_slot);
115 sTransformPalette = lookup_sampler(&samplers.sTransformPalette_impl, samplers.sTransformPalette_slot);
116}
117};
118struct cs_svg_filter_node_vert : VertexShaderImpl, cs_svg_filter_node_common {
119private:
120typedef cs_svg_filter_node_vert Self;
121// mat4_scalar uTransform;
122vec2 aPosition;
123// sampler2D sColor0;
124// sampler2D sColor1;
125// sampler2D sColor2;
126struct RectWithSize_scalar {
127vec2_scalar p0;
128vec2_scalar size;
129RectWithSize_scalar() = default;
130RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){}
131};
132struct RectWithSize {
133vec2 p0;
134vec2 size;
135RectWithSize() = default;
136RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){}
137RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){
138}
139IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){
140}
141friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize(
142if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size));
143}};
144struct RectWithEndpoint_scalar {
145vec2_scalar p0;
146vec2_scalar p1;
147RectWithEndpoint_scalar() = default;
148RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){}
149};
150struct RectWithEndpoint {
151vec2 p0;
152vec2 p1;
153RectWithEndpoint() = default;
154RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){}
155RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){
156}
157IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){
158}
159friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint(
160if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1));
161}};
162// sampler2D sRenderTasks;
163struct RenderTaskData_scalar {
164RectWithEndpoint_scalar task_rect;
165vec4_scalar user_data;
166RenderTaskData_scalar() = default;
167RenderTaskData_scalar(RectWithEndpoint_scalar task_rect, vec4_scalar user_data) : task_rect(task_rect), user_data(user_data){}
168};
169struct RenderTaskData {
170RectWithEndpoint task_rect;
171vec4 user_data;
172RenderTaskData() = default;
173RenderTaskData(RectWithEndpoint task_rect, vec4 user_data) : task_rect(task_rect), user_data(user_data){}
174RenderTaskData(RectWithEndpoint_scalar task_rect, vec4_scalar user_data):task_rect(task_rect),user_data(user_data){
175}
176IMPLICIT RenderTaskData(RenderTaskData_scalar s):task_rect(s.task_rect),user_data(s.user_data){
177}
178friend RenderTaskData if_then_else(I32 c, RenderTaskData t, RenderTaskData e) { return RenderTaskData(
179if_then_else(c, t.task_rect, e.task_rect), if_then_else(c, t.user_data, e.user_data));
180}};
181struct PictureTask_scalar {
182RectWithEndpoint_scalar task_rect;
183float device_pixel_scale;
184vec2_scalar content_origin;
185PictureTask_scalar() = default;
186PictureTask_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){}
187};
188struct PictureTask {
189RectWithEndpoint task_rect;
190Float device_pixel_scale;
191vec2 content_origin;
192PictureTask() = default;
193PictureTask(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 content_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), content_origin(content_origin){}
194PictureTask(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){
195}
196IMPLICIT PictureTask(PictureTask_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),content_origin(s.content_origin){
197}
198friend PictureTask if_then_else(I32 c, PictureTask t, PictureTask e) { return PictureTask(
199if_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));
200}};
201struct ClipArea_scalar {
202RectWithEndpoint_scalar task_rect;
203float device_pixel_scale;
204vec2_scalar screen_origin;
205ClipArea_scalar() = default;
206ClipArea_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){}
207};
208struct ClipArea {
209RectWithEndpoint task_rect;
210Float device_pixel_scale;
211vec2 screen_origin;
212ClipArea() = default;
213ClipArea(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 screen_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), screen_origin(screen_origin){}
214ClipArea(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){
215}
216IMPLICIT ClipArea(ClipArea_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),screen_origin(s.screen_origin){
217}
218friend ClipArea if_then_else(I32 c, ClipArea t, ClipArea e) { return ClipArea(
219if_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));
220}};
221// vec4_scalar vTransformBounds;
222// sampler2D sTransformPalette;
223struct Transform_scalar {
224mat4_scalar m;
225mat4_scalar inv_m;
226bool is_axis_aligned;
227Transform_scalar() = default;
228Transform_scalar(mat4_scalar m, mat4_scalar inv_m, bool is_axis_aligned) : m(m), inv_m(inv_m), is_axis_aligned(is_axis_aligned){}
229};
230struct Transform {
231mat4 m;
232mat4 inv_m;
233Bool is_axis_aligned;
234Transform() = default;
235Transform(mat4 m, mat4 inv_m, Bool is_axis_aligned) : m(m), inv_m(inv_m), is_axis_aligned(is_axis_aligned){}
236Transform(mat4_scalar m, mat4_scalar inv_m, bool is_axis_aligned):m(m),inv_m(inv_m),is_axis_aligned(is_axis_aligned){
237}
238IMPLICIT Transform(Transform_scalar s):m(s.m),inv_m(s.inv_m),is_axis_aligned(s.is_axis_aligned){
239}
240friend Transform if_then_else(I32 c, Transform t, Transform e) { return Transform(
241if_then_else(c, t.m, e.m), if_then_else(c, t.inv_m, e.inv_m), if_then_else(c, t.is_axis_aligned, e.is_axis_aligned));
242}};
243// sampler2D sGpuBufferF;
244// isampler2D sGpuBufferI;
245struct ImageSource_scalar {
246RectWithEndpoint_scalar uv_rect;
247vec4_scalar user_data;
248ImageSource_scalar() = default;
249ImageSource_scalar(RectWithEndpoint_scalar uv_rect, vec4_scalar user_data) : uv_rect(uv_rect), user_data(user_data){}
250};
251struct ImageSource {
252RectWithEndpoint uv_rect;
253vec4 user_data;
254ImageSource() = default;
255ImageSource(RectWithEndpoint uv_rect, vec4 user_data) : uv_rect(uv_rect), user_data(user_data){}
256ImageSource(RectWithEndpoint_scalar uv_rect, vec4_scalar user_data):uv_rect(uv_rect),user_data(user_data){
257}
258IMPLICIT ImageSource(ImageSource_scalar s):uv_rect(s.uv_rect),user_data(s.user_data){
259}
260friend ImageSource if_then_else(I32 c, ImageSource t, ImageSource e) { return ImageSource(
261if_then_else(c, t.uv_rect, e.uv_rect), if_then_else(c, t.user_data, e.user_data));
262}};
263struct ImageSourceExtra_scalar {
264vec4_scalar st_tl;
265vec4_scalar st_tr;
266vec4_scalar st_bl;
267vec4_scalar st_br;
268ImageSourceExtra_scalar() = default;
269ImageSourceExtra_scalar(vec4_scalar st_tl, vec4_scalar st_tr, vec4_scalar st_bl, vec4_scalar st_br) : st_tl(st_tl), st_tr(st_tr), st_bl(st_bl), st_br(st_br){}
270};
271struct ImageSourceExtra {
272vec4 st_tl;
273vec4 st_tr;
274vec4 st_bl;
275vec4 st_br;
276ImageSourceExtra() = default;
277ImageSourceExtra(vec4 st_tl, vec4 st_tr, vec4 st_bl, vec4 st_br) : st_tl(st_tl), st_tr(st_tr), st_bl(st_bl), st_br(st_br){}
278ImageSourceExtra(vec4_scalar st_tl, vec4_scalar st_tr, vec4_scalar st_bl, vec4_scalar st_br):st_tl(st_tl),st_tr(st_tr),st_bl(st_bl),st_br(st_br){
279}
280IMPLICIT ImageSourceExtra(ImageSourceExtra_scalar s):st_tl(s.st_tl),st_tr(s.st_tr),st_bl(s.st_bl),st_br(s.st_br){
281}
282friend ImageSourceExtra if_then_else(I32 c, ImageSourceExtra t, ImageSourceExtra e) { return ImageSourceExtra(
283if_then_else(c, t.st_tl, e.st_tl), if_then_else(c, t.st_tr, e.st_tr), if_then_else(c, t.st_bl, e.st_bl), if_then_else(c, t.st_br, e.st_br));
284}};
285// sampler2D sClipMask;
286// sampler2D sPrimitiveHeadersF;
287// isampler2D sPrimitiveHeadersI;
288ivec4_scalar aData;
289struct Instance_scalar {
290int32_t prim_header_address;
291int32_t clip_address;
292int32_t segment_index;
293int32_t flags;
294int32_t resource_address;
295int32_t brush_kind;
296Instance_scalar() = default;
297Instance_scalar(int32_t prim_header_address, int32_t clip_address, int32_t segment_index, int32_t flags, int32_t resource_address, int32_t brush_kind) : prim_header_address(prim_header_address), clip_address(clip_address), segment_index(segment_index), flags(flags), resource_address(resource_address), brush_kind(brush_kind){}
298};
299struct Instance {
300I32 prim_header_address;
301I32 clip_address;
302I32 segment_index;
303I32 flags;
304I32 resource_address;
305I32 brush_kind;
306Instance() = default;
307Instance(I32 prim_header_address, I32 clip_address, I32 segment_index, I32 flags, I32 resource_address, I32 brush_kind) : prim_header_address(prim_header_address), clip_address(clip_address), segment_index(segment_index), flags(flags), resource_address(resource_address), brush_kind(brush_kind){}
308Instance(int32_t prim_header_address, int32_t clip_address, int32_t segment_index, int32_t flags, int32_t resource_address, int32_t brush_kind):prim_header_address(prim_header_address),clip_address(clip_address),segment_index(segment_index),flags(flags),resource_address(resource_address),brush_kind(brush_kind){
309}
310IMPLICIT Instance(Instance_scalar s):prim_header_address(s.prim_header_address),clip_address(s.clip_address),segment_index(s.segment_index),flags(s.flags),resource_address(s.resource_address),brush_kind(s.brush_kind){
311}
312friend Instance if_then_else(I32 c, Instance t, Instance e) { return Instance(
313if_then_else(c, t.prim_header_address, e.prim_header_address), if_then_else(c, t.clip_address, e.clip_address), if_then_else(c, t.segment_index, e.segment_index), if_then_else(c, t.flags, e.flags), if_then_else(c, t.resource_address, e.resource_address), if_then_else(c, t.brush_kind, e.brush_kind));
314}};
315struct PrimitiveHeader_scalar {
316RectWithEndpoint_scalar local_rect;
317RectWithEndpoint_scalar local_clip_rect;
318float z;
319int32_t specific_prim_address;
320int32_t transform_id;
321int32_t picture_task_address;
322ivec4_scalar user_data;
323PrimitiveHeader_scalar() = default;
324PrimitiveHeader_scalar(RectWithEndpoint_scalar local_rect, RectWithEndpoint_scalar local_clip_rect, float z, int32_t specific_prim_address, int32_t transform_id, int32_t picture_task_address, ivec4_scalar user_data) : local_rect(local_rect), local_clip_rect(local_clip_rect), z(z), specific_prim_address(specific_prim_address), transform_id(transform_id), picture_task_address(picture_task_address), user_data(user_data){}
325};
326struct PrimitiveHeader {
327RectWithEndpoint local_rect;
328RectWithEndpoint local_clip_rect;
329Float z;
330I32 specific_prim_address;
331I32 transform_id;
332I32 picture_task_address;
333ivec4 user_data;
334PrimitiveHeader() = default;
335PrimitiveHeader(RectWithEndpoint local_rect, RectWithEndpoint local_clip_rect, Float z, I32 specific_prim_address, I32 transform_id, I32 picture_task_address, ivec4 user_data) : local_rect(local_rect), local_clip_rect(local_clip_rect), z(z), specific_prim_address(specific_prim_address), transform_id(transform_id), picture_task_address(picture_task_address), user_data(user_data){}
336PrimitiveHeader(RectWithEndpoint_scalar local_rect, RectWithEndpoint_scalar local_clip_rect, float z, int32_t specific_prim_address, int32_t transform_id, int32_t picture_task_address, ivec4_scalar user_data):local_rect(local_rect),local_clip_rect(local_clip_rect),z(z),specific_prim_address(specific_prim_address),transform_id(transform_id),picture_task_address(picture_task_address),user_data(user_data){
337}
338IMPLICIT PrimitiveHeader(PrimitiveHeader_scalar s):local_rect(s.local_rect),local_clip_rect(s.local_clip_rect),z(s.z),specific_prim_address(s.specific_prim_address),transform_id(s.transform_id),picture_task_address(s.picture_task_address),user_data(s.user_data){
339}
340friend PrimitiveHeader if_then_else(I32 c, PrimitiveHeader t, PrimitiveHeader e) { return PrimitiveHeader(
341if_then_else(c, t.local_rect, e.local_rect), if_then_else(c, t.local_clip_rect, e.local_clip_rect), if_then_else(c, t.z, e.z), if_then_else(c, t.specific_prim_address, e.specific_prim_address), if_then_else(c, t.transform_id, e.transform_id), if_then_else(c, t.picture_task_address, e.picture_task_address), if_then_else(c, t.user_data, e.user_data));
342}};
343struct VertexInfo_scalar {
344vec2_scalar local_pos;
345vec4_scalar world_pos;
346VertexInfo_scalar() = default;
347VertexInfo_scalar(vec2_scalar local_pos, vec4_scalar world_pos) : local_pos(local_pos), world_pos(world_pos){}
348};
349struct VertexInfo {
350vec2 local_pos;
351vec4 world_pos;
352VertexInfo() = default;
353VertexInfo(vec2 local_pos, vec4 world_pos) : local_pos(local_pos), world_pos(world_pos){}
354VertexInfo(vec2_scalar local_pos, vec4_scalar world_pos):local_pos(local_pos),world_pos(world_pos){
355}
356IMPLICIT VertexInfo(VertexInfo_scalar s):local_pos(s.local_pos),world_pos(s.world_pos){
357}
358friend VertexInfo if_then_else(I32 c, VertexInfo t, VertexInfo e) { return VertexInfo(
359if_then_else(c, t.local_pos, e.local_pos), if_then_else(c, t.world_pos, e.world_pos));
360}};
361vec2 vInput1Uv;
362vec2 vInput2Uv;
363// vec4_scalar vInput1UvRect;
364// vec4_scalar vInput2UvRect;
365// ivec4_scalar vData;
366// vec4_scalar vFilterData0;
367// vec4_scalar vFilterData1;
368// ivec2_scalar vFilterInputCountFilterKindVec;
369// vec2_scalar vFloat0;
370// mat4_scalar vColorMat;
371// ivec4_scalar vFuncs;
372vec4_scalar aFilterTargetRect;
373vec4_scalar aFilterInput1ContentScaleAndOffset;
374vec4_scalar aFilterInput2ContentScaleAndOffset;
375int32_t aFilterInput1TaskAddress;
376int32_t aFilterInput2TaskAddress;
377uvec2_scalar aFilterKindAndInputCount;
378int32_t aFilterExtraDataAddress;
379RectWithEndpoint_scalar fetch_render_task_rect(int32_t index) {
380 ivec2_scalar uv = make_ivec2(make_int((2u)*((make_uint(index))%((1024u)/(2u)))), make_int((make_uint(index))/((1024u)/(2u))));
381 auto sRenderTasks_uv_fetch = texelFetchPtr(sRenderTasks, uv, 0, 1, 0, 0);
382 vec4_scalar texel0 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 0, 0);
383 vec4_scalar texel1 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 1, 0);
384 RectWithEndpoint_scalar task_rect = RectWithEndpoint_scalar((texel0).sel(X,Y), (texel0).sel(Z,W));
385 return task_rect;
386}
387vec4_scalar compute_uv_rect(RectWithEndpoint_scalar task_rect, vec2_scalar texture_size) {
388 vec4_scalar uvRect = make_vec4(((task_rect).p0)+(make_vec2(0.5f)), ((task_rect).p1)-(make_vec2(0.5f)));
389 uvRect /= (texture_size).sel(X,Y,X,Y);
390 return uvRect;
391}
392vec2 compute_uv(RectWithEndpoint_scalar task_rect, vec4_scalar scale_and_offset, vec2_scalar target_size, vec2_scalar texture_size) {
393 return ((((task_rect).p0)+((scale_and_offset).sel(Z,W)))+(((scale_and_offset).sel(X,Y))*((aPosition).sel(X,Y))))/((texture_size).sel(X,Y));
394}
395ivec2_scalar get_gpu_buffer_uv(int32_t address) {
396 return make_ivec2((make_uint(address))%(1024u), (make_uint(address))/(1024u));
397}
398Array<vec4_scalar,4> fetch_from_gpu_buffer_4f_direct(ivec2_scalar uv) {
399 auto sGpuBufferF_uv_fetch = texelFetchPtr(sGpuBufferF, uv, 0, 3, 0, 0);
400 return Array<vec4_scalar,4>{{texelFetchUnchecked(sGpuBufferF, sGpuBufferF_uv_fetch, 0, 0), texelFetchUnchecked(sGpuBufferF, sGpuBufferF_uv_fetch, 1, 0), texelFetchUnchecked(sGpuBufferF, sGpuBufferF_uv_fetch, 2, 0), texelFetchUnchecked(sGpuBufferF, sGpuBufferF_uv_fetch, 3, 0)}};
401}
402vec4_scalar fetch_from_gpu_buffer_1f_direct(ivec2_scalar uv) {
403 return texelFetch(sGpuBufferF, uv, 0);
404}
405vec4_scalar fetch_from_gpu_buffer_1f(int32_t address) {
406 ivec2_scalar uv = get_gpu_buffer_uv(address);
407 return texelFetch(sGpuBufferF, uv, 0);
408}
409vec3_scalar vertexSrgbToLinear(vec3_scalar color) {
410 vec3_scalar c1 = (color)*(make_vec3((1.f)/(12.92f)));
411 vec3_scalar c2;
412 (c2).x = pow__glsl_pow((((color).x)*((1.f)/(1.055f)))+((0.055f)/(1.055f)), 2.4f);
413 (c2).y = pow__glsl_pow((((color).y)*((1.f)/(1.055f)))+((0.055f)/(1.055f)), 2.4f);
414 (c2).z = pow__glsl_pow((((color).z)*((1.f)/(1.055f)))+((0.055f)/(1.055f)), 2.4f);
415 return mix(c1, c2, step(make_vec3(0.04045f), color));
416}
417ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
418 int32_t filter_kind = make_int((aFilterKindAndInputCount).x);
419 int32_t input_count = make_int((aFilterKindAndInputCount).y);
420 vec2 pos = mix((aFilterTargetRect).sel(X,Y), (aFilterTargetRect).sel(Z,W), (aPosition).sel(X,Y));
421 RectWithEndpoint_scalar input_1_task;
422 if ((input_count)>(0)) {
423 {
424 vec2_scalar texture_size = make_vec2((textureSize(sColor0, 0)).sel(X,Y));
425 input_1_task = fetch_render_task_rect(aFilterInput1TaskAddress);
426 vInput1UvRect = compute_uv_rect(input_1_task, texture_size);
427 vInput1Uv = compute_uv(input_1_task, aFilterInput1ContentScaleAndOffset, ((aFilterTargetRect).sel(Z,W))-((aFilterTargetRect).sel(X,Y)), texture_size);
428 }
429 }
430 RectWithEndpoint_scalar input_2_task;
431 if ((input_count)>(1)) {
432 {
433 vec2_scalar texture_size = make_vec2((textureSize(sColor1, 0)).sel(X,Y));
434 input_2_task = fetch_render_task_rect(aFilterInput2TaskAddress);
435 vInput2UvRect = compute_uv_rect(input_2_task, texture_size);
436 vInput2Uv = compute_uv(input_2_task, aFilterInput2ContentScaleAndOffset, ((aFilterTargetRect).sel(Z,W))-((aFilterTargetRect).sel(X,Y)), texture_size);
437 }
438 }
439 (vFilterInputCountFilterKindVec).x = input_count;
440 (vFilterInputCountFilterKindVec).y = filter_kind;
441 switch (filter_kind) {
442 case 0:
443 case 1:
444 break;
445 case 2:
446 case 3:
447 (vFloat0).x = (aFilterInput2ContentScaleAndOffset).x;
448 break;
449 case 4:
450 case 5:
451 break;
452 case 6:
453 case 7:
454 case 8:
455 case 9:
456 case 10:
457 case 11:
458 case 12:
459 case 13:
460 case 14:
461 case 15:
462 case 16:
463 case 17:
464 case 18:
465 case 19:
466 case 20:
467 case 21:
468 case 22:
469 case 23:
470 case 24:
471 case 25:
472 case 26:
473 case 27:
474 case 28:
475 case 29:
476 case 30:
477 case 31:
478 case 32:
479 case 33:
480 case 34:
481 case 35:
482 case 36:
483 case 37:
484 break;
485 case 38:
486 case 39:
487 {
488 ivec2_scalar gpu_buffer_uv = get_gpu_buffer_uv(aFilterExtraDataAddress);
489 Array<vec4_scalar,4> mat_data = fetch_from_gpu_buffer_4f_direct(gpu_buffer_uv);
490 vColorMat = make_mat4(mat_data[0], mat_data[1], mat_data[2], mat_data[3]);
491 vFilterData0 = fetch_from_gpu_buffer_1f_direct((gpu_buffer_uv)+(make_ivec2(4, 0)));
492 break;
493 }
494 case 40:
495 case 41:
496 {
497 ivec2_scalar gpu_buffer_uv = get_gpu_buffer_uv(aFilterExtraDataAddress);
498 vData = make_ivec4(gpu_buffer_uv, 0, 0);
499 break;
500 }
501 case 42:
502 case 43:
503 vFilterData0 = fetch_from_gpu_buffer_1f(aFilterExtraDataAddress);
504 break;
505 case 44:
506 case 45:
507 case 46:
508 case 47:
509 case 48:
510 case 49:
511 case 50:
512 case 51:
513 case 52:
514 case 53:
515 case 54:
516 case 55:
517 break;
518 case 56:
519 case 57:
520 break;
521 case 58:
522 case 59:
523 break;
524 case 60:
525 case 61:
526 break;
527 case 62:
528 case 63:
529 break;
530 case 64:
531 case 65:
532 break;
533 case 66:
534 case 67:
535 break;
536 case 68:
537 case 69:
538 break;
539 case 70:
540 vFilterData0 = fetch_from_gpu_buffer_1f(aFilterExtraDataAddress);
541 (vFilterData0).lsel(R,G,B) = ((vFilterData0).sel(R,G,B))*((vFilterData0).w);
542 break;
543 case 71:
544 vFilterData0 = fetch_from_gpu_buffer_1f(aFilterExtraDataAddress);
545 (vFilterData0).lsel(R,G,B) = vertexSrgbToLinear((vFilterData0).sel(R,G,B));
546 (vFilterData0).lsel(R,G,B) = ((vFilterData0).sel(R,G,B))*((vFilterData0).w);
547 break;
548 case 72:
549 vFilterData0 = aFilterInput2ContentScaleAndOffset;
550 (vFilterData0).lsel(R,G,B) = ((vFilterData0).sel(R,G,B))*((vFilterData0).w);
551 break;
552 case 73:
553 vFilterData0 = aFilterInput2ContentScaleAndOffset;
554 (vFilterData0).lsel(R,G,B) = vertexSrgbToLinear((vFilterData0).sel(R,G,B));
555 (vFilterData0).lsel(R,G,B) = ((vFilterData0).sel(R,G,B))*((vFilterData0).w);
556 break;
557 case 74:
558 case 75:
559 break;
560 case 76:
561 case 77:
562 break;
563 case 80:
564 case 81:
565 case 82:
566 case 83:
567 vFilterData0 = aFilterInput2ContentScaleAndOffset;
568 break;
569 case 86:
570 case 87:
571 break;
572 case 88:
573 case 89:
574 break;
575 case 90:
576 case 91:
577 break;
578 case 92:
579 case 93:
580 break;
581 case 94:
582 case 95:
583 case 96:
584 case 97:
585 case 98:
586 case 99:
587 case 100:
588 case 101:
589 break;
590 default:
591 break;
592 }
593 gl_Position = (uTransform)*(make_vec4(pos, 0.f, 1.f));
594}
595static void set_uniform_1i(VertexShaderImpl* impl, int index, int value) {
596 Self* self = (Self*)impl;
597 if (self->samplers.set_slot(index, value)) return;
598 switch (index) {
599 case 8:
600 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sClipMask
601 break;
602 case 9:
603 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
604 break;
605 case 10:
606 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor1
607 break;
608 case 3:
609 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferF
610 break;
611 case 4:
612 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferI
613 break;
614 case 5:
615 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersF
616 break;
617 case 6:
618 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersI
619 break;
620 case 1:
621 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
622 break;
623 case 2:
624 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sTransformPalette
625 break;
626 case 7:
627 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
628 break;
629 }
630}
631static void set_uniform_4fv(VertexShaderImpl* impl, int index, const float *value) {
632 Self* self = (Self*)impl;
633 switch (index) {
634 case 8:
635 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sClipMask
636 break;
637 case 9:
638 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
639 break;
640 case 10:
641 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor1
642 break;
643 case 3:
644 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferF
645 break;
646 case 4:
647 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferI
648 break;
649 case 5:
650 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersF
651 break;
652 case 6:
653 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersI
654 break;
655 case 1:
656 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
657 break;
658 case 2:
659 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sTransformPalette
660 break;
661 case 7:
662 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
663 break;
664 }
665}
666static void set_uniform_matrix4fv(VertexShaderImpl* impl, int index, const float *value) {
667 Self* self = (Self*)impl;
668 switch (index) {
669 case 8:
670 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sClipMask
671 break;
672 case 9:
673 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
674 break;
675 case 10:
676 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor1
677 break;
678 case 3:
679 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferF
680 break;
681 case 4:
682 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuBufferI
683 break;
684 case 5:
685 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersF
686 break;
687 case 6:
688 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersI
689 break;
690 case 1:
691 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
692 break;
693 case 2:
694 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sTransformPalette
695 break;
696 case 7:
697 self->uTransform = mat4_scalar::load_from_ptr(value);
698 break;
699 }
700}
701static void load_attribs(VertexShaderImpl* impl, VertexAttrib *attribs, uint32_t start, int instance, int count) {Self* self = (Self*)impl;
702 load_attrib(self->aPosition, attribs[self->attrib_locations.aPosition], start, instance, count);
703 load_flat_attrib(self->aFilterTargetRect, attribs[self->attrib_locations.aFilterTargetRect], start, instance, count);
704 load_flat_attrib(self->aFilterInput1ContentScaleAndOffset, attribs[self->attrib_locations.aFilterInput1ContentScaleAndOffset], start, instance, count);
705 load_flat_attrib(self->aFilterInput2ContentScaleAndOffset, attribs[self->attrib_locations.aFilterInput2ContentScaleAndOffset], start, instance, count);
706 load_flat_attrib(self->aFilterInput1TaskAddress, attribs[self->attrib_locations.aFilterInput1TaskAddress], start, instance, count);
707 load_flat_attrib(self->aFilterInput2TaskAddress, attribs[self->attrib_locations.aFilterInput2TaskAddress], start, instance, count);
708 load_flat_attrib(self->aFilterKindAndInputCount, attribs[self->attrib_locations.aFilterKindAndInputCount], start, instance, count);
709 load_flat_attrib(self->aFilterExtraDataAddress, attribs[self->attrib_locations.aFilterExtraDataAddress], start, instance, count);
710}
711public:
712struct InterpOutputs {
713vec2_scalar vInput1Uv;
714vec2_scalar vInput2Uv;
715};
716private:
717ALWAYS_INLINE__attribute__((always_inline)) inline void store_interp_outputs(char* dest_ptr, size_t stride) {
718 for(int n = 0; n < 4; n++) {
719 auto* dest = reinterpret_cast<InterpOutputs*>(dest_ptr);
720 dest->vInput1Uv = get_nth(vInput1Uv, n);
721 dest->vInput2Uv = get_nth(vInput2Uv, n);
722 dest_ptr += stride;
723 }
724}
725static void run(VertexShaderImpl* impl, char* interps, size_t interp_stride) {
726 Self* self = (Self*)impl;
727 self->main();
728 self->store_interp_outputs(interps, interp_stride);
729}
730static void init_batch(VertexShaderImpl* impl) {
731 Self* self = (Self*)impl; self->bind_textures(); }
732public:
733cs_svg_filter_node_vert() {
734 set_uniform_1i_func = &set_uniform_1i;
735 set_uniform_4fv_func = &set_uniform_4fv;
736 set_uniform_matrix4fv_func = &set_uniform_matrix4fv;
737 init_batch_func = &init_batch;
738 load_attribs_func = &load_attribs;
739 run_primitive_func = &run;
740}
741};
742
743
744struct cs_svg_filter_node_frag : FragmentShaderImpl, cs_svg_filter_node_vert {
745private:
746typedef cs_svg_filter_node_frag Self;
747#define oFragColorgl_FragColor gl_FragColor
748// vec4 oFragColor;
749// sampler2D sColor0;
750// sampler2D sColor1;
751// sampler2D sColor2;
752struct RectWithSize_scalar {
753vec2_scalar p0;
754vec2_scalar size;
755RectWithSize_scalar() = default;
756RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){}
757};
758struct RectWithSize {
759vec2 p0;
760vec2 size;
761RectWithSize() = default;
762RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){}
763RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){
764}
765IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){
766}
767friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize(
768if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size));
769}};
770struct RectWithEndpoint_scalar {
771vec2_scalar p0;
772vec2_scalar p1;
773RectWithEndpoint_scalar() = default;
774RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){}
775};
776struct RectWithEndpoint {
777vec2 p0;
778vec2 p1;
779RectWithEndpoint() = default;
780RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){}
781RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){
782}
783IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){
784}
785friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint(
786if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1));
787}};
788// vec4_scalar vTransformBounds;
789// sampler2D sGpuBufferF;
790// isampler2D sGpuBufferI;
791// sampler2D sClipMask;
792struct Fragment_scalar {
793vec4_scalar color;
794Fragment_scalar() = default;
795explicit Fragment_scalar(vec4_scalar color) : color(color){}
796};
797struct Fragment {
798vec4 color;
799Fragment() = default;
800explicit Fragment(vec4 color) : color(color){}
801explicit Fragment(vec4_scalar color):color(color){
802}
803IMPLICIT Fragment(Fragment_scalar s):color(s.color){
804}
805friend Fragment if_then_else(I32 c, Fragment t, Fragment e) { return Fragment(
806if_then_else(c, t.color, e.color));
807}};
808vec2 vInput1Uv;
809vec2 vInput2Uv;
810// vec4_scalar vInput1UvRect;
811// vec4_scalar vInput2UvRect;
812// ivec4_scalar vData;
813// vec4_scalar vFilterData0;
814// vec4_scalar vFilterData1;
815// ivec2_scalar vFilterInputCountFilterKindVec;
816// vec2_scalar vFloat0;
817// mat4_scalar vColorMat;
818// ivec4_scalar vFuncs;
819vec4 sampleInUvRect(sampler2D sampler, vec2 uv, vec4_scalar uvRect) {
820 vec2 clamped = clamp((uv).sel(X,Y), (uvRect).sel(X,Y), (uvRect).sel(Z,W));
821 return texture(sampler, clamped);
822}
823vec3 SrgbToLinear(vec3 color) {
824 vec3 c1 = (color)/(12.92f);
825 vec3 c2 = pow__glsl_pow(((color)/(1.055f))+(make_vec3((0.055f)/(1.055f))), make_vec3(2.4f));
826 return mix(c2, c1, lessThanEqual(color, make_vec3(0.04045f)));
827}
828Float Lum(vec3 c) {
829 vec3_scalar f = make_vec3(0.3f, 0.59f, 0.11f);
830 return dot(c, f);
831}
832vec3 ClipColor(vec3 C) {
833 Float L = Lum(C);
834 Float n = min((C).x, min((C).y, (C).z));
835 Float x = max((C).x, max((C).y, (C).z));
836 auto _c3_ = (n)<(0.f);
837 C = if_then_else(_c3_,(L)+((((C)-(L))*(L))/((L)-(n))),C);
838 auto _c4_ = (x)>(1.f);
839 C = if_then_else(_c4_,(L)+((((C)-(L))*((1.f)-(L)))/((x)-(L))),C);
840 return C;
841}
842vec3 SetLum(vec3 C, Float l) {
843 Float d = (l)-(Lum(C));
844 return ClipColor((C)+(d));
845}
846vec3 Color(vec3 Cb, vec3 Cs) {
847 return SetLum(Cs, Lum(Cb));
848}
849Float ColorBurn(Float Cb, Float Cs) {
850 I32 ret_mask = ~0;
851 Float ret;
852 auto _c8_ = (Cb)==(1.f);
853 ret = 1.f;
854 ret_mask = ~I32(_c8_);
855 auto _c9_ = (Cs)==(0.f);
856 auto _c10_ = (~(_c8_))&(_c9_);
857 ret = if_then_else(ret_mask & I32(_c10_), 0.f, ret);
858 ret_mask &= ~I32(_c10_);
859 _c9_ = (~(_c8_))&(~(_c9_));
860 ret = if_then_else(ret_mask & I32(_c9_), (1.f)-(min(1.f, ((1.f)-(Cb))/(Cs))), ret);
861 ret_mask &= ~I32(_c9_);
862 return ret;
863}
864Float ColorDodge(Float Cb, Float Cs) {
865 I32 ret_mask = ~0;
866 Float ret;
867 auto _c14_ = (Cb)==(0.f);
868 ret = 0.f;
869 ret_mask = ~I32(_c14_);
870 auto _c15_ = (Cs)==(1.f);
871 auto _c16_ = (~(_c14_))&(_c15_);
872 ret = if_then_else(ret_mask & I32(_c16_), 1.f, ret);
873 ret_mask &= ~I32(_c16_);
874 _c15_ = (~(_c14_))&(~(_c15_));
875 ret = if_then_else(ret_mask & I32(_c15_), min(1.f, (Cb)/((1.f)-(Cs))), ret);
876 ret_mask &= ~I32(_c15_);
877 return ret;
878}
879vec3 Multiply(vec3 Cb, vec3 Cs) {
880 return (Cb)*(Cs);
881}
882vec3 Screen(vec3 Cb, vec3 Cs) {
883 return ((Cb)+(Cs))-((Cb)*(Cs));
884}
885vec3 HardLight(vec3 Cb, vec3 Cs) {
886 vec3 m = Multiply(Cb, (2.f)*(Cs));
887 vec3 s = Screen(Cb, ((2.f)*(Cs))-(1.f));
888 vec3_scalar edge = make_vec3(0.5f, 0.5f, 0.5f);
889 return mix(m, s, step(edge, Cs));
890}
891void SetSatInner(Float& Cmin, Float& Cmid, Float& Cmax, Float s, I32 _cond_mask_) {
892 auto _c37_ = (Cmax)>(Cmin);
893 auto _c38_ = (_cond_mask_)&(_c37_);
894 {
895 Cmid = if_then_else(_c38_,(((Cmid)-(Cmin))*(s))/((Cmax)-(Cmin)),Cmid);
896 Cmax = if_then_else(_c38_,s,Cmax);
897 }
898 _c37_ = (_cond_mask_)&(~(_c37_));
899 {
900 Cmid = if_then_else(_c37_,0.f,Cmid);
901 Cmax = if_then_else(_c37_,0.f,Cmax);
902 }
903 Cmin = if_then_else(_cond_mask_,0.f,Cmin);
904}
905vec3 SetSat(vec3 C, Float s) {
906 auto _c26_ = ((C).x)<=((C).y);
907 {
908 auto _c27_ = ((C).y)<=((C).z);
909 auto _c28_ = (_c26_)&(_c27_);
910 {
911 SetSatInner((C).x, (C).y, (C).z, s, _c28_);
912 }
913 _c27_ = (_c26_)&(~(_c27_));
914 {
915 auto _c29_ = ((C).x)<=((C).z);
916 auto _c30_ = (_c27_)&(_c29_);
917 {
918 SetSatInner((C).x, (C).z, (C).y, s, _c30_);
919 }
920 _c29_ = (_c27_)&(~(_c29_));
921 {
922 SetSatInner((C).z, (C).x, (C).y, s, _c29_);
923 }
924 }
925 }
926 {
927 auto _c31_ = ((C).x)<=((C).z);
928 auto _c32_ = (~(_c26_))&(_c31_);
929 {
930 SetSatInner((C).y, (C).x, (C).z, s, _c32_);
931 }
932 _c31_ = (~(_c26_))&(~(_c31_));
933 {
934 auto _c33_ = ((C).y)<=((C).z);
935 auto _c34_ = (_c31_)&(_c33_);
936 {
937 SetSatInner((C).y, (C).z, (C).x, s, _c34_);
938 }
939 _c33_ = (_c31_)&(~(_c33_));
940 {
941 SetSatInner((C).z, (C).y, (C).x, s, _c33_);
942 }
943 }
944 }
945 return C;
946}
947Float Sat(vec3 c) {
948 return (max((c).x, max((c).y, (c).z)))-(min((c).x, min((c).y, (c).z)));
949}
950vec3 Hue(vec3 Cb, vec3 Cs) {
951 return SetLum(SetSat(Cs, Sat(Cb)), Lum(Cb));
952}
953vec3 Luminosity(vec3 Cb, vec3 Cs) {
954 return SetLum(Cb, Lum(Cs));
955}
956vec3 Saturation(vec3 Cb, vec3 Cs) {
957 return SetLum(SetSat(Cb, Sat(Cs)), Lum(Cb));
958}
959Float SoftLight(Float Cb, Float Cs) {
960 I32 ret_mask = ~0;
961 Float ret;
962 auto _c42_ = (Cs)<=(0.5f);
963 {
964 ret = (Cb)-((((1.f)-((2.f)*(Cs)))*(Cb))*((1.f)-(Cb)));
965 ret_mask = ~I32(_c42_);
966 }
967 {
968 Float D;
969 auto _c43_ = (Cb)<=(0.25f);
970 auto _c44_ = (~(_c42_))&(_c43_);
971 D = if_then_else(_c44_,(((((16.f)*(Cb))-(12.f))*(Cb))+(4.f))*(Cb),D);
972 _c43_ = (~(_c42_))&(~(_c43_));
973 D = if_then_else(_c43_,sqrt__glsl_sqrt(Cb),D);
974 ret = if_then_else(ret_mask & I32(~(_c42_)), (Cb)+((((2.f)*(Cs))-(1.f))*((D)-(Cb))), ret);
975 ret_mask &= ~I32(~(_c42_));
Value stored to 'ret_mask' is never read
976 }
977 return ret;
978}
979vec4 fetch_from_gpu_buffer_1f_direct(ivec2 uv) {
980 return texelFetch(sGpuBufferF, uv, 0);
981}
982vec2 rect_repeat(vec2 p, vec2_scalar p0, vec2_scalar p1) {
983 vec2 r = (p)-(p0);
984 vec2_scalar s = (p1)-(p0);
985 vec2_scalar is = (1.f)/(max(s, make_vec2(0.000001f)));
986 return (p0)+((s)*(fract((is)*(r))));
987}
988vec3 LinearToSrgb(vec3 color) {
989 vec3 c1 = (color)*(12.92f);
990 vec3 c2 = ((make_vec3(1.055f))*(pow__glsl_pow(color, make_vec3((1.f)/(2.4f)))))-(make_vec3(0.055f));
991 return mix(c2, c1, lessThanEqual(color, make_vec3(0.0031308f)));
992}
993ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
994 vec4 Rs = make_vec4(0.f, 0.f, 0.f, 0.f);
995 vec4 Rb = make_vec4(0.f, 0.f, 0.f, 0.f);
996 vec4 Ns = make_vec4(0.f, 0.f, 0.f, 0.f);
997 vec4 Nb = make_vec4(0.f, 0.f, 0.f, 0.f);
998 ivec4 k;
999 if (((vFilterInputCountFilterKindVec).x)>(0)) {
1000 {
1001 Rs = sampleInUvRect(sColor0, vInput1Uv, vInput1UvRect);
1002 (Ns).lsel(R,G,B) = ((Rs).sel(R,G,B))*((1.f)/(max(0.000001f, (Rs).w)));
1003 (Ns).w = (Rs).w;
1004 if ((((vFilterInputCountFilterKindVec).y)&(1))!=(0)) {
1005 {
1006 (Ns).lsel(R,G,B) = SrgbToLinear((Ns).sel(R,G,B));
1007 (Rs).lsel(R,G,B) = ((Ns).sel(R,G,B))*((Rs).w);
1008 }
1009 }
1010 }
1011 }
1012 if (((vFilterInputCountFilterKindVec).x)>(1)) {
1013 {
1014 Rb = sampleInUvRect(sColor1, vInput2Uv, vInput2UvRect);
1015 (Nb).lsel(R,G,B) = ((Rb).sel(R,G,B))*((1.f)/(max(0.000001f, (Rb).w)));
1016 (Nb).w = (Rb).w;
1017 if ((((vFilterInputCountFilterKindVec).y)&(1))!=(0)) {
1018 {
1019 (Nb).lsel(R,G,B) = SrgbToLinear((Nb).sel(R,G,B));
1020 (Rb).lsel(R,G,B) = ((Nb).sel(R,G,B))*((Rb).w);
1021 }
1022 }
1023 }
1024 }
1025 vec4 result = make_vec4(1.f, 0.f, 0.f, 1.f);
1026 if ((((vFilterInputCountFilterKindVec).y)==(0))||(((vFilterInputCountFilterKindVec).y)==(1))) {
1027 {
1028 result = Rs;
1029 }
1030 } else if ((((vFilterInputCountFilterKindVec).y)==(2))||(((vFilterInputCountFilterKindVec).y)==(3))) {
1031 {
1032 result = (Rs)*((vFloat0).x);
1033 }
1034 } else if ((((vFilterInputCountFilterKindVec).y)==(4))||(((vFilterInputCountFilterKindVec).y)==(5))) {
1035 {
1036 oFragColorgl_FragColor = make_vec4(0.f, 0.f, 0.f, (Rs).w);
1037 return;
1038 }
1039 } else if ((((vFilterInputCountFilterKindVec).y)==(6))||(((vFilterInputCountFilterKindVec).y)==(7))) {
1040 {
1041 (result).lsel(R,G,B) = Color((Nb).sel(R,G,B), (Ns).sel(R,G,B));
1042 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1043 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1044 }
1045 } else if ((((vFilterInputCountFilterKindVec).y)==(8))||(((vFilterInputCountFilterKindVec).y)==(9))) {
1046 {
1047 (result).lsel(R,G,B) = make_vec3(ColorBurn((Nb).x, (Ns).x), ColorBurn((Nb).y, (Ns).y), ColorBurn((Nb).z, (Ns).z));
1048 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1049 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1050 }
1051 } else if ((((vFilterInputCountFilterKindVec).y)==(10))||(((vFilterInputCountFilterKindVec).y)==(11))) {
1052 {
1053 (result).lsel(R,G,B) = make_vec3(ColorDodge((Nb).x, (Ns).x), ColorDodge((Nb).y, (Ns).y), ColorDodge((Nb).z, (Ns).z));
1054 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1055 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1056 }
1057 } else if ((((vFilterInputCountFilterKindVec).y)==(12))||(((vFilterInputCountFilterKindVec).y)==(13))) {
1058 {
1059 (result).lsel(R,G,B) = (((Rs).sel(R,G,B))+((Rb).sel(R,G,B)))-(max(((Rs).sel(R,G,B))*((Rb).w), ((Rb).sel(R,G,B))*((Rs).w)));
1060 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1061 }
1062 } else if ((((vFilterInputCountFilterKindVec).y)==(14))||(((vFilterInputCountFilterKindVec).y)==(15))) {
1063 {
1064 (result).lsel(R,G,B) = (((Rs).sel(R,G,B))+((Rb).sel(R,G,B)))-((2.f)*(min(((Rs).sel(R,G,B))*((Rb).w), ((Rb).sel(R,G,B))*((Rs).w))));
1065 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1066 }
1067 } else if ((((vFilterInputCountFilterKindVec).y)==(16))||(((vFilterInputCountFilterKindVec).y)==(17))) {
1068 {
1069 (result).lsel(R,G,B) = (((Rs).sel(R,G,B))+((Rb).sel(R,G,B)))-((2.f)*(((Rs).sel(R,G,B))*((Rb).sel(R,G,B))));
1070 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1071 }
1072 } else if ((((vFilterInputCountFilterKindVec).y)==(18))||(((vFilterInputCountFilterKindVec).y)==(19))) {
1073 {
1074 (result).lsel(R,G,B) = HardLight((Nb).sel(R,G,B), (Ns).sel(R,G,B));
1075 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1076 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1077 }
1078 } else if ((((vFilterInputCountFilterKindVec).y)==(20))||(((vFilterInputCountFilterKindVec).y)==(21))) {
1079 {
1080 (result).lsel(R,G,B) = Hue((Nb).sel(R,G,B), (Ns).sel(R,G,B));
1081 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1082 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1083 }
1084 } else if ((((vFilterInputCountFilterKindVec).y)==(22))||(((vFilterInputCountFilterKindVec).y)==(23))) {
1085 {
1086 (result).lsel(R,G,B) = (((Rs).sel(R,G,B))+((Rb).sel(R,G,B)))-(min(((Rs).sel(R,G,B))*((Rb).w), ((Rb).sel(R,G,B))*((Rs).w)));
1087 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1088 }
1089 } else if ((((vFilterInputCountFilterKindVec).y)==(24))||(((vFilterInputCountFilterKindVec).y)==(25))) {
1090 {
1091 (result).lsel(R,G,B) = Luminosity((Nb).sel(R,G,B), (Ns).sel(R,G,B));
1092 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1093 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1094 }
1095 } else if ((((vFilterInputCountFilterKindVec).y)==(26))||(((vFilterInputCountFilterKindVec).y)==(27))) {
1096 {
1097 (result).lsel(R,G,B) = ((((Rs).sel(R,G,B))*((1.f)-((Rb).w)))+(((Rb).sel(R,G,B))*((1.f)-((Rs).w))))+(((Rs).sel(R,G,B))*((Rb).sel(R,G,B)));
1098 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1099 }
1100 } else if ((((vFilterInputCountFilterKindVec).y)==(28))||(((vFilterInputCountFilterKindVec).y)==(29))) {
1101 {
1102 result = ((Rb)*((1.f)-((Rs).w)))+(Rs);
1103 }
1104 } else if ((((vFilterInputCountFilterKindVec).y)==(30))||(((vFilterInputCountFilterKindVec).y)==(31))) {
1105 {
1106 (result).lsel(R,G,B) = HardLight((Ns).sel(R,G,B), (Nb).sel(R,G,B));
1107 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1108 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1109 }
1110 } else if ((((vFilterInputCountFilterKindVec).y)==(32))||(((vFilterInputCountFilterKindVec).y)==(33))) {
1111 {
1112 (result).lsel(R,G,B) = Saturation((Nb).sel(R,G,B), (Ns).sel(R,G,B));
1113 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1114 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1115 }
1116 } else if ((((vFilterInputCountFilterKindVec).y)==(34))||(((vFilterInputCountFilterKindVec).y)==(35))) {
1117 {
1118 (result).lsel(R,G,B) = (((Rs).sel(R,G,B))+((Rb).sel(R,G,B)))-(((Rs).sel(R,G,B))*((Rb).sel(R,G,B)));
1119 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1120 }
1121 } else if ((((vFilterInputCountFilterKindVec).y)==(36))||(((vFilterInputCountFilterKindVec).y)==(37))) {
1122 {
1123 (result).lsel(R,G,B) = make_vec3(SoftLight((Nb).x, (Ns).x), SoftLight((Nb).y, (Ns).y), SoftLight((Nb).z, (Ns).z));
1124 (result).lsel(R,G,B) = ((((1.f)-((Rb).w))*((Rs).sel(R,G,B)))+(((1.f)-((Rs).w))*((Rb).sel(R,G,B))))+((((Rs).w)*((Rb).w))*((result).sel(R,G,B)));
1125 (result).w = (((Rb).w)*((1.f)-((Rs).w)))+((Rs).w);
1126 }
1127 } else if ((((vFilterInputCountFilterKindVec).y)==(38))||(((vFilterInputCountFilterKindVec).y)==(39))) {
1128 {
1129 result = ((vColorMat)*(Ns))+(vFilterData0);
1130 result = clamp(result, make_vec4(0.f), make_vec4(1.f));
1131 (result).lsel(R,G,B) = ((result).sel(R,G,B))*((result).w);
1132 }
1133 } else if ((((vFilterInputCountFilterKindVec).y)==(40))||(((vFilterInputCountFilterKindVec).y)==(41))) {
1134 {
1135 result = floor__glsl_floor(clamp((Ns)*(255.f), make_vec4(0.f), make_vec4(255.f)));
1136 k = make_ivec4(make_int((result).x), make_int((result).y), make_int((result).z), make_int((result).w));
1137 (result).x = (fetch_from_gpu_buffer_1f_direct(((vData).sel(X,Y))+(make_ivec2((k).x, 0)))).x;
1138 (result).y = (fetch_from_gpu_buffer_1f_direct(((vData).sel(X,Y))+(make_ivec2((k).y, 0)))).y;
1139 (result).z = (fetch_from_gpu_buffer_1f_direct(((vData).sel(X,Y))+(make_ivec2((k).z, 0)))).z;
1140 (result).w = (fetch_from_gpu_buffer_1f_direct(((vData).sel(X,Y))+(make_ivec2((k).w, 0)))).w;
1141 (result).lsel(R,G,B) = ((result).sel(R,G,B))*((result).w);
1142 }
1143 } else if ((((vFilterInputCountFilterKindVec).y)==(42))||(((vFilterInputCountFilterKindVec).y)==(43))) {
1144 {
1145 result = (((((Rs)*(Rb))*((vFilterData0).x))+((Rs)*((vFilterData0).y)))+((Rb)*((vFilterData0).z)))+(make_vec4((vFilterData0).w));
1146 result = clamp(result, make_vec4(0.f), make_vec4(1.f));
1147 }
1148 } else if ((((vFilterInputCountFilterKindVec).y)==(44))||(((vFilterInputCountFilterKindVec).y)==(45))) {
1149 {
1150 result = ((Rs)*((Rb).w))+((Rb)*((1.f)-((Rs).w)));
1151 }
1152 } else if ((((vFilterInputCountFilterKindVec).y)==(46))||(((vFilterInputCountFilterKindVec).y)==(47))) {
1153 {
1154 result = (Rs)*((Rb).w);
1155 }
1156 } else if ((((vFilterInputCountFilterKindVec).y)==(48))||(((vFilterInputCountFilterKindVec).y)==(49))) {
1157 {
1158 result = (Rs)+(Rb);
1159 result = clamp(result, make_vec4(0.f), make_vec4(1.f));
1160 }
1161 } else if ((((vFilterInputCountFilterKindVec).y)==(50))||(((vFilterInputCountFilterKindVec).y)==(51))) {
1162 {
1163 result = (Rs)*((1.f)-((Rb).w));
1164 }
1165 } else if ((((vFilterInputCountFilterKindVec).y)==(52))||(((vFilterInputCountFilterKindVec).y)==(53))) {
1166 {
1167 result = (Rs)+((Rb)*((1.f)-((Rs).w)));
1168 }
1169 } else if ((((vFilterInputCountFilterKindVec).y)==(54))||(((vFilterInputCountFilterKindVec).y)==(55))) {
1170 {
1171 result = ((Rs)*((1.f)-((Rb).w)))+((Rb)*((1.f)-((Rs).w)));
1172 }
1173 } else if ((((vFilterInputCountFilterKindVec).y)==(56))||(((vFilterInputCountFilterKindVec).y)==(57))) {
1174 {
1175 }
1176 } else if ((((vFilterInputCountFilterKindVec).y)==(58))||(((vFilterInputCountFilterKindVec).y)==(59))) {
1177 {
1178 }
1179 } else if ((((vFilterInputCountFilterKindVec).y)==(60))||(((vFilterInputCountFilterKindVec).y)==(61))) {
1180 {
1181 }
1182 } else if ((((vFilterInputCountFilterKindVec).y)==(62))||(((vFilterInputCountFilterKindVec).y)==(63))) {
1183 {
1184 }
1185 } else if ((((vFilterInputCountFilterKindVec).y)==(64))||(((vFilterInputCountFilterKindVec).y)==(65))) {
1186 {
1187 }
1188 } else if ((((vFilterInputCountFilterKindVec).y)==(66))||(((vFilterInputCountFilterKindVec).y)==(67))) {
1189 {
1190 }
1191 } else if ((((vFilterInputCountFilterKindVec).y)==(68))||(((vFilterInputCountFilterKindVec).y)==(69))) {
1192 {
1193 }
1194 } else if ((((vFilterInputCountFilterKindVec).y)==(70))||(((vFilterInputCountFilterKindVec).y)==(71))) {
1195 {
1196 result = (Rs)+((vFilterData0)*(((Rb).w)*((1.f)-((Rs).w))));
1197 }
1198 } else if ((((vFilterInputCountFilterKindVec).y)==(72))||(((vFilterInputCountFilterKindVec).y)==(73))) {
1199 {
1200 result = vFilterData0;
1201 }
1202 } else if ((((vFilterInputCountFilterKindVec).y)==(74))||(((vFilterInputCountFilterKindVec).y)==(75))) {
1203 {
1204 }
1205 } else if ((((vFilterInputCountFilterKindVec).y)==(76))||(((vFilterInputCountFilterKindVec).y)==(77))) {
1206 {
1207 }
1208 } else if ((((vFilterInputCountFilterKindVec).y)==(80))||(((vFilterInputCountFilterKindVec).y)==(81))) {
1209 {
1210 }
1211 } else if ((((vFilterInputCountFilterKindVec).y)==(82))||(((vFilterInputCountFilterKindVec).y)==(83))) {
1212 {
1213 }
1214 } else if ((((vFilterInputCountFilterKindVec).y)==(86))||(((vFilterInputCountFilterKindVec).y)==(87))) {
1215 {
1216 }
1217 } else if ((((vFilterInputCountFilterKindVec).y)==(88))||(((vFilterInputCountFilterKindVec).y)==(89))) {
1218 {
1219 }
1220 } else if ((((vFilterInputCountFilterKindVec).y)==(90))||(((vFilterInputCountFilterKindVec).y)==(91))) {
1221 {
1222 }
1223 } else if ((((vFilterInputCountFilterKindVec).y)==(92))||(((vFilterInputCountFilterKindVec).y)==(93))) {
1224 {
1225 vec2 tileUv = rect_repeat(vInput1Uv, (vInput1UvRect).sel(X,Y), (vInput1UvRect).sel(Z,W));
1226 oFragColorgl_FragColor = sampleInUvRect(sColor0, tileUv, vInput1UvRect);
1227 return;
1228 }
1229 } else if ((((vFilterInputCountFilterKindVec).y)==(94))||(((vFilterInputCountFilterKindVec).y)==(95))) {
1230 {
1231 }
1232 } else if ((((vFilterInputCountFilterKindVec).y)==(96))||(((vFilterInputCountFilterKindVec).y)==(97))) {
1233 {
1234 }
1235 } else if ((((vFilterInputCountFilterKindVec).y)==(98))||(((vFilterInputCountFilterKindVec).y)==(99))) {
1236 {
1237 }
1238 } else if ((((vFilterInputCountFilterKindVec).y)==(100))||(((vFilterInputCountFilterKindVec).y)==(101))) {
1239 {
1240 }
1241 }
1242 if ((((vFilterInputCountFilterKindVec).y)&(1))!=(0)) {
1243 {
1244 (result).lsel(R,G,B) = (LinearToSrgb(((result).sel(R,G,B))*((1.f)/(max(0.000001f, (result).w)))))*((result).w);
1245 }
1246 }
1247 oFragColorgl_FragColor = result;
1248}
1249typedef cs_svg_filter_node_vert::InterpOutputs InterpInputs;
1250InterpInputs interp_step;
1251struct InterpPerspective {
1252vec2 vInput1Uv;
1253vec2 vInput2Uv;
1254};
1255InterpPerspective interp_perspective;
1256static 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_;
1257 self->vInput1Uv = init_interp(init->vInput1Uv, step->vInput1Uv);
1258 self->interp_step.vInput1Uv = step->vInput1Uv * 4.0f;
1259 self->vInput2Uv = init_interp(init->vInput2Uv, step->vInput2Uv);
1260 self->interp_step.vInput2Uv = step->vInput2Uv * 4.0f;
1261}
1262static 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_;
1263 Float w = 1.0f / self->gl_FragCoord.w;
1264 self->interp_perspective.vInput1Uv = init_interp(init->vInput1Uv, step->vInput1Uv);
1265 self->vInput1Uv = self->interp_perspective.vInput1Uv * w;
1266 self->interp_step.vInput1Uv = step->vInput1Uv * 4.0f;
1267 self->interp_perspective.vInput2Uv = init_interp(init->vInput2Uv, step->vInput2Uv);
1268 self->vInput2Uv = self->interp_perspective.vInput2Uv * w;
1269 self->interp_step.vInput2Uv = step->vInput2Uv * 4.0f;
1270}
1271ALWAYS_INLINE__attribute__((always_inline)) inline void step_interp_inputs(int steps = 4) {
1272 float chunks = steps * 0.25f;
1273 vInput1Uv += interp_step.vInput1Uv * chunks;
1274 vInput2Uv += interp_step.vInput2Uv * chunks;
1275}
1276ALWAYS_INLINE__attribute__((always_inline)) inline void step_perspective_inputs(int steps = 4) {
1277 step_perspective(steps);
1278 float chunks = steps * 0.25f;
1279 Float w = 1.0f / gl_FragCoord.w;
1280 interp_perspective.vInput1Uv += interp_step.vInput1Uv * chunks;
1281 vInput1Uv = w * interp_perspective.vInput1Uv;
1282 interp_perspective.vInput2Uv += interp_step.vInput2Uv * chunks;
1283 vInput2Uv = w * interp_perspective.vInput2Uv;
1284}
1285static void run(FragmentShaderImpl* impl) {
1286 Self* self = (Self*)impl;
1287 self->main();
1288 self->step_interp_inputs();
1289}
1290static void skip(FragmentShaderImpl* impl, int steps) {
1291 Self* self = (Self*)impl;
1292 self->step_interp_inputs(steps);
1293}
1294static void run_perspective(FragmentShaderImpl* impl) {
1295 Self* self = (Self*)impl;
1296 self->main();
1297 self->step_perspective_inputs();
1298}
1299static void skip_perspective(FragmentShaderImpl* impl, int steps) {
1300 Self* self = (Self*)impl;
1301 self->step_perspective_inputs(steps);
1302}
1303public:
1304cs_svg_filter_node_frag() {
1305 init_span_func = &read_interp_inputs;
1306 run_func = &run;
1307 skip_func = &skip;
1308 enable_perspective();
1309 init_span_w_func = &read_perspective_inputs;
1310 run_w_func = &run_perspective;
1311 skip_w_func = &skip_perspective;
1312}
1313};
1314
1315struct cs_svg_filter_node_program : ProgramImpl, cs_svg_filter_node_frag {
1316int get_uniform(const char *name) const override {
1317 if (strcmp("sClipMask", name) == 0) { return 8; }
1318 if (strcmp("sColor0", name) == 0) { return 9; }
1319 if (strcmp("sColor1", name) == 0) { return 10; }
1320 if (strcmp("sGpuBufferF", name) == 0) { return 3; }
1321 if (strcmp("sGpuBufferI", name) == 0) { return 4; }
1322 if (strcmp("sPrimitiveHeadersF", name) == 0) { return 5; }
1323 if (strcmp("sPrimitiveHeadersI", name) == 0) { return 6; }
1324 if (strcmp("sRenderTasks", name) == 0) { return 1; }
1325 if (strcmp("sTransformPalette", name) == 0) { return 2; }
1326 if (strcmp("uTransform", name) == 0) { return 7; }
1327 return -1;
1328}
1329void bind_attrib(const char* name, int index) override {
1330 attrib_locations.bind_loc(name, index);
1331}
1332int get_attrib(const char* name) const override {
1333 return attrib_locations.get_loc(name);
1334}
1335size_t interpolants_size() const override { return sizeof(InterpOutputs); }
1336VertexShaderImpl* get_vertex_shader() override {
1337 return this;
1338}
1339FragmentShaderImpl* get_fragment_shader() override {
1340 return this;
1341}
1342const char* get_name() const override { return "cs_svg_filter_node"; }
1343static ProgramImpl* loader() { return new cs_svg_filter_node_program; }
1344};
1345