Bug Summary

File:var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/swgl-6f6517a85091acb7/out/brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV.h
Warning:line 2, column 8
Excessive padding in 'struct brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_common::Samplers' (36 padding bytes, where 4 is optimal). Optimal fields order: sPrimitiveHeadersI_impl, sClipMask_impl, sColor0_impl, sColor1_impl, sColor2_impl, sGpuCache_impl, sPrimitiveHeadersF_impl, sRenderTasks_impl, sTransformPalette_impl, sClipMask_slot, sColor0_slot, sColor1_slot, sColor2_slot, sGpuCache_slot, sPrimitiveHeadersF_slot, sPrimitiveHeadersI_slot, sRenderTasks_slot, sTransformPalette_slot, consider reordering the fields or adding explicit padding members

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name gl.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -fapprox-func -funsafe-math-optimizations -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -fno-rounding-math -mrecip=none -complex-range=basic -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/var/lib/jenkins/workspace/firefox-scan-build/gfx/wr/swgl -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/var/lib/jenkins/workspace/firefox-scan-build/gfx/wr/swgl -resource-dir /usr/lib/llvm-19/lib/clang/19 -include /var/lib/jenkins/workspace/firefox-scan-build/config/gcc_hidden.h -include /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -D MOZILLA_CONFIG_H -I /var/lib/jenkins/workspace/firefox-scan-build/gfx/wr/swgl/../webrender/res -I src -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/swgl-6f6517a85091acb7/out -U MOZILLA_CONFIG_H -D _GLIBCXX_USE_CXX11_ABI=0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-deprecated-this-capture -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -std=c++17 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2024-09-22-115206-3586786-1 -x c++ src/gl.cc
1struct brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_common {
2struct Samplers {
Excessive padding in 'struct brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_common::Samplers' (36 padding bytes, where 4 is optimal). Optimal fields order: sPrimitiveHeadersI_impl, sClipMask_impl, sColor0_impl, sColor1_impl, sColor2_impl, sGpuCache_impl, sPrimitiveHeadersF_impl, sRenderTasks_impl, sTransformPalette_impl, sClipMask_slot, sColor0_slot, sColor1_slot, sColor2_slot, sGpuCache_slot, sPrimitiveHeadersF_slot, sPrimitiveHeadersI_slot, sRenderTasks_slot, sTransformPalette_slot, consider reordering the fields or adding explicit padding members
3 sampler2D_impl sClipMask_impl;
4 int sClipMask_slot;
5 sampler2DRect_impl sColor0_impl;
6 int sColor0_slot;
7 sampler2DRect_impl sColor1_impl;
8 int sColor1_slot;
9 sampler2DRect_impl sColor2_impl;
10 int sColor2_slot;
11 sampler2D_impl sGpuCache_impl;
12 int sGpuCache_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 7:
24 sClipMask_slot = value;
25 return true;
26 case 8:
27 sColor0_slot = value;
28 return true;
29 case 9:
30 sColor1_slot = value;
31 return true;
32 case 10:
33 sColor2_slot = value;
34 return true;
35 case 2:
36 sGpuCache_slot = value;
37 return true;
38 case 4:
39 sPrimitiveHeadersF_slot = value;
40 return true;
41 case 5:
42 sPrimitiveHeadersI_slot = value;
43 return true;
44 case 1:
45 sRenderTasks_slot = value;
46 return true;
47 case 3:
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 void bind_loc(const char* name, int index) {
58 if (strcmp("aPosition", name) == 0) { aPosition = index; return; }
59 if (strcmp("aData", name) == 0) { aData = index; return; }
60 }
61 int get_loc(const char* name) const {
62 if (strcmp("aPosition", name) == 0) { return aPosition != NULL_ATTRIB16 ? aPosition : -1; }
63 if (strcmp("aData", name) == 0) { return aData != NULL_ATTRIB16 ? aData : -1; }
64 return -1;
65 }
66} attrib_locations;
67vec4_scalar vTransformBounds;
68vec4_scalar vUvBounds_Y;
69vec4_scalar vUvBounds_U;
70vec4_scalar vUvBounds_V;
71vec3_scalar vYcbcrBias;
72mat3_scalar vRgbFromDebiasedYcbcr;
73ivec2_scalar vFormat;
74int32_t vRescaleFactor;
75sampler2D sClipMask;
76sampler2DRect sColor0;
77sampler2DRect sColor1;
78sampler2DRect sColor2;
79sampler2D sGpuCache;
80sampler2D sPrimitiveHeadersF;
81isampler2D sPrimitiveHeadersI;
82sampler2D sRenderTasks;
83sampler2D sTransformPalette;
84mat4_scalar uTransform;
85void bind_textures() {
86 sClipMask = lookup_sampler(&samplers.sClipMask_impl, samplers.sClipMask_slot);
87 sColor0 = lookup_sampler(&samplers.sColor0_impl, samplers.sColor0_slot);
88 sColor1 = lookup_sampler(&samplers.sColor1_impl, samplers.sColor1_slot);
89 sColor2 = lookup_sampler(&samplers.sColor2_impl, samplers.sColor2_slot);
90 sGpuCache = lookup_sampler(&samplers.sGpuCache_impl, samplers.sGpuCache_slot);
91 sPrimitiveHeadersF = lookup_sampler(&samplers.sPrimitiveHeadersF_impl, samplers.sPrimitiveHeadersF_slot);
92 sPrimitiveHeadersI = lookup_isampler(&samplers.sPrimitiveHeadersI_impl, samplers.sPrimitiveHeadersI_slot);
93 sRenderTasks = lookup_sampler(&samplers.sRenderTasks_impl, samplers.sRenderTasks_slot);
94 sTransformPalette = lookup_sampler(&samplers.sTransformPalette_impl, samplers.sTransformPalette_slot);
95}
96};
97struct brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert : VertexShaderImpl, brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_common {
98private:
99typedef brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert Self;
100// mat4_scalar uTransform;
101vec2 aPosition;
102// sampler2DRect sColor0;
103// sampler2DRect sColor1;
104// sampler2DRect sColor2;
105struct RectWithSize_scalar {
106vec2_scalar p0;
107vec2_scalar size;
108RectWithSize_scalar() = default;
109RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){}
110};
111struct RectWithSize {
112vec2 p0;
113vec2 size;
114RectWithSize() = default;
115RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){}
116RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){
117}
118IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){
119}
120friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize(
121if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size));
122}};
123struct RectWithEndpoint_scalar {
124vec2_scalar p0;
125vec2_scalar p1;
126RectWithEndpoint_scalar() = default;
127RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){}
128};
129struct RectWithEndpoint {
130vec2 p0;
131vec2 p1;
132RectWithEndpoint() = default;
133RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){}
134RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){
135}
136IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){
137}
138friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint(
139if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1));
140}};
141// sampler2D sRenderTasks;
142struct RenderTaskData_scalar {
143RectWithEndpoint_scalar task_rect;
144vec4_scalar user_data;
145RenderTaskData_scalar() = default;
146RenderTaskData_scalar(RectWithEndpoint_scalar task_rect, vec4_scalar user_data) : task_rect(task_rect), user_data(user_data){}
147};
148struct RenderTaskData {
149RectWithEndpoint task_rect;
150vec4 user_data;
151RenderTaskData() = default;
152RenderTaskData(RectWithEndpoint task_rect, vec4 user_data) : task_rect(task_rect), user_data(user_data){}
153RenderTaskData(RectWithEndpoint_scalar task_rect, vec4_scalar user_data):task_rect(task_rect),user_data(user_data){
154}
155IMPLICIT RenderTaskData(RenderTaskData_scalar s):task_rect(s.task_rect),user_data(s.user_data){
156}
157friend RenderTaskData if_then_else(I32 c, RenderTaskData t, RenderTaskData e) { return RenderTaskData(
158if_then_else(c, t.task_rect, e.task_rect), if_then_else(c, t.user_data, e.user_data));
159}};
160struct PictureTask_scalar {
161RectWithEndpoint_scalar task_rect;
162float device_pixel_scale;
163vec2_scalar content_origin;
164PictureTask_scalar() = default;
165PictureTask_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){}
166};
167struct PictureTask {
168RectWithEndpoint task_rect;
169Float device_pixel_scale;
170vec2 content_origin;
171PictureTask() = default;
172PictureTask(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 content_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), content_origin(content_origin){}
173PictureTask(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){
174}
175IMPLICIT PictureTask(PictureTask_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),content_origin(s.content_origin){
176}
177friend PictureTask if_then_else(I32 c, PictureTask t, PictureTask e) { return PictureTask(
178if_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));
179}};
180struct ClipArea_scalar {
181RectWithEndpoint_scalar task_rect;
182float device_pixel_scale;
183vec2_scalar screen_origin;
184ClipArea_scalar() = default;
185ClipArea_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){}
186};
187struct ClipArea {
188RectWithEndpoint task_rect;
189Float device_pixel_scale;
190vec2 screen_origin;
191ClipArea() = default;
192ClipArea(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 screen_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), screen_origin(screen_origin){}
193ClipArea(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){
194}
195IMPLICIT ClipArea(ClipArea_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),screen_origin(s.screen_origin){
196}
197friend ClipArea if_then_else(I32 c, ClipArea t, ClipArea e) { return ClipArea(
198if_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));
199}};
200// sampler2D sGpuCache;
201struct ImageSource_scalar {
202RectWithEndpoint_scalar uv_rect;
203vec4_scalar user_data;
204ImageSource_scalar() = default;
205ImageSource_scalar(RectWithEndpoint_scalar uv_rect, vec4_scalar user_data) : uv_rect(uv_rect), user_data(user_data){}
206};
207struct ImageSource {
208RectWithEndpoint uv_rect;
209vec4 user_data;
210ImageSource() = default;
211ImageSource(RectWithEndpoint uv_rect, vec4 user_data) : uv_rect(uv_rect), user_data(user_data){}
212ImageSource(RectWithEndpoint_scalar uv_rect, vec4_scalar user_data):uv_rect(uv_rect),user_data(user_data){
213}
214IMPLICIT ImageSource(ImageSource_scalar s):uv_rect(s.uv_rect),user_data(s.user_data){
215}
216friend ImageSource if_then_else(I32 c, ImageSource t, ImageSource e) { return ImageSource(
217if_then_else(c, t.uv_rect, e.uv_rect), if_then_else(c, t.user_data, e.user_data));
218}};
219struct ImageSourceExtra_scalar {
220vec4_scalar st_tl;
221vec4_scalar st_tr;
222vec4_scalar st_bl;
223vec4_scalar st_br;
224ImageSourceExtra_scalar() = default;
225ImageSourceExtra_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){}
226};
227struct ImageSourceExtra {
228vec4 st_tl;
229vec4 st_tr;
230vec4 st_bl;
231vec4 st_br;
232ImageSourceExtra() = default;
233ImageSourceExtra(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){}
234ImageSourceExtra(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){
235}
236IMPLICIT ImageSourceExtra(ImageSourceExtra_scalar s):st_tl(s.st_tl),st_tr(s.st_tr),st_bl(s.st_bl),st_br(s.st_br){
237}
238friend ImageSourceExtra if_then_else(I32 c, ImageSourceExtra t, ImageSourceExtra e) { return ImageSourceExtra(
239if_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));
240}};
241// vec4_scalar vTransformBounds;
242// sampler2D sTransformPalette;
243struct Transform_scalar {
244mat4_scalar m;
245mat4_scalar inv_m;
246bool is_axis_aligned;
247Transform_scalar() = default;
248Transform_scalar(mat4_scalar m, mat4_scalar inv_m, bool is_axis_aligned) : m(m), inv_m(inv_m), is_axis_aligned(is_axis_aligned){}
249};
250struct Transform {
251mat4 m;
252mat4 inv_m;
253Bool is_axis_aligned;
254Transform() = default;
255Transform(mat4 m, mat4 inv_m, Bool is_axis_aligned) : m(m), inv_m(inv_m), is_axis_aligned(is_axis_aligned){}
256Transform(mat4_scalar m, mat4_scalar inv_m, bool is_axis_aligned):m(m),inv_m(inv_m),is_axis_aligned(is_axis_aligned){
257}
258IMPLICIT Transform(Transform_scalar s):m(s.m),inv_m(s.inv_m),is_axis_aligned(s.is_axis_aligned){
259}
260friend Transform if_then_else(I32 c, Transform t, Transform e) { return Transform(
261if_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));
262}};
263// sampler2D sClipMask;
264// sampler2D sPrimitiveHeadersF;
265// isampler2D sPrimitiveHeadersI;
266ivec4_scalar aData;
267struct Instance_scalar {
268int32_t prim_header_address;
269int32_t clip_address;
270int32_t segment_index;
271int32_t flags;
272int32_t resource_address;
273int32_t brush_kind;
274Instance_scalar() = default;
275Instance_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){}
276};
277struct Instance {
278I32 prim_header_address;
279I32 clip_address;
280I32 segment_index;
281I32 flags;
282I32 resource_address;
283I32 brush_kind;
284Instance() = default;
285Instance(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){}
286Instance(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){
287}
288IMPLICIT 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){
289}
290friend Instance if_then_else(I32 c, Instance t, Instance e) { return Instance(
291if_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));
292}};
293struct PrimitiveHeader_scalar {
294RectWithEndpoint_scalar local_rect;
295RectWithEndpoint_scalar local_clip_rect;
296float z;
297int32_t specific_prim_address;
298int32_t transform_id;
299int32_t picture_task_address;
300ivec4_scalar user_data;
301PrimitiveHeader_scalar() = default;
302PrimitiveHeader_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){}
303};
304struct PrimitiveHeader {
305RectWithEndpoint local_rect;
306RectWithEndpoint local_clip_rect;
307Float z;
308I32 specific_prim_address;
309I32 transform_id;
310I32 picture_task_address;
311ivec4 user_data;
312PrimitiveHeader() = default;
313PrimitiveHeader(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){}
314PrimitiveHeader(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){
315}
316IMPLICIT 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){
317}
318friend PrimitiveHeader if_then_else(I32 c, PrimitiveHeader t, PrimitiveHeader e) { return PrimitiveHeader(
319if_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));
320}};
321struct VertexInfo_scalar {
322vec2_scalar local_pos;
323vec4_scalar world_pos;
324VertexInfo_scalar() = default;
325VertexInfo_scalar(vec2_scalar local_pos, vec4_scalar world_pos) : local_pos(local_pos), world_pos(world_pos){}
326};
327struct VertexInfo {
328vec2 local_pos;
329vec4 world_pos;
330VertexInfo() = default;
331VertexInfo(vec2 local_pos, vec4 world_pos) : local_pos(local_pos), world_pos(world_pos){}
332VertexInfo(vec2_scalar local_pos, vec4_scalar world_pos):local_pos(local_pos),world_pos(world_pos){
333}
334IMPLICIT VertexInfo(VertexInfo_scalar s):local_pos(s.local_pos),world_pos(s.world_pos){
335}
336friend VertexInfo if_then_else(I32 c, VertexInfo t, VertexInfo e) { return VertexInfo(
337if_then_else(c, t.local_pos, e.local_pos), if_then_else(c, t.world_pos, e.world_pos));
338}};
339mat3_scalar static constexpr RgbFromYuv_Rec601 = make_mat3(1.f, 1.f, 1.f, 0.f, -(0.17207f), 0.886f, 0.701f, -(0.35707f), 0.f);
340mat3_scalar static constexpr RgbFromYuv_Rec709 = make_mat3(1.f, 1.f, 1.f, 0.f, -(0.09366f), 0.9278f, 0.7874f, -(0.23406f), 0.f);
341mat3_scalar static constexpr RgbFromYuv_Rec2020 = make_mat3(1.f, 1.f, 1.f, 0.f, -(0.08228f), 0.9407f, 0.7373f, -(0.28568f), 0.f);
342mat3_scalar static constexpr RgbFromYuv_GbrIdentity = make_mat3(0.f, 1.f, 0.f, 0.f, 0.f, 1.f, 1.f, 0.f, 0.f);
343struct YuvPrimitive_scalar {
344int32_t channel_bit_depth;
345int32_t color_space;
346int32_t yuv_format;
347YuvPrimitive_scalar() = default;
348YuvPrimitive_scalar(int32_t channel_bit_depth, int32_t color_space, int32_t yuv_format) : channel_bit_depth(channel_bit_depth), color_space(color_space), yuv_format(yuv_format){}
349};
350struct YuvPrimitive {
351I32 channel_bit_depth;
352I32 color_space;
353I32 yuv_format;
354YuvPrimitive() = default;
355YuvPrimitive(I32 channel_bit_depth, I32 color_space, I32 yuv_format) : channel_bit_depth(channel_bit_depth), color_space(color_space), yuv_format(yuv_format){}
356YuvPrimitive(int32_t channel_bit_depth, int32_t color_space, int32_t yuv_format):channel_bit_depth(channel_bit_depth),color_space(color_space),yuv_format(yuv_format){
357}
358IMPLICIT YuvPrimitive(YuvPrimitive_scalar s):channel_bit_depth(s.channel_bit_depth),color_space(s.color_space),yuv_format(s.yuv_format){
359}
360friend YuvPrimitive if_then_else(I32 c, YuvPrimitive t, YuvPrimitive e) { return YuvPrimitive(
361if_then_else(c, t.channel_bit_depth, e.channel_bit_depth), if_then_else(c, t.color_space, e.color_space), if_then_else(c, t.yuv_format, e.yuv_format));
362}};
363struct YuvColorSamplingInfo_scalar {
364mat3_scalar rgb_from_yuv;
365vec4_scalar packed_zero_one_vals;
366YuvColorSamplingInfo_scalar() = default;
367YuvColorSamplingInfo_scalar(mat3_scalar rgb_from_yuv, vec4_scalar packed_zero_one_vals) : rgb_from_yuv(rgb_from_yuv), packed_zero_one_vals(packed_zero_one_vals){}
368};
369struct YuvColorSamplingInfo {
370mat3 rgb_from_yuv;
371vec4 packed_zero_one_vals;
372YuvColorSamplingInfo() = default;
373YuvColorSamplingInfo(mat3 rgb_from_yuv, vec4 packed_zero_one_vals) : rgb_from_yuv(rgb_from_yuv), packed_zero_one_vals(packed_zero_one_vals){}
374YuvColorSamplingInfo(mat3_scalar rgb_from_yuv, vec4_scalar packed_zero_one_vals):rgb_from_yuv(rgb_from_yuv),packed_zero_one_vals(packed_zero_one_vals){
375}
376IMPLICIT YuvColorSamplingInfo(YuvColorSamplingInfo_scalar s):rgb_from_yuv(s.rgb_from_yuv),packed_zero_one_vals(s.packed_zero_one_vals){
377}
378friend YuvColorSamplingInfo if_then_else(I32 c, YuvColorSamplingInfo t, YuvColorSamplingInfo e) { return YuvColorSamplingInfo(
379if_then_else(c, t.rgb_from_yuv, e.rgb_from_yuv), if_then_else(c, t.packed_zero_one_vals, e.packed_zero_one_vals));
380}};
381struct YuvColorMatrixInfo_scalar {
382vec3_scalar ycbcr_bias;
383mat3_scalar rgb_from_debiased_ycbrc;
384YuvColorMatrixInfo_scalar() = default;
385YuvColorMatrixInfo_scalar(vec3_scalar ycbcr_bias, mat3_scalar rgb_from_debiased_ycbrc) : ycbcr_bias(ycbcr_bias), rgb_from_debiased_ycbrc(rgb_from_debiased_ycbrc){}
386};
387struct YuvColorMatrixInfo {
388vec3 ycbcr_bias;
389mat3 rgb_from_debiased_ycbrc;
390YuvColorMatrixInfo() = default;
391YuvColorMatrixInfo(vec3 ycbcr_bias, mat3 rgb_from_debiased_ycbrc) : ycbcr_bias(ycbcr_bias), rgb_from_debiased_ycbrc(rgb_from_debiased_ycbrc){}
392YuvColorMatrixInfo(vec3_scalar ycbcr_bias, mat3_scalar rgb_from_debiased_ycbrc):ycbcr_bias(ycbcr_bias),rgb_from_debiased_ycbrc(rgb_from_debiased_ycbrc){
393}
394IMPLICIT YuvColorMatrixInfo(YuvColorMatrixInfo_scalar s):ycbcr_bias(s.ycbcr_bias),rgb_from_debiased_ycbrc(s.rgb_from_debiased_ycbrc){
395}
396friend YuvColorMatrixInfo if_then_else(I32 c, YuvColorMatrixInfo t, YuvColorMatrixInfo e) { return YuvColorMatrixInfo(
397if_then_else(c, t.ycbcr_bias, e.ycbcr_bias), if_then_else(c, t.rgb_from_debiased_ycbrc, e.rgb_from_debiased_ycbrc));
398}};
399vec2 vUv_Y;
400// vec4_scalar vUvBounds_Y;
401vec2 vUv_U;
402// vec4_scalar vUvBounds_U;
403vec2 vUv_V;
404// vec4_scalar vUvBounds_V;
405// vec3_scalar vYcbcrBias;
406// mat3_scalar vRgbFromDebiasedYcbcr;
407// ivec2_scalar vFormat;
408// int32_t vRescaleFactor;
409Instance_scalar decode_instance_attributes() {
410 Instance_scalar instance;
411 (instance).prim_header_address = (aData).x;
412 (instance).clip_address = (aData).y;
413 (instance).segment_index = ((aData).z)&(65535);
414 (instance).flags = ((aData).z)>>(16);
415 (instance).resource_address = ((aData).w)&(16777215);
416 (instance).brush_kind = ((aData).w)>>(24);
417 return instance;
418}
419PrimitiveHeader_scalar fetch_prim_header(int32_t index) {
420 PrimitiveHeader_scalar ph;
421 ivec2_scalar uv_f = make_ivec2(make_int((2u)*((make_uint(index))%((1024u)/(2u)))), make_int((make_uint(index))/((1024u)/(2u))));
422 auto sPrimitiveHeadersF_uv_f_fetch = texelFetchPtr(sPrimitiveHeadersF, uv_f, 0, 1, 0, 0);
423 vec4_scalar local_rect = texelFetchUnchecked(sPrimitiveHeadersF, sPrimitiveHeadersF_uv_f_fetch, 0, 0);
424 vec4_scalar local_clip_rect = texelFetchUnchecked(sPrimitiveHeadersF, sPrimitiveHeadersF_uv_f_fetch, 1, 0);
425 (ph).local_rect = RectWithEndpoint_scalar((local_rect).sel(X,Y), (local_rect).sel(Z,W));
426 (ph).local_clip_rect = RectWithEndpoint_scalar((local_clip_rect).sel(X,Y), (local_clip_rect).sel(Z,W));
427 ivec2_scalar uv_i = make_ivec2(make_int((2u)*((make_uint(index))%((1024u)/(2u)))), make_int((make_uint(index))/((1024u)/(2u))));
428 auto sPrimitiveHeadersI_uv_i_fetch = texelFetchPtr(sPrimitiveHeadersI, uv_i, 0, 1, 0, 0);
429 ivec4_scalar data0 = texelFetchUnchecked(sPrimitiveHeadersI, sPrimitiveHeadersI_uv_i_fetch, 0, 0);
430 ivec4_scalar data1 = texelFetchUnchecked(sPrimitiveHeadersI, sPrimitiveHeadersI_uv_i_fetch, 1, 0);
431 (ph).z = make_float((data0).x);
432 (ph).specific_prim_address = (data0).y;
433 (ph).transform_id = (data0).z;
434 (ph).picture_task_address = (data0).w;
435 (ph).user_data = data1;
436 return ph;
437}
438Transform_scalar fetch_transform(int32_t id) {
439 Transform_scalar transform;
440 (transform).is_axis_aligned = ((id)>>(23))==(0);
441 int32_t index = (id)&(8388607);
442 ivec2_scalar uv = make_ivec2(make_int((8u)*((make_uint(index))%((1024u)/(8u)))), make_int((make_uint(index))/((1024u)/(8u))));
443 ivec2_scalar uv0 = make_ivec2(((uv).x)+(0), (uv).y);
444 auto sTransformPalette_uv0_fetch = texelFetchPtr(sTransformPalette, uv0, 0, 7, 0, 0);
445 (transform).m[0] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 0, 0);
446 (transform).m[1] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 1, 0);
447 (transform).m[2] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 2, 0);
448 (transform).m[3] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 3, 0);
449 (transform).inv_m[0] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 4, 0);
450 (transform).inv_m[1] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 5, 0);
451 (transform).inv_m[2] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 6, 0);
452 (transform).inv_m[3] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 7, 0);
453 return transform;
454}
455RenderTaskData_scalar fetch_render_task_data(int32_t index) {
456 ivec2_scalar uv = make_ivec2(make_int((2u)*((make_uint(index))%((1024u)/(2u)))), make_int((make_uint(index))/((1024u)/(2u))));
457 auto sRenderTasks_uv_fetch = texelFetchPtr(sRenderTasks, uv, 0, 1, 0, 0);
458 vec4_scalar texel0 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 0, 0);
459 vec4_scalar texel1 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 1, 0);
460 RectWithEndpoint_scalar task_rect = RectWithEndpoint_scalar((texel0).sel(X,Y), (texel0).sel(Z,W));
461 RenderTaskData_scalar data = RenderTaskData_scalar(task_rect, texel1);
462 return data;
463}
464PictureTask_scalar fetch_picture_task(int32_t address) {
465 RenderTaskData_scalar task_data = fetch_render_task_data(address);
466 PictureTask_scalar task = PictureTask_scalar((task_data).task_rect, ((task_data).user_data).x, ((task_data).user_data).sel(Y,Z));
467 return task;
468}
469ClipArea_scalar fetch_clip_area(int32_t index) {
470 RenderTaskData_scalar task_data;
471 if ((index)>=(2147483647)) {
472 {
473 task_data = RenderTaskData_scalar(RectWithEndpoint_scalar(make_vec2(0.f), make_vec2(0.f)), make_vec4(0.f));
474 }
475 } else {
476 task_data = fetch_render_task_data(index);
477 }
478 return ClipArea_scalar((task_data).task_rect, ((task_data).user_data).x, ((task_data).user_data).sel(Y,Z));
479}
480ivec2_scalar get_gpu_cache_uv(int32_t address) {
481 return make_ivec2((make_uint(address))%(1024u), (make_uint(address))/(1024u));
482}
483Array<vec4_scalar,2> fetch_from_gpu_cache_2(int32_t address) {
484 ivec2_scalar uv = get_gpu_cache_uv(address);
485 auto sGpuCache_uv_fetch = texelFetchPtr(sGpuCache, uv, 0, 1, 0, 0);
486 return Array<vec4_scalar,2>{{texelFetchUnchecked(sGpuCache, sGpuCache_uv_fetch, 0, 0), texelFetchUnchecked(sGpuCache, sGpuCache_uv_fetch, 1, 0)}};
487}
488RectWithEndpoint_scalar clip_and_init_antialiasing(RectWithEndpoint_scalar segment_rect, RectWithEndpoint_scalar prim_rect, RectWithEndpoint_scalar clip_rect, int32_t edge_flags, float z, Transform_scalar transform, PictureTask_scalar task) {
489 bvec4_scalar clipped = make_bvec4(greaterThan((clip_rect).p0, (segment_rect).p0), lessThan((clip_rect).p1, (segment_rect).p1));
490 swgl_antiAlias((edge_flags)|(((clipped).x ? 1 : 0)|(((clipped).y ? 2 : 0)|(((clipped).z ? 4 : 0)|((clipped).w ? 8 : 0)))))do { swgl_AAEdgeMask = calcAAEdgeMask((edge_flags)|(((clipped
).x ? 1 : 0)|(((clipped).y ? 2 : 0)|(((clipped).z ? 4 : 0)|((
clipped).w ? 8 : 0))))); if (swgl_AAEdgeMask) { swgl_ClipFlags
|= SWGL_CLIP_FLAG_AA; } } while (0)
;
491 (segment_rect).p0 = clamp((segment_rect).p0, (clip_rect).p0, (clip_rect).p1);
492 (segment_rect).p1 = clamp((segment_rect).p1, (clip_rect).p0, (clip_rect).p1);
493 return segment_rect;
494}
495vec2 rect_clamp(RectWithEndpoint_scalar rect, vec2 pt) {
496 return clamp(pt, (rect).p0, (rect).p1);
497}
498VertexInfo write_vertex(vec2 local_pos, RectWithEndpoint_scalar local_clip_rect, float z, Transform_scalar transform, PictureTask_scalar task) {
499 vec2 clamped_local_pos = rect_clamp(local_clip_rect, local_pos);
500 vec4 world_pos = ((transform).m)*(make_vec4(clamped_local_pos, 0.f, 1.f));
501 vec2 device_pos = ((world_pos).sel(X,Y))*((task).device_pixel_scale);
502 vec2_scalar final_offset = (-((task).content_origin))+(((task).task_rect).p0);
503 gl_Position = (uTransform)*(make_vec4((device_pos)+((final_offset)*((world_pos).w)), (z)*((world_pos).w), (world_pos).w));
504 VertexInfo vi = VertexInfo(clamped_local_pos, world_pos);
505 return vi;
506}
507vec2_scalar rect_size(RectWithEndpoint_scalar rect) {
508 return ((rect).p1)-((rect).p0);
509}
510void write_clip(vec4 world_pos, ClipArea_scalar area, PictureTask_scalar task) {
511 swgl_clipMask(sClipMask, ((((task).task_rect).p0)-((task).content_origin))-((((area).task_rect).p0)-((area).screen_origin)), ((area).task_rect).p0, rect_size((area).task_rect))do { if (rect_size((area).task_rect) != vec2_scalar(0.0f, 0.0f
)) { swgl_ClipFlags |= SWGL_CLIP_FLAG_MASK; swgl_ClipMask = sClipMask
; swgl_ClipMaskOffset = make_ivec2(((((task).task_rect).p0)-(
(task).content_origin))-((((area).task_rect).p0)-((area).screen_origin
))); swgl_ClipMaskBounds = IntRect(make_ivec2(((area).task_rect
).p0), make_ivec2(rect_size((area).task_rect))); } } while (0
)
;
512}
513vec4_scalar fetch_from_gpu_cache_1(int32_t address) {
514 ivec2_scalar uv = get_gpu_cache_uv(address);
515 return texelFetch(sGpuCache, uv, 0);
516}
517YuvPrimitive_scalar fetch_yuv_primitive(int32_t address) {
518 vec4_scalar data = fetch_from_gpu_cache_1(address);
519 int32_t channel_bit_depth = make_int((data).x);
520 int32_t color_space = make_int((data).y);
521 int32_t yuv_format = make_int((data).z);
522 return YuvPrimitive_scalar(channel_bit_depth, color_space, yuv_format);
523}
524vec4_scalar yuv_channel_zero_one_narrow_range(int32_t bit_depth, float channel_max) {
525 ivec4_scalar zero_one_ints = (make_ivec4(16, 128, 235, 240))<<((bit_depth)-(8));
526 return (make_vec4(zero_one_ints))/(channel_max);
527}
528vec4_scalar yuv_channel_zero_one_identity(int32_t bit_depth, float channel_max) {
529 float all_ones_normalized = (make_float(((1)<<(bit_depth))-(1)))/(channel_max);
530 return make_vec4(0.f, 0.f, all_ones_normalized, all_ones_normalized);
531}
532vec4_scalar yuv_channel_zero_one_full_range(int32_t bit_depth, float channel_max) {
533 vec4_scalar narrow = yuv_channel_zero_one_narrow_range(bit_depth, channel_max);
534 vec4_scalar identity = yuv_channel_zero_one_identity(bit_depth, channel_max);
535 return make_vec4(0.f, (narrow).y, (identity).z, (identity).w);
536}
537YuvColorSamplingInfo_scalar get_yuv_color_info(YuvPrimitive_scalar prim) {
538 float channel_max = 255.f;
539 if (((prim).channel_bit_depth)>(8)) {
540 {
541 if (((prim).yuv_format)==(1)) {
542 {
543 channel_max = make_float(((1)<<((prim).channel_bit_depth))-(1));
544 }
545 } else {
546 channel_max = 65535.f;
547 }
548 }
549 }
550 if (((prim).color_space)==(0)) {
551 {
552 return YuvColorSamplingInfo_scalar(RgbFromYuv_Rec601, yuv_channel_zero_one_narrow_range((prim).channel_bit_depth, channel_max));
553 }
554 } else if (((prim).color_space)==(1)) {
555 {
556 return YuvColorSamplingInfo_scalar(RgbFromYuv_Rec601, yuv_channel_zero_one_full_range((prim).channel_bit_depth, channel_max));
557 }
558 } else if (((prim).color_space)==(2)) {
559 {
560 return YuvColorSamplingInfo_scalar(RgbFromYuv_Rec709, yuv_channel_zero_one_narrow_range((prim).channel_bit_depth, channel_max));
561 }
562 } else if (((prim).color_space)==(3)) {
563 {
564 return YuvColorSamplingInfo_scalar(RgbFromYuv_Rec709, yuv_channel_zero_one_full_range((prim).channel_bit_depth, channel_max));
565 }
566 } else if (((prim).color_space)==(4)) {
567 {
568 return YuvColorSamplingInfo_scalar(RgbFromYuv_Rec2020, yuv_channel_zero_one_narrow_range((prim).channel_bit_depth, channel_max));
569 }
570 } else if (((prim).color_space)==(5)) {
571 {
572 return YuvColorSamplingInfo_scalar(RgbFromYuv_Rec2020, yuv_channel_zero_one_full_range((prim).channel_bit_depth, channel_max));
573 }
574 } else {
575 return YuvColorSamplingInfo_scalar(RgbFromYuv_GbrIdentity, yuv_channel_zero_one_identity((prim).channel_bit_depth, channel_max));
576 }
577}
578YuvColorMatrixInfo_scalar get_rgb_from_ycbcr_info(YuvPrimitive_scalar prim) {
579 YuvColorSamplingInfo_scalar info = get_yuv_color_info(prim);
580 vec2_scalar zero = ((info).packed_zero_one_vals).sel(X,Y);
581 vec2_scalar one = ((info).packed_zero_one_vals).sel(Z,W);
582 vec2_scalar scale = (1.f)/((one)-(zero));
583 YuvColorMatrixInfo_scalar mat_info;
584 (mat_info).ycbcr_bias = (zero).sel(X,Y,Y);
585 mat3_scalar yuv_from_debiased_ycbcr = make_mat3((scale).x, 0.f, 0.f, 0.f, (scale).y, 0.f, 0.f, 0.f, (scale).y);
586 (mat_info).rgb_from_debiased_ycbrc = ((info).rgb_from_yuv)*(yuv_from_debiased_ycbcr);
587 return mat_info;
588}
589ImageSource_scalar fetch_image_source(int32_t address) {
590 Array<vec4_scalar,2> data = fetch_from_gpu_cache_2(address);
591 RectWithEndpoint_scalar uv_rect = RectWithEndpoint_scalar((data[0]).sel(X,Y), (data[0]).sel(Z,W));
592 return ImageSource_scalar(uv_rect, data[1]);
593}
594void write_uv_rect(vec2_scalar uv0, vec2_scalar uv1, vec2 f, vec2_scalar texture_size, vec2& uv, vec4_scalar& uv_bounds) {
595 uv = mix(uv0, uv1, f);
596 uv_bounds = make_vec4((uv0)+(make_vec2(0.5f)), (uv1)-(make_vec2(0.5f)));
597}
598void brush_vs(VertexInfo vi, int32_t prim_address, RectWithEndpoint_scalar local_rect, RectWithEndpoint_scalar segment_rect, ivec4_scalar prim_user_data, int32_t specific_resource_address, mat4_scalar transform, PictureTask_scalar pic_task, int32_t brush_flags, vec4_scalar unused) {
599 vec2 f = (((vi).local_pos)-((local_rect).p0))/(rect_size(local_rect));
600 YuvPrimitive_scalar prim = fetch_yuv_primitive(prim_address);
601 vRescaleFactor = 0;
602 if ((((prim).channel_bit_depth)>(8))&&(((prim).yuv_format)!=(1))) {
603 {
604 vRescaleFactor = (16)-((prim).channel_bit_depth);
605 }
606 }
607 YuvColorMatrixInfo_scalar mat_info = get_rgb_from_ycbcr_info(prim);
608 vYcbcrBias = (mat_info).ycbcr_bias;
609 vRgbFromDebiasedYcbcr = (mat_info).rgb_from_debiased_ycbrc;
610 (vFormat).x = (prim).yuv_format;
611 if ((((vFormat).x)==(3))||(((vFormat).x)==(99))) {
612 {
613 ImageSource_scalar res_y = fetch_image_source((prim_user_data).x);
614 ImageSource_scalar res_u = fetch_image_source((prim_user_data).y);
615 ImageSource_scalar res_v = fetch_image_source((prim_user_data).z);
616 write_uv_rect(((res_y).uv_rect).p0, ((res_y).uv_rect).p1, f, make_vec2(1.f), vUv_Y, vUvBounds_Y);
617 write_uv_rect(((res_u).uv_rect).p0, ((res_u).uv_rect).p1, f, make_vec2(1.f), vUv_U, vUvBounds_U);
618 write_uv_rect(((res_v).uv_rect).p0, ((res_v).uv_rect).p1, f, make_vec2(1.f), vUv_V, vUvBounds_V);
619 }
620 } else if ((((vFormat).x)==(0))||(((vFormat).x)==(1))) {
621 {
622 ImageSource_scalar res_y = fetch_image_source((prim_user_data).x);
623 ImageSource_scalar res_u = fetch_image_source((prim_user_data).y);
624 write_uv_rect(((res_y).uv_rect).p0, ((res_y).uv_rect).p1, f, make_vec2(1.f), vUv_Y, vUvBounds_Y);
625 write_uv_rect(((res_u).uv_rect).p0, ((res_u).uv_rect).p1, f, make_vec2(1.f), vUv_U, vUvBounds_U);
626 }
627 } else if (((vFormat).x)==(4)) {
628 {
629 ImageSource_scalar res_y = fetch_image_source((prim_user_data).x);
630 write_uv_rect(((res_y).uv_rect).p0, ((res_y).uv_rect).p1, f, make_vec2(1.f), vUv_Y, vUvBounds_Y);
631 }
632 }
633}
634void brush_shader_main_vs(Instance_scalar instance, PrimitiveHeader_scalar ph, Transform_scalar transform, PictureTask_scalar pic_task, ClipArea_scalar clip_area) {
635 int32_t edge_flags = (((instance).flags)>>(12))&(15);
636 int32_t brush_flags = ((instance).flags)&(4095);
637 vec4_scalar segment_data;
638 RectWithEndpoint_scalar segment_rect;
639 if (((instance).segment_index)==(65535)) {
640 {
641 segment_rect = (ph).local_rect;
642 segment_data = make_vec4(0.f);
643 }
644 } else {
645 int32_t segment_address = (((ph).specific_prim_address)+(1))+(((instance).segment_index)*(2));
646 Array<vec4_scalar,2> segment_info = fetch_from_gpu_cache_2(segment_address);
647 segment_rect = RectWithEndpoint_scalar((segment_info[0]).sel(X,Y), (segment_info[0]).sel(Z,W));
648 (segment_rect).p0 += ((ph).local_rect).p0;
649 (segment_rect).p1 += ((ph).local_rect).p0;
650 segment_data = segment_info[1];
651 }
652 RectWithEndpoint_scalar adjusted_segment_rect = segment_rect;
653 bool antialiased = (!((transform).is_axis_aligned))||(((brush_flags)&(1024))!=(0));
654 if (antialiased) {
655 {
656 adjusted_segment_rect = clip_and_init_antialiasing(segment_rect, (ph).local_rect, (ph).local_clip_rect, edge_flags, (ph).z, transform, pic_task);
657 ((ph).local_clip_rect).p0 = make_vec2(-(10000000000000000.f));
658 ((ph).local_clip_rect).p1 = make_vec2(10000000000000000.f);
659 }
660 } else {
661 }
662 vec2 local_pos = mix((adjusted_segment_rect).p0, (adjusted_segment_rect).p1, (aPosition).sel(X,Y));
663 VertexInfo vi = write_vertex(local_pos, (ph).local_clip_rect, (ph).z, transform, pic_task);
664 write_clip((vi).world_pos, clip_area, pic_task);
665 brush_vs(vi, (ph).specific_prim_address, (ph).local_rect, segment_rect, (ph).user_data, (instance).resource_address, (transform).m, pic_task, brush_flags, segment_data);
666}
667ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
668 Instance_scalar instance = decode_instance_attributes();
669 PrimitiveHeader_scalar ph = fetch_prim_header((instance).prim_header_address);
670 Transform_scalar transform = fetch_transform((ph).transform_id);
671 PictureTask_scalar task = fetch_picture_task((ph).picture_task_address);
672 ClipArea_scalar clip_area = fetch_clip_area((instance).clip_address);
673 brush_shader_main_vs(instance, ph, transform, task, clip_area);
674}
675static void set_uniform_1i(VertexShaderImpl* impl, int index, int value) {
676 Self* self = (Self*)impl;
677 if (self->samplers.set_slot(index, value)) return;
678 switch (index) {
679 case 7:
680 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sClipMask
681 break;
682 case 8:
683 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
684 break;
685 case 9:
686 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor1
687 break;
688 case 10:
689 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor2
690 break;
691 case 2:
692 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuCache
693 break;
694 case 4:
695 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersF
696 break;
697 case 5:
698 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersI
699 break;
700 case 1:
701 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
702 break;
703 case 3:
704 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sTransformPalette
705 break;
706 case 6:
707 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
708 break;
709 }
710}
711static void set_uniform_4fv(VertexShaderImpl* impl, int index, const float *value) {
712 Self* self = (Self*)impl;
713 switch (index) {
714 case 7:
715 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sClipMask
716 break;
717 case 8:
718 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
719 break;
720 case 9:
721 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor1
722 break;
723 case 10:
724 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor2
725 break;
726 case 2:
727 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuCache
728 break;
729 case 4:
730 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersF
731 break;
732 case 5:
733 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersI
734 break;
735 case 1:
736 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
737 break;
738 case 3:
739 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sTransformPalette
740 break;
741 case 6:
742 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // uTransform
743 break;
744 }
745}
746static void set_uniform_matrix4fv(VertexShaderImpl* impl, int index, const float *value) {
747 Self* self = (Self*)impl;
748 switch (index) {
749 case 7:
750 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sClipMask
751 break;
752 case 8:
753 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor0
754 break;
755 case 9:
756 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor1
757 break;
758 case 10:
759 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sColor2
760 break;
761 case 2:
762 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sGpuCache
763 break;
764 case 4:
765 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersF
766 break;
767 case 5:
768 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sPrimitiveHeadersI
769 break;
770 case 1:
771 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sRenderTasks
772 break;
773 case 3:
774 assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0"
, __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__
))
; // sTransformPalette
775 break;
776 case 6:
777 self->uTransform = mat4_scalar::load_from_ptr(value);
778 break;
779 }
780}
781static void load_attribs(VertexShaderImpl* impl, VertexAttrib *attribs, uint32_t start, int instance, int count) {Self* self = (Self*)impl;
782 load_attrib(self->aPosition, attribs[self->attrib_locations.aPosition], start, instance, count);
783 load_flat_attrib(self->aData, attribs[self->attrib_locations.aData], start, instance, count);
784}
785public:
786struct InterpOutputs {
787vec2_scalar vUv_Y;
788vec2_scalar vUv_U;
789vec2_scalar vUv_V;
790};
791private:
792ALWAYS_INLINE__attribute__((always_inline)) inline void store_interp_outputs(char* dest_ptr, size_t stride) {
793 for(int n = 0; n < 4; n++) {
794 auto* dest = reinterpret_cast<InterpOutputs*>(dest_ptr);
795 dest->vUv_Y = get_nth(vUv_Y, n);
796 dest->vUv_U = get_nth(vUv_U, n);
797 dest->vUv_V = get_nth(vUv_V, n);
798 dest_ptr += stride;
799 }
800}
801static void run(VertexShaderImpl* impl, char* interps, size_t interp_stride) {
802 Self* self = (Self*)impl;
803 self->main();
804 self->store_interp_outputs(interps, interp_stride);
805}
806static void init_batch(VertexShaderImpl* impl) {
807 Self* self = (Self*)impl; self->bind_textures(); }
808public:
809brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert() {
810 set_uniform_1i_func = &set_uniform_1i;
811 set_uniform_4fv_func = &set_uniform_4fv;
812 set_uniform_matrix4fv_func = &set_uniform_matrix4fv;
813 init_batch_func = &init_batch;
814 load_attribs_func = &load_attribs;
815 run_primitive_func = &run;
816}
817};
818
819mat3_scalar constexpr brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert::RgbFromYuv_Rec601;
820mat3_scalar constexpr brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert::RgbFromYuv_Rec709;
821mat3_scalar constexpr brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert::RgbFromYuv_Rec2020;
822mat3_scalar constexpr brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert::RgbFromYuv_GbrIdentity;
823
824struct brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_frag : FragmentShaderImpl, brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert {
825private:
826typedef brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_frag Self;
827#define oFragColorgl_FragColor gl_FragColor
828// vec4 oFragColor;
829// sampler2DRect sColor0;
830// sampler2DRect sColor1;
831// sampler2DRect sColor2;
832struct RectWithSize_scalar {
833vec2_scalar p0;
834vec2_scalar size;
835RectWithSize_scalar() = default;
836RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){}
837};
838struct RectWithSize {
839vec2 p0;
840vec2 size;
841RectWithSize() = default;
842RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){}
843RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){
844}
845IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){
846}
847friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize(
848if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size));
849}};
850struct RectWithEndpoint_scalar {
851vec2_scalar p0;
852vec2_scalar p1;
853RectWithEndpoint_scalar() = default;
854RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){}
855};
856struct RectWithEndpoint {
857vec2 p0;
858vec2 p1;
859RectWithEndpoint() = default;
860RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){}
861RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){
862}
863IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){
864}
865friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint(
866if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1));
867}};
868// sampler2D sGpuCache;
869// vec4_scalar vTransformBounds;
870// sampler2D sClipMask;
871struct Fragment_scalar {
872vec4_scalar color;
873Fragment_scalar() = default;
874explicit Fragment_scalar(vec4_scalar color) : color(color){}
875};
876struct Fragment {
877vec4 color;
878Fragment() = default;
879explicit Fragment(vec4 color) : color(color){}
880explicit Fragment(vec4_scalar color):color(color){
881}
882IMPLICIT Fragment(Fragment_scalar s):color(s.color){
883}
884friend Fragment if_then_else(I32 c, Fragment t, Fragment e) { return Fragment(
885if_then_else(c, t.color, e.color));
886}};
887vec2 vUv_Y;
888// vec4_scalar vUvBounds_Y;
889vec2 vUv_U;
890// vec4_scalar vUvBounds_U;
891vec2 vUv_V;
892// vec4_scalar vUvBounds_V;
893// vec3_scalar vYcbcrBias;
894// mat3_scalar vRgbFromDebiasedYcbcr;
895// ivec2_scalar vFormat;
896// int32_t vRescaleFactor;
897ALWAYS_INLINE__attribute__((always_inline)) inline void main(void) {
898 oFragColorgl_FragColor = make_vec4(0.11f, 0.077f, 0.027f, 0.125f);
899}
900void swgl_drawSpanRGBA8() {
901 if (((vFormat).x)==(3)) {
902 {
903 swgl_commitTextureLinearYUV(sColor0, vUv_Y, vUvBounds_Y, sColor1, vUv_U, vUvBounds_U, sColor2, vUv_V, vUvBounds_V, vYcbcrBias, vRgbFromDebiasedYcbcr, vRescaleFactor)do { int drawn = 0; if (blend_key) { drawn = blendYUV<true
>(swgl_OutRGBA8, swgl_SpanLength, sColor0, vUv_Y, vUvBounds_Y
, sColor1, vUv_U, vUvBounds_U, sColor2, vUv_V, vUvBounds_V, vYcbcrBias
, vRgbFromDebiasedYcbcr, vRescaleFactor); } else { drawn = blendYUV
<false>(swgl_OutRGBA8, swgl_SpanLength, sColor0, vUv_Y,
vUvBounds_Y, sColor1, vUv_U, vUvBounds_U, sColor2, vUv_V, vUvBounds_V
, vYcbcrBias, vRgbFromDebiasedYcbcr, vRescaleFactor); } swgl_OutRGBA8
+= drawn; swgl_SpanLength -= drawn; } while (0)
;
904 }
905 } else if ((((vFormat).x)==(0))||(((vFormat).x)==(1))) {
906 {
907 swgl_commitTextureLinearYUV(sColor0, vUv_Y, vUvBounds_Y, sColor1, vUv_U, vUvBounds_U, vYcbcrBias, vRgbFromDebiasedYcbcr, vRescaleFactor)do { int drawn = 0; if (blend_key) { drawn = blendYUV<true
>(swgl_OutRGBA8, swgl_SpanLength, sColor0, vUv_Y, vUvBounds_Y
, sColor1, vUv_U, vUvBounds_U, vYcbcrBias, vRgbFromDebiasedYcbcr
, vRescaleFactor); } else { drawn = blendYUV<false>(swgl_OutRGBA8
, swgl_SpanLength, sColor0, vUv_Y, vUvBounds_Y, sColor1, vUv_U
, vUvBounds_U, vYcbcrBias, vRgbFromDebiasedYcbcr, vRescaleFactor
); } swgl_OutRGBA8 += drawn; swgl_SpanLength -= drawn; } while
(0)
;
908 }
909 } else if (((vFormat).x)==(4)) {
910 {
911 swgl_commitTextureLinearYUV(sColor0, vUv_Y, vUvBounds_Y, vYcbcrBias, vRgbFromDebiasedYcbcr, vRescaleFactor)do { int drawn = 0; if (blend_key) { drawn = blendYUV<true
>(swgl_OutRGBA8, swgl_SpanLength, sColor0, vUv_Y, vUvBounds_Y
, vYcbcrBias, vRgbFromDebiasedYcbcr, vRescaleFactor); } else {
drawn = blendYUV<false>(swgl_OutRGBA8, swgl_SpanLength
, sColor0, vUv_Y, vUvBounds_Y, vYcbcrBias, vRgbFromDebiasedYcbcr
, vRescaleFactor); } swgl_OutRGBA8 += drawn; swgl_SpanLength -=
drawn; } while (0)
;
912 }
913 }
914}
915typedef brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_vert::InterpOutputs InterpInputs;
916InterpInputs interp_step;
917struct InterpPerspective {
918vec2 vUv_Y;
919vec2 vUv_U;
920vec2 vUv_V;
921};
922InterpPerspective interp_perspective;
923static 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_;
924 self->vUv_Y = init_interp(init->vUv_Y, step->vUv_Y);
925 self->interp_step.vUv_Y = step->vUv_Y * 4.0f;
926 self->vUv_U = init_interp(init->vUv_U, step->vUv_U);
927 self->interp_step.vUv_U = step->vUv_U * 4.0f;
928 self->vUv_V = init_interp(init->vUv_V, step->vUv_V);
929 self->interp_step.vUv_V = step->vUv_V * 4.0f;
930}
931static 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_;
932 Float w = 1.0f / self->gl_FragCoord.w;
933 self->interp_perspective.vUv_Y = init_interp(init->vUv_Y, step->vUv_Y);
934 self->vUv_Y = self->interp_perspective.vUv_Y * w;
935 self->interp_step.vUv_Y = step->vUv_Y * 4.0f;
936 self->interp_perspective.vUv_U = init_interp(init->vUv_U, step->vUv_U);
937 self->vUv_U = self->interp_perspective.vUv_U * w;
938 self->interp_step.vUv_U = step->vUv_U * 4.0f;
939 self->interp_perspective.vUv_V = init_interp(init->vUv_V, step->vUv_V);
940 self->vUv_V = self->interp_perspective.vUv_V * w;
941 self->interp_step.vUv_V = step->vUv_V * 4.0f;
942}
943ALWAYS_INLINE__attribute__((always_inline)) inline void step_interp_inputs(int steps = 4) {
944 float chunks = steps * 0.25f;
945 vUv_Y += interp_step.vUv_Y * chunks;
946 vUv_U += interp_step.vUv_U * chunks;
947 vUv_V += interp_step.vUv_V * chunks;
948}
949ALWAYS_INLINE__attribute__((always_inline)) inline void step_perspective_inputs(int steps = 4) {
950 step_perspective(steps);
951 float chunks = steps * 0.25f;
952 Float w = 1.0f / gl_FragCoord.w;
953 interp_perspective.vUv_Y += interp_step.vUv_Y * chunks;
954 vUv_Y = w * interp_perspective.vUv_Y;
955 interp_perspective.vUv_U += interp_step.vUv_U * chunks;
956 vUv_U = w * interp_perspective.vUv_U;
957 interp_perspective.vUv_V += interp_step.vUv_V * chunks;
958 vUv_V = w * interp_perspective.vUv_V;
959}
960static void run(FragmentShaderImpl* impl) {
961 Self* self = (Self*)impl;
962 self->main();
963 self->step_interp_inputs();
964}
965static void skip(FragmentShaderImpl* impl, int steps) {
966 Self* self = (Self*)impl;
967 self->step_interp_inputs(steps);
968}
969static void run_perspective(FragmentShaderImpl* impl) {
970 Self* self = (Self*)impl;
971 self->main();
972 self->step_perspective_inputs();
973}
974static void skip_perspective(FragmentShaderImpl* impl, int steps) {
975 Self* self = (Self*)impl;
976 self->step_perspective_inputs(steps);
977}
978static int draw_span_RGBA8(FragmentShaderImpl* impl) {
979 Self* self = (Self*)impl; DISPATCH_DRAW_SPAN(self, RGBA8)do { int total = self->swgl_SpanLength; self->swgl_drawSpanRGBA8
(); int drawn = total - self->swgl_SpanLength; if (drawn) self
->step_interp_inputs(drawn); return drawn; } while (0)
; }
980public:
981brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_frag() {
982 init_span_func = &read_interp_inputs;
983 run_func = &run;
984 skip_func = &skip;
985 draw_span_RGBA8_func = &draw_span_RGBA8;
986 enable_perspective();
987 init_span_w_func = &read_perspective_inputs;
988 run_w_func = &run_perspective;
989 skip_w_func = &skip_perspective;
990}
991};
992
993struct brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_program : ProgramImpl, brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_frag {
994int get_uniform(const char *name) const override {
995 if (strcmp("sClipMask", name) == 0) { return 7; }
996 if (strcmp("sColor0", name) == 0) { return 8; }
997 if (strcmp("sColor1", name) == 0) { return 9; }
998 if (strcmp("sColor2", name) == 0) { return 10; }
999 if (strcmp("sGpuCache", name) == 0) { return 2; }
1000 if (strcmp("sPrimitiveHeadersF", name) == 0) { return 4; }
1001 if (strcmp("sPrimitiveHeadersI", name) == 0) { return 5; }
1002 if (strcmp("sRenderTasks", name) == 0) { return 1; }
1003 if (strcmp("sTransformPalette", name) == 0) { return 3; }
1004 if (strcmp("uTransform", name) == 0) { return 6; }
1005 return -1;
1006}
1007void bind_attrib(const char* name, int index) override {
1008 attrib_locations.bind_loc(name, index);
1009}
1010int get_attrib(const char* name) const override {
1011 return attrib_locations.get_loc(name);
1012}
1013size_t interpolants_size() const override { return sizeof(InterpOutputs); }
1014VertexShaderImpl* get_vertex_shader() override {
1015 return this;
1016}
1017FragmentShaderImpl* get_fragment_shader() override {
1018 return this;
1019}
1020const char* get_name() const override { return "brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV"; }
1021static ProgramImpl* loader() { return new brush_yuv_image_DEBUG_OVERDRAW_TEXTURE_RECT_YUV_program; }
1022};
1023