| File: | root/firefox-clang/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/build/swgl-250521f66641ef82/out/ps_quad_mix_blend_TEXTURE_2D.h |
| Warning: | line 804, column 3 Value stored to 'ret_mask' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | struct ps_quad_mix_blend_TEXTURE_2D_common { |
| 2 | struct Samplers { |
| 3 | sampler2D_impl sColor0_impl; |
| 4 | int sColor0_slot; |
| 5 | sampler2D_impl sColor1_impl; |
| 6 | int sColor1_slot; |
| 7 | sampler2D_impl sGpuBufferF_impl; |
| 8 | int sGpuBufferF_slot; |
| 9 | isampler2D_impl sGpuBufferI_impl; |
| 10 | int sGpuBufferI_slot; |
| 11 | sampler2D_impl sRenderTasks_impl; |
| 12 | int sRenderTasks_slot; |
| 13 | sampler2D_impl sTransformPalette_impl; |
| 14 | int sTransformPalette_slot; |
| 15 | bool set_slot(int index, int value) { |
| 16 | switch (index) { |
| 17 | case 6: |
| 18 | sColor0_slot = value; |
| 19 | return true; |
| 20 | case 7: |
| 21 | sColor1_slot = value; |
| 22 | return true; |
| 23 | case 3: |
| 24 | sGpuBufferF_slot = value; |
| 25 | return true; |
| 26 | case 4: |
| 27 | sGpuBufferI_slot = value; |
| 28 | return true; |
| 29 | case 2: |
| 30 | sRenderTasks_slot = value; |
| 31 | return true; |
| 32 | case 1: |
| 33 | sTransformPalette_slot = value; |
| 34 | return true; |
| 35 | } |
| 36 | return false; |
| 37 | } |
| 38 | } samplers; |
| 39 | struct AttribLocations { |
| 40 | int aPosition = NULL_ATTRIB16; |
| 41 | int aData = NULL_ATTRIB16; |
| 42 | void bind_loc(const char* name, int index) { |
| 43 | if (strcmp("aPosition", name) == 0) { aPosition = index; return; } |
| 44 | if (strcmp("aData", name) == 0) { aData = index; return; } |
| 45 | } |
| 46 | int get_loc(const char* name) const { |
| 47 | if (strcmp("aPosition", name) == 0) { return aPosition != NULL_ATTRIB16 ? aPosition : -1; } |
| 48 | if (strcmp("aData", name) == 0) { return aData != NULL_ATTRIB16 ? aData : -1; } |
| 49 | return -1; |
| 50 | } |
| 51 | } attrib_locations; |
| 52 | vec4_scalar vTransformBounds; |
| 53 | vec4_scalar v_color; |
| 54 | ivec4_scalar v_flags; |
| 55 | vec4_scalar v_backdrop_uv_bounds; |
| 56 | vec4_scalar v_src_uv_bounds; |
| 57 | ivec2_scalar v_op; |
| 58 | sampler2D sColor0; |
| 59 | sampler2D sColor1; |
| 60 | sampler2D sGpuBufferF; |
| 61 | isampler2D sGpuBufferI; |
| 62 | sampler2D sRenderTasks; |
| 63 | sampler2D sTransformPalette; |
| 64 | mat4_scalar uTransform; |
| 65 | void bind_textures() { |
| 66 | sColor0 = lookup_sampler(&samplers.sColor0_impl, samplers.sColor0_slot); |
| 67 | sColor1 = lookup_sampler(&samplers.sColor1_impl, samplers.sColor1_slot); |
| 68 | sGpuBufferF = lookup_sampler(&samplers.sGpuBufferF_impl, samplers.sGpuBufferF_slot); |
| 69 | sGpuBufferI = lookup_isampler(&samplers.sGpuBufferI_impl, samplers.sGpuBufferI_slot); |
| 70 | sRenderTasks = lookup_sampler(&samplers.sRenderTasks_impl, samplers.sRenderTasks_slot); |
| 71 | sTransformPalette = lookup_sampler(&samplers.sTransformPalette_impl, samplers.sTransformPalette_slot); |
| 72 | } |
| 73 | }; |
| 74 | struct ps_quad_mix_blend_TEXTURE_2D_vert : VertexShaderImpl, ps_quad_mix_blend_TEXTURE_2D_common { |
| 75 | private: |
| 76 | typedef ps_quad_mix_blend_TEXTURE_2D_vert Self; |
| 77 | // mat4_scalar uTransform; |
| 78 | vec2 aPosition; |
| 79 | // sampler2D sColor0; |
| 80 | // sampler2D sColor1; |
| 81 | // sampler2D sColor2; |
| 82 | struct RectWithSize_scalar { |
| 83 | vec2_scalar p0; |
| 84 | vec2_scalar size; |
| 85 | RectWithSize_scalar() = default; |
| 86 | RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){} |
| 87 | }; |
| 88 | struct RectWithSize { |
| 89 | vec2 p0; |
| 90 | vec2 size; |
| 91 | RectWithSize() = default; |
| 92 | RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){} |
| 93 | RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){ |
| 94 | } |
| 95 | IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){ |
| 96 | } |
| 97 | friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize( |
| 98 | if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size)); |
| 99 | }}; |
| 100 | struct RectWithEndpoint_scalar { |
| 101 | vec2_scalar p0; |
| 102 | vec2_scalar p1; |
| 103 | RectWithEndpoint_scalar() = default; |
| 104 | RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){} |
| 105 | }; |
| 106 | struct RectWithEndpoint { |
| 107 | vec2 p0; |
| 108 | vec2 p1; |
| 109 | RectWithEndpoint() = default; |
| 110 | RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){} |
| 111 | RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){ |
| 112 | } |
| 113 | IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){ |
| 114 | } |
| 115 | friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint( |
| 116 | if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1)); |
| 117 | }}; |
| 118 | // vec4_scalar vTransformBounds; |
| 119 | // sampler2D sTransformPalette; |
| 120 | struct Transform_scalar { |
| 121 | mat4_scalar m; |
| 122 | mat4_scalar inv_m; |
| 123 | bool is_axis_aligned; |
| 124 | Transform_scalar() = default; |
| 125 | Transform_scalar(mat4_scalar m, mat4_scalar inv_m, bool is_axis_aligned) : m(m), inv_m(inv_m), is_axis_aligned(is_axis_aligned){} |
| 126 | }; |
| 127 | struct Transform { |
| 128 | mat4 m; |
| 129 | mat4 inv_m; |
| 130 | Bool is_axis_aligned; |
| 131 | Transform() = default; |
| 132 | Transform(mat4 m, mat4 inv_m, Bool is_axis_aligned) : m(m), inv_m(inv_m), is_axis_aligned(is_axis_aligned){} |
| 133 | Transform(mat4_scalar m, mat4_scalar inv_m, bool is_axis_aligned):m(m),inv_m(inv_m),is_axis_aligned(is_axis_aligned){ |
| 134 | } |
| 135 | IMPLICIT Transform(Transform_scalar s):m(s.m),inv_m(s.inv_m),is_axis_aligned(s.is_axis_aligned){ |
| 136 | } |
| 137 | friend Transform if_then_else(I32 c, Transform t, Transform e) { return Transform( |
| 138 | if_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)); |
| 139 | }}; |
| 140 | // sampler2D sRenderTasks; |
| 141 | struct RenderTaskData_scalar { |
| 142 | RectWithEndpoint_scalar task_rect; |
| 143 | vec4_scalar user_data; |
| 144 | RenderTaskData_scalar() = default; |
| 145 | RenderTaskData_scalar(RectWithEndpoint_scalar task_rect, vec4_scalar user_data) : task_rect(task_rect), user_data(user_data){} |
| 146 | }; |
| 147 | struct RenderTaskData { |
| 148 | RectWithEndpoint task_rect; |
| 149 | vec4 user_data; |
| 150 | RenderTaskData() = default; |
| 151 | RenderTaskData(RectWithEndpoint task_rect, vec4 user_data) : task_rect(task_rect), user_data(user_data){} |
| 152 | RenderTaskData(RectWithEndpoint_scalar task_rect, vec4_scalar user_data):task_rect(task_rect),user_data(user_data){ |
| 153 | } |
| 154 | IMPLICIT RenderTaskData(RenderTaskData_scalar s):task_rect(s.task_rect),user_data(s.user_data){ |
| 155 | } |
| 156 | friend RenderTaskData if_then_else(I32 c, RenderTaskData t, RenderTaskData e) { return RenderTaskData( |
| 157 | if_then_else(c, t.task_rect, e.task_rect), if_then_else(c, t.user_data, e.user_data)); |
| 158 | }}; |
| 159 | struct PictureTask_scalar { |
| 160 | RectWithEndpoint_scalar task_rect; |
| 161 | float device_pixel_scale; |
| 162 | vec2_scalar content_origin; |
| 163 | PictureTask_scalar() = default; |
| 164 | PictureTask_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){} |
| 165 | }; |
| 166 | struct PictureTask { |
| 167 | RectWithEndpoint task_rect; |
| 168 | Float device_pixel_scale; |
| 169 | vec2 content_origin; |
| 170 | PictureTask() = default; |
| 171 | PictureTask(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 content_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), content_origin(content_origin){} |
| 172 | PictureTask(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){ |
| 173 | } |
| 174 | IMPLICIT PictureTask(PictureTask_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),content_origin(s.content_origin){ |
| 175 | } |
| 176 | friend PictureTask if_then_else(I32 c, PictureTask t, PictureTask e) { return PictureTask( |
| 177 | if_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)); |
| 178 | }}; |
| 179 | struct ClipArea_scalar { |
| 180 | RectWithEndpoint_scalar task_rect; |
| 181 | float device_pixel_scale; |
| 182 | vec2_scalar screen_origin; |
| 183 | ClipArea_scalar() = default; |
| 184 | ClipArea_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){} |
| 185 | }; |
| 186 | struct ClipArea { |
| 187 | RectWithEndpoint task_rect; |
| 188 | Float device_pixel_scale; |
| 189 | vec2 screen_origin; |
| 190 | ClipArea() = default; |
| 191 | ClipArea(RectWithEndpoint task_rect, Float device_pixel_scale, vec2 screen_origin) : task_rect(task_rect), device_pixel_scale(device_pixel_scale), screen_origin(screen_origin){} |
| 192 | ClipArea(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){ |
| 193 | } |
| 194 | IMPLICIT ClipArea(ClipArea_scalar s):task_rect(s.task_rect),device_pixel_scale(s.device_pixel_scale),screen_origin(s.screen_origin){ |
| 195 | } |
| 196 | friend ClipArea if_then_else(I32 c, ClipArea t, ClipArea e) { return ClipArea( |
| 197 | if_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)); |
| 198 | }}; |
| 199 | // sampler2D sGpuBufferF; |
| 200 | // isampler2D sGpuBufferI; |
| 201 | // vec4_scalar v_color; |
| 202 | // ivec4_scalar v_flags; |
| 203 | ivec4_scalar aData; |
| 204 | struct QuadSegment_scalar { |
| 205 | RectWithEndpoint_scalar rect; |
| 206 | RectWithEndpoint_scalar uv_rect; |
| 207 | QuadSegment_scalar() = default; |
| 208 | QuadSegment_scalar(RectWithEndpoint_scalar rect, RectWithEndpoint_scalar uv_rect) : rect(rect), uv_rect(uv_rect){} |
| 209 | }; |
| 210 | struct QuadSegment { |
| 211 | RectWithEndpoint rect; |
| 212 | RectWithEndpoint uv_rect; |
| 213 | QuadSegment() = default; |
| 214 | QuadSegment(RectWithEndpoint rect, RectWithEndpoint uv_rect) : rect(rect), uv_rect(uv_rect){} |
| 215 | QuadSegment(RectWithEndpoint_scalar rect, RectWithEndpoint_scalar uv_rect):rect(rect),uv_rect(uv_rect){ |
| 216 | } |
| 217 | IMPLICIT QuadSegment(QuadSegment_scalar s):rect(s.rect),uv_rect(s.uv_rect){ |
| 218 | } |
| 219 | friend QuadSegment if_then_else(I32 c, QuadSegment t, QuadSegment e) { return QuadSegment( |
| 220 | if_then_else(c, t.rect, e.rect), if_then_else(c, t.uv_rect, e.uv_rect)); |
| 221 | }}; |
| 222 | struct PrimitiveInfo_scalar { |
| 223 | vec2_scalar local_pos; |
| 224 | RectWithEndpoint_scalar local_prim_rect; |
| 225 | RectWithEndpoint_scalar local_clip_rect; |
| 226 | QuadSegment_scalar segment; |
| 227 | int32_t edge_flags; |
| 228 | int32_t quad_flags; |
| 229 | ivec2_scalar pattern_input; |
| 230 | PrimitiveInfo_scalar() = default; |
| 231 | PrimitiveInfo_scalar(vec2_scalar local_pos, RectWithEndpoint_scalar local_prim_rect, RectWithEndpoint_scalar local_clip_rect, QuadSegment_scalar segment, int32_t edge_flags, int32_t quad_flags, ivec2_scalar pattern_input) : local_pos(local_pos), local_prim_rect(local_prim_rect), local_clip_rect(local_clip_rect), segment(segment), edge_flags(edge_flags), quad_flags(quad_flags), pattern_input(pattern_input){} |
| 232 | }; |
| 233 | struct PrimitiveInfo { |
| 234 | vec2 local_pos; |
| 235 | RectWithEndpoint local_prim_rect; |
| 236 | RectWithEndpoint local_clip_rect; |
| 237 | QuadSegment segment; |
| 238 | I32 edge_flags; |
| 239 | I32 quad_flags; |
| 240 | ivec2 pattern_input; |
| 241 | PrimitiveInfo() = default; |
| 242 | PrimitiveInfo(vec2 local_pos, RectWithEndpoint local_prim_rect, RectWithEndpoint local_clip_rect, QuadSegment segment, I32 edge_flags, I32 quad_flags, ivec2 pattern_input) : local_pos(local_pos), local_prim_rect(local_prim_rect), local_clip_rect(local_clip_rect), segment(segment), edge_flags(edge_flags), quad_flags(quad_flags), pattern_input(pattern_input){} |
| 243 | PrimitiveInfo(vec2_scalar local_pos, RectWithEndpoint_scalar local_prim_rect, RectWithEndpoint_scalar local_clip_rect, QuadSegment_scalar segment, int32_t edge_flags, int32_t quad_flags, ivec2_scalar pattern_input):local_pos(local_pos),local_prim_rect(local_prim_rect),local_clip_rect(local_clip_rect),segment(segment),edge_flags(edge_flags),quad_flags(quad_flags),pattern_input(pattern_input){ |
| 244 | } |
| 245 | IMPLICIT PrimitiveInfo(PrimitiveInfo_scalar s):local_pos(s.local_pos),local_prim_rect(s.local_prim_rect),local_clip_rect(s.local_clip_rect),segment(s.segment),edge_flags(s.edge_flags),quad_flags(s.quad_flags),pattern_input(s.pattern_input){ |
| 246 | } |
| 247 | friend PrimitiveInfo if_then_else(I32 c, PrimitiveInfo t, PrimitiveInfo e) { return PrimitiveInfo( |
| 248 | if_then_else(c, t.local_pos, e.local_pos), if_then_else(c, t.local_prim_rect, e.local_prim_rect), if_then_else(c, t.local_clip_rect, e.local_clip_rect), if_then_else(c, t.segment, e.segment), if_then_else(c, t.edge_flags, e.edge_flags), if_then_else(c, t.quad_flags, e.quad_flags), if_then_else(c, t.pattern_input, e.pattern_input)); |
| 249 | }}; |
| 250 | struct QuadPrimitive_scalar { |
| 251 | RectWithEndpoint_scalar bounds; |
| 252 | RectWithEndpoint_scalar pattern_rect; |
| 253 | RectWithEndpoint_scalar uv_rect; |
| 254 | vec4_scalar pattern_scale_offset; |
| 255 | vec4_scalar color; |
| 256 | QuadPrimitive_scalar() = default; |
| 257 | QuadPrimitive_scalar(RectWithEndpoint_scalar bounds, RectWithEndpoint_scalar pattern_rect, RectWithEndpoint_scalar uv_rect, vec4_scalar pattern_scale_offset, vec4_scalar color) : bounds(bounds), pattern_rect(pattern_rect), uv_rect(uv_rect), pattern_scale_offset(pattern_scale_offset), color(color){} |
| 258 | }; |
| 259 | struct QuadPrimitive { |
| 260 | RectWithEndpoint bounds; |
| 261 | RectWithEndpoint pattern_rect; |
| 262 | RectWithEndpoint uv_rect; |
| 263 | vec4 pattern_scale_offset; |
| 264 | vec4 color; |
| 265 | QuadPrimitive() = default; |
| 266 | QuadPrimitive(RectWithEndpoint bounds, RectWithEndpoint pattern_rect, RectWithEndpoint uv_rect, vec4 pattern_scale_offset, vec4 color) : bounds(bounds), pattern_rect(pattern_rect), uv_rect(uv_rect), pattern_scale_offset(pattern_scale_offset), color(color){} |
| 267 | QuadPrimitive(RectWithEndpoint_scalar bounds, RectWithEndpoint_scalar pattern_rect, RectWithEndpoint_scalar uv_rect, vec4_scalar pattern_scale_offset, vec4_scalar color):bounds(bounds),pattern_rect(pattern_rect),uv_rect(uv_rect),pattern_scale_offset(pattern_scale_offset),color(color){ |
| 268 | } |
| 269 | IMPLICIT QuadPrimitive(QuadPrimitive_scalar s):bounds(s.bounds),pattern_rect(s.pattern_rect),uv_rect(s.uv_rect),pattern_scale_offset(s.pattern_scale_offset),color(s.color){ |
| 270 | } |
| 271 | friend QuadPrimitive if_then_else(I32 c, QuadPrimitive t, QuadPrimitive e) { return QuadPrimitive( |
| 272 | if_then_else(c, t.bounds, e.bounds), if_then_else(c, t.pattern_rect, e.pattern_rect), if_then_else(c, t.uv_rect, e.uv_rect), if_then_else(c, t.pattern_scale_offset, e.pattern_scale_offset), if_then_else(c, t.color, e.color)); |
| 273 | }}; |
| 274 | struct QuadHeader_scalar { |
| 275 | int32_t transform_id; |
| 276 | int32_t z_id; |
| 277 | ivec2_scalar pattern_input; |
| 278 | QuadHeader_scalar() = default; |
| 279 | QuadHeader_scalar(int32_t transform_id, int32_t z_id, ivec2_scalar pattern_input) : transform_id(transform_id), z_id(z_id), pattern_input(pattern_input){} |
| 280 | }; |
| 281 | struct QuadHeader { |
| 282 | I32 transform_id; |
| 283 | I32 z_id; |
| 284 | ivec2 pattern_input; |
| 285 | QuadHeader() = default; |
| 286 | QuadHeader(I32 transform_id, I32 z_id, ivec2 pattern_input) : transform_id(transform_id), z_id(z_id), pattern_input(pattern_input){} |
| 287 | QuadHeader(int32_t transform_id, int32_t z_id, ivec2_scalar pattern_input):transform_id(transform_id),z_id(z_id),pattern_input(pattern_input){ |
| 288 | } |
| 289 | IMPLICIT QuadHeader(QuadHeader_scalar s):transform_id(s.transform_id),z_id(s.z_id),pattern_input(s.pattern_input){ |
| 290 | } |
| 291 | friend QuadHeader if_then_else(I32 c, QuadHeader t, QuadHeader e) { return QuadHeader( |
| 292 | if_then_else(c, t.transform_id, e.transform_id), if_then_else(c, t.z_id, e.z_id), if_then_else(c, t.pattern_input, e.pattern_input)); |
| 293 | }}; |
| 294 | struct QuadInstance_scalar { |
| 295 | int32_t prim_address_i; |
| 296 | int32_t prim_address_f; |
| 297 | int32_t quad_flags; |
| 298 | int32_t edge_flags; |
| 299 | int32_t part_index; |
| 300 | int32_t segment_index; |
| 301 | int32_t picture_task_address; |
| 302 | QuadInstance_scalar() = default; |
| 303 | QuadInstance_scalar(int32_t prim_address_i, int32_t prim_address_f, int32_t quad_flags, int32_t edge_flags, int32_t part_index, int32_t segment_index, int32_t picture_task_address) : prim_address_i(prim_address_i), prim_address_f(prim_address_f), quad_flags(quad_flags), edge_flags(edge_flags), part_index(part_index), segment_index(segment_index), picture_task_address(picture_task_address){} |
| 304 | }; |
| 305 | struct QuadInstance { |
| 306 | I32 prim_address_i; |
| 307 | I32 prim_address_f; |
| 308 | I32 quad_flags; |
| 309 | I32 edge_flags; |
| 310 | I32 part_index; |
| 311 | I32 segment_index; |
| 312 | I32 picture_task_address; |
| 313 | QuadInstance() = default; |
| 314 | QuadInstance(I32 prim_address_i, I32 prim_address_f, I32 quad_flags, I32 edge_flags, I32 part_index, I32 segment_index, I32 picture_task_address) : prim_address_i(prim_address_i), prim_address_f(prim_address_f), quad_flags(quad_flags), edge_flags(edge_flags), part_index(part_index), segment_index(segment_index), picture_task_address(picture_task_address){} |
| 315 | QuadInstance(int32_t prim_address_i, int32_t prim_address_f, int32_t quad_flags, int32_t edge_flags, int32_t part_index, int32_t segment_index, int32_t picture_task_address):prim_address_i(prim_address_i),prim_address_f(prim_address_f),quad_flags(quad_flags),edge_flags(edge_flags),part_index(part_index),segment_index(segment_index),picture_task_address(picture_task_address){ |
| 316 | } |
| 317 | IMPLICIT QuadInstance(QuadInstance_scalar s):prim_address_i(s.prim_address_i),prim_address_f(s.prim_address_f),quad_flags(s.quad_flags),edge_flags(s.edge_flags),part_index(s.part_index),segment_index(s.segment_index),picture_task_address(s.picture_task_address){ |
| 318 | } |
| 319 | friend QuadInstance if_then_else(I32 c, QuadInstance t, QuadInstance e) { return QuadInstance( |
| 320 | if_then_else(c, t.prim_address_i, e.prim_address_i), if_then_else(c, t.prim_address_f, e.prim_address_f), if_then_else(c, t.quad_flags, e.quad_flags), if_then_else(c, t.edge_flags, e.edge_flags), if_then_else(c, t.part_index, e.part_index), if_then_else(c, t.segment_index, e.segment_index), if_then_else(c, t.picture_task_address, e.picture_task_address)); |
| 321 | }}; |
| 322 | struct VertexInfo_scalar { |
| 323 | vec2_scalar local_pos; |
| 324 | VertexInfo_scalar() = default; |
| 325 | explicit VertexInfo_scalar(vec2_scalar local_pos) : local_pos(local_pos){} |
| 326 | }; |
| 327 | struct VertexInfo { |
| 328 | vec2 local_pos; |
| 329 | VertexInfo() = default; |
| 330 | explicit VertexInfo(vec2 local_pos) : local_pos(local_pos){} |
| 331 | explicit VertexInfo(vec2_scalar local_pos):local_pos(local_pos){ |
| 332 | } |
| 333 | IMPLICIT VertexInfo(VertexInfo_scalar s):local_pos(s.local_pos){ |
| 334 | } |
| 335 | friend VertexInfo if_then_else(I32 c, VertexInfo t, VertexInfo e) { return VertexInfo( |
| 336 | if_then_else(c, t.local_pos, e.local_pos)); |
| 337 | }}; |
| 338 | vec2 v_backdrop_uv; |
| 339 | // vec4_scalar v_backdrop_uv_bounds; |
| 340 | vec2 v_src_uv; |
| 341 | // vec4_scalar v_src_uv_bounds; |
| 342 | // ivec2_scalar v_op; |
| 343 | QuadInstance_scalar decode_instance() { |
| 344 | QuadInstance_scalar qi = QuadInstance_scalar((aData).x, (aData).y, (((aData).z)>>(24))&(255), (((aData).z)>>(16))&(255), (((aData).z)>>(8))&(255), (((aData).z)>>(0))&(255), (aData).w); |
| 345 | return qi; |
| 346 | } |
| 347 | ivec2_scalar get_gpu_buffer_uv(int32_t address) { |
| 348 | return make_ivec2((make_uint(address))%(1024u), (make_uint(address))/(1024u)); |
| 349 | } |
| 350 | ivec4_scalar fetch_from_gpu_buffer_1i(int32_t address) { |
| 351 | ivec2_scalar uv = get_gpu_buffer_uv(address); |
| 352 | return texelFetch(sGpuBufferI, uv, 0); |
| 353 | } |
| 354 | QuadHeader_scalar fetch_header(int32_t address) { |
| 355 | ivec4_scalar header = fetch_from_gpu_buffer_1i(address); |
| 356 | QuadHeader_scalar qh = QuadHeader_scalar((header).x, (header).y, (header).sel(Z,W)); |
| 357 | return qh; |
| 358 | } |
| 359 | Transform_scalar fetch_transform(int32_t id) { |
| 360 | Transform_scalar transform; |
| 361 | (transform).is_axis_aligned = ((id)>>(23))==(0); |
| 362 | int32_t index = (id)&(4194303); |
| 363 | ivec2_scalar uv = make_ivec2(make_int((8u)*((make_uint(index))%((1024u)/(8u)))), make_int((make_uint(index))/((1024u)/(8u)))); |
| 364 | ivec2_scalar uv0 = make_ivec2(((uv).x)+(0), (uv).y); |
| 365 | auto sTransformPalette_uv0_fetch = texelFetchPtr(sTransformPalette, uv0, 0, 7, 0, 0); |
| 366 | (transform).m[0] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 0, 0); |
| 367 | (transform).m[1] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 1, 0); |
| 368 | (transform).m[2] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 2, 0); |
| 369 | (transform).m[3] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 3, 0); |
| 370 | (transform).inv_m[0] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 4, 0); |
| 371 | (transform).inv_m[1] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 5, 0); |
| 372 | (transform).inv_m[2] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 6, 0); |
| 373 | (transform).inv_m[3] = texelFetchUnchecked(sTransformPalette, sTransformPalette_uv0_fetch, 7, 0); |
| 374 | return transform; |
| 375 | } |
| 376 | RenderTaskData_scalar fetch_render_task_data(int32_t index) { |
| 377 | ivec2_scalar uv = make_ivec2(make_int((2u)*((make_uint(index))%((1024u)/(2u)))), make_int((make_uint(index))/((1024u)/(2u)))); |
| 378 | auto sRenderTasks_uv_fetch = texelFetchPtr(sRenderTasks, uv, 0, 1, 0, 0); |
| 379 | vec4_scalar texel0 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 0, 0); |
| 380 | vec4_scalar texel1 = texelFetchUnchecked(sRenderTasks, sRenderTasks_uv_fetch, 1, 0); |
| 381 | RectWithEndpoint_scalar task_rect = RectWithEndpoint_scalar((texel0).sel(X,Y), (texel0).sel(Z,W)); |
| 382 | RenderTaskData_scalar data = RenderTaskData_scalar(task_rect, texel1); |
| 383 | return data; |
| 384 | } |
| 385 | PictureTask_scalar fetch_picture_task(int32_t address) { |
| 386 | RenderTaskData_scalar task_data = fetch_render_task_data(address); |
| 387 | PictureTask_scalar task = PictureTask_scalar((task_data).task_rect, ((task_data).user_data).x, ((task_data).user_data).sel(Y,Z)); |
| 388 | return task; |
| 389 | } |
| 390 | Array<vec4_scalar,5> fetch_from_gpu_buffer_5f_direct(ivec2_scalar uv) { |
| 391 | auto sGpuBufferF_uv_fetch = texelFetchPtr(sGpuBufferF, uv, 0, 4, 0, 0); |
| 392 | return Array<vec4_scalar,5>{{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), texelFetchUnchecked(sGpuBufferF, sGpuBufferF_uv_fetch, 4, 0)}}; |
| 393 | } |
| 394 | Array<vec4_scalar,5> fetch_from_gpu_buffer_5f(int32_t address) { |
| 395 | ivec2_scalar uv = get_gpu_buffer_uv(address); |
| 396 | return fetch_from_gpu_buffer_5f_direct(uv); |
| 397 | } |
| 398 | QuadPrimitive_scalar fetch_primitive(int32_t index) { |
| 399 | QuadPrimitive_scalar prim; |
| 400 | Array<vec4_scalar,5> texels = fetch_from_gpu_buffer_5f(index); |
| 401 | (prim).bounds = RectWithEndpoint_scalar((texels[0]).sel(X,Y), (texels[0]).sel(Z,W)); |
| 402 | (prim).pattern_rect = RectWithEndpoint_scalar((texels[1]).sel(X,Y), (texels[1]).sel(Z,W)); |
| 403 | (prim).uv_rect = RectWithEndpoint_scalar((texels[2]).sel(X,Y), (texels[2]).sel(Z,W)); |
| 404 | (prim).pattern_scale_offset = texels[3]; |
| 405 | (prim).color = texels[4]; |
| 406 | return prim; |
| 407 | } |
| 408 | Array<vec4_scalar,2> fetch_from_gpu_buffer_2f_direct(ivec2_scalar uv) { |
| 409 | auto sGpuBufferF_uv_fetch = texelFetchPtr(sGpuBufferF, uv, 0, 1, 0, 0); |
| 410 | return Array<vec4_scalar,2>{{texelFetchUnchecked(sGpuBufferF, sGpuBufferF_uv_fetch, 0, 0), texelFetchUnchecked(sGpuBufferF, sGpuBufferF_uv_fetch, 1, 0)}}; |
| 411 | } |
| 412 | Array<vec4_scalar,2> fetch_from_gpu_buffer_2f(int32_t address) { |
| 413 | ivec2_scalar uv = get_gpu_buffer_uv(address); |
| 414 | return fetch_from_gpu_buffer_2f_direct(uv); |
| 415 | } |
| 416 | QuadSegment_scalar fetch_segment(int32_t base, int32_t index) { |
| 417 | QuadSegment_scalar seg; |
| 418 | Array<vec4_scalar,2> texels = fetch_from_gpu_buffer_2f(((base)+(5))+((index)*(2))); |
| 419 | (seg).rect = RectWithEndpoint_scalar((texels[0]).sel(X,Y), (texels[0]).sel(Z,W)); |
| 420 | (seg).uv_rect = RectWithEndpoint_scalar((texels[1]).sel(X,Y), (texels[1]).sel(Z,W)); |
| 421 | return seg; |
| 422 | } |
| 423 | vec2 rect_clamp(RectWithEndpoint_scalar rect, vec2 pt) { |
| 424 | return clamp(pt, (rect).p0, (rect).p1); |
| 425 | } |
| 426 | VertexInfo write_vertex(vec2 local_pos, float z, Transform_scalar transform, vec2_scalar content_origin, RectWithEndpoint_scalar task_rect, int32_t quad_flags) { |
| 427 | VertexInfo vi; |
| 428 | vec4 transformed = ((transform).m)*(make_vec4(local_pos, 0.f, 1.f)); |
| 429 | vec2 device_pos = (transformed).sel(X,Y); |
| 430 | Float w = (transformed).w; |
| 431 | if (((quad_flags)&(2))!=(0)) { |
| 432 | { |
| 433 | RectWithEndpoint_scalar device_clip_rect = RectWithEndpoint_scalar(content_origin, ((content_origin)+((task_rect).p1))-((task_rect).p0)); |
| 434 | device_pos = rect_clamp(device_clip_rect, device_pos); |
| 435 | (vi).local_pos = (((transform).inv_m)*(make_vec4(device_pos, 0.f, 1.f))).sel(X,Y); |
| 436 | } |
| 437 | } else { |
| 438 | (vi).local_pos = local_pos; |
| 439 | } |
| 440 | vec2_scalar final_offset = (-(content_origin))+((task_rect).p0); |
| 441 | gl_Position = (uTransform)*(make_vec4((device_pos)+((final_offset)*(w)), (z)*(w), w)); |
| 442 | return vi; |
| 443 | } |
| 444 | vec2_scalar scale_offset_map_point(vec4_scalar scale_offset, vec2_scalar p) { |
| 445 | return ((p)*((scale_offset).sel(X,Y)))+((scale_offset).sel(Z,W)); |
| 446 | } |
| 447 | RectWithEndpoint_scalar scale_offset_map_rect(vec4_scalar scale_offset, RectWithEndpoint_scalar r) { |
| 448 | vec2_scalar p0 = scale_offset_map_point(scale_offset, (r).p0); |
| 449 | vec2_scalar p1 = scale_offset_map_point(scale_offset, (r).p1); |
| 450 | return RectWithEndpoint_scalar(min(p0, p1), max(p0, p1)); |
| 451 | } |
| 452 | vec2 scale_offset_map_point(vec4_scalar scale_offset, vec2 p) { |
| 453 | return ((p)*((scale_offset).sel(X,Y)))+((scale_offset).sel(Z,W)); |
| 454 | } |
| 455 | PrimitiveInfo quad_primive_info(void) { |
| 456 | QuadInstance_scalar qi = decode_instance(); |
| 457 | QuadHeader_scalar qh = fetch_header((qi).prim_address_i); |
| 458 | Transform_scalar transform = fetch_transform((qh).transform_id); |
| 459 | PictureTask_scalar task = fetch_picture_task((qi).picture_task_address); |
| 460 | QuadPrimitive_scalar prim = fetch_primitive((qi).prim_address_f); |
| 461 | float z = make_float((qh).z_id); |
| 462 | QuadSegment_scalar seg; |
| 463 | if (((qi).segment_index)==(255)) { |
| 464 | { |
| 465 | (seg).rect = (prim).bounds; |
| 466 | (seg).uv_rect = (prim).uv_rect; |
| 467 | } |
| 468 | } else { |
| 469 | seg = fetch_segment((qi).prim_address_f, (qi).segment_index); |
| 470 | } |
| 471 | RectWithEndpoint_scalar local_coverage_rect = (seg).rect; |
| 472 | (local_coverage_rect).p0 = max((local_coverage_rect).p0, ((prim).bounds).p0); |
| 473 | (local_coverage_rect).p1 = min((local_coverage_rect).p1, ((prim).bounds).p1); |
| 474 | (local_coverage_rect).p1 = max((local_coverage_rect).p0, (local_coverage_rect).p1); |
| 475 | float aa_left = (((qi).edge_flags)&(1))!=(0) ? 1.f : 0.f; |
| 476 | float aa_top = (((qi).edge_flags)&(2))!=(0) ? 1.f : 0.f; |
| 477 | float aa_right = (((qi).edge_flags)&(4))!=(0) ? 1.f : 0.f; |
| 478 | float aa_bottom = (((qi).edge_flags)&(8))!=(0) ? 1.f : 0.f; |
| 479 | switch ((qi).part_index) { |
| 480 | case 1: |
| 481 | ((local_coverage_rect).p1).x = (((local_coverage_rect).p0).x)+(2.f); |
| 482 | swgl_antiAlias(1)do { swgl_AAEdgeMask = calcAAEdgeMask(1); if (swgl_AAEdgeMask ) { swgl_ClipFlags |= SWGL_CLIP_FLAG_AA; } } while (0); |
| 483 | break; |
| 484 | case 2: |
| 485 | ((local_coverage_rect).p0).x += (aa_left)*(2.f); |
| 486 | ((local_coverage_rect).p1).x -= (aa_right)*(2.f); |
| 487 | ((local_coverage_rect).p1).y = (((local_coverage_rect).p0).y)+(2.f); |
| 488 | swgl_antiAlias(2)do { swgl_AAEdgeMask = calcAAEdgeMask(2); if (swgl_AAEdgeMask ) { swgl_ClipFlags |= SWGL_CLIP_FLAG_AA; } } while (0); |
| 489 | break; |
| 490 | case 3: |
| 491 | ((local_coverage_rect).p0).x = (((local_coverage_rect).p1).x)-(2.f); |
| 492 | swgl_antiAlias(4)do { swgl_AAEdgeMask = calcAAEdgeMask(4); if (swgl_AAEdgeMask ) { swgl_ClipFlags |= SWGL_CLIP_FLAG_AA; } } while (0); |
| 493 | break; |
| 494 | case 4: |
| 495 | ((local_coverage_rect).p0).x += (aa_left)*(2.f); |
| 496 | ((local_coverage_rect).p1).x -= (aa_right)*(2.f); |
| 497 | ((local_coverage_rect).p0).y = (((local_coverage_rect).p1).y)-(2.f); |
| 498 | swgl_antiAlias(8)do { swgl_AAEdgeMask = calcAAEdgeMask(8); if (swgl_AAEdgeMask ) { swgl_ClipFlags |= SWGL_CLIP_FLAG_AA; } } while (0); |
| 499 | break; |
| 500 | case 0: |
| 501 | ((local_coverage_rect).p0).x += (aa_left)*(2.f); |
| 502 | ((local_coverage_rect).p1).x -= (aa_right)*(2.f); |
| 503 | ((local_coverage_rect).p0).y += (aa_top)*(2.f); |
| 504 | ((local_coverage_rect).p1).y -= (aa_bottom)*(2.f); |
| 505 | break; |
| 506 | case 5: |
| 507 | default: |
| 508 | swgl_antiAlias((qi).edge_flags)do { swgl_AAEdgeMask = calcAAEdgeMask((qi).edge_flags); if (swgl_AAEdgeMask ) { swgl_ClipFlags |= SWGL_CLIP_FLAG_AA; } } while (0); |
| 509 | break; |
| 510 | } |
| 511 | vec2 local_pos = mix((local_coverage_rect).p0, (local_coverage_rect).p1, aPosition); |
| 512 | VertexInfo vi = write_vertex(local_pos, z, transform, (task).content_origin, (task).task_rect, (qi).quad_flags); |
| 513 | v_color = (prim).color; |
| 514 | vec4_scalar pattern_tx = (prim).pattern_scale_offset; |
| 515 | (seg).rect = scale_offset_map_rect(pattern_tx, (seg).rect); |
| 516 | return PrimitiveInfo(scale_offset_map_point(pattern_tx, (vi).local_pos), scale_offset_map_rect(pattern_tx, (prim).pattern_rect), scale_offset_map_rect(pattern_tx, (prim).bounds), seg, (qi).edge_flags, (qi).quad_flags, (qh).pattern_input); |
| 517 | } |
| 518 | void antialiasing_vertex(PrimitiveInfo prim) { |
| 519 | } |
| 520 | ivec2 get_gpu_buffer_uv(I32 address) { |
| 521 | return make_ivec2((make_uint(address))%(1024u), (make_uint(address))/(1024u)); |
| 522 | } |
| 523 | vec4 fetch_from_gpu_buffer_1f(I32 address) { |
| 524 | ivec2 uv = get_gpu_buffer_uv(address); |
| 525 | return texelFetch(sGpuBufferF, uv, 0); |
| 526 | } |
| 527 | vec2 rect_size(RectWithEndpoint rect) { |
| 528 | return ((rect).p1)-((rect).p0); |
| 529 | } |
| 530 | void write_uv(vec2 f, RectWithEndpoint uv_rect, vec2_scalar texture_size, vec2& out_uv, vec4& out_bounds) { |
| 531 | vec2 uv = mix((uv_rect).p0, (uv_rect).p1, f); |
| 532 | out_uv = (uv)/(texture_size); |
| 533 | out_bounds = (make_vec4(((uv_rect).p0)+(make_vec2(0.5f)), ((uv_rect).p1)-(make_vec2(0.5f))))/((texture_size).sel(X,Y,X,Y)); |
| 534 | } |
| 535 | void pattern_vertex(PrimitiveInfo info) { |
| 536 | vec4 src_uv_rect_raw = fetch_from_gpu_buffer_1f(((info).pattern_input).x); |
| 537 | RectWithEndpoint src_uv_rect = RectWithEndpoint((src_uv_rect_raw).sel(X,Y), (src_uv_rect_raw).sel(Z,W)); |
| 538 | (v_op).x = force_scalar(((info).pattern_input).y); |
| 539 | RectWithEndpoint rect = (info).local_prim_rect; |
| 540 | vec2 f = (((info).local_pos)-((rect).p0))/(rect_size(rect)); |
| 541 | { vec4 _arg4_ = v_backdrop_uv_bounds; write_uv(f, ((info).segment).uv_rect, make_vec2(textureSize(sColor0, 0)), v_backdrop_uv, _arg4_); v_backdrop_uv_bounds = force_scalar(_arg4_); }; |
| 542 | { vec4 _arg4_ = v_src_uv_bounds; write_uv(f, src_uv_rect, make_vec2(textureSize(sColor1, 0)), v_src_uv, _arg4_); v_src_uv_bounds = force_scalar(_arg4_); }; |
| 543 | } |
| 544 | ALWAYS_INLINE__attribute__((always_inline)) inline void main() { |
| 545 | PrimitiveInfo prim = quad_primive_info(); |
| 546 | auto _c2_ = (((prim).quad_flags)&(16))!=(0); |
| 547 | { |
| 548 | if (_c2_[0]) { (v_flags).z = 1; }; |
| 549 | } |
| 550 | { |
| 551 | if (~(_c2_)[0]) { (v_flags).z = 0; }; |
| 552 | } |
| 553 | antialiasing_vertex(prim); |
| 554 | pattern_vertex(prim); |
| 555 | } |
| 556 | static void set_uniform_1i(VertexShaderImpl* impl, int index, int value) { |
| 557 | Self* self = (Self*)impl; |
| 558 | if (self->samplers.set_slot(index, value)) return; |
| 559 | switch (index) { |
| 560 | case 6: |
| 561 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sColor0 |
| 562 | break; |
| 563 | case 7: |
| 564 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sColor1 |
| 565 | break; |
| 566 | case 3: |
| 567 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sGpuBufferF |
| 568 | break; |
| 569 | case 4: |
| 570 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sGpuBufferI |
| 571 | break; |
| 572 | case 2: |
| 573 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sRenderTasks |
| 574 | break; |
| 575 | case 1: |
| 576 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sTransformPalette |
| 577 | break; |
| 578 | case 5: |
| 579 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // uTransform |
| 580 | break; |
| 581 | } |
| 582 | } |
| 583 | static void set_uniform_4fv(VertexShaderImpl* impl, int index, const float *value) { |
| 584 | Self* self = (Self*)impl; |
| 585 | switch (index) { |
| 586 | case 6: |
| 587 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sColor0 |
| 588 | break; |
| 589 | case 7: |
| 590 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sColor1 |
| 591 | break; |
| 592 | case 3: |
| 593 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sGpuBufferF |
| 594 | break; |
| 595 | case 4: |
| 596 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sGpuBufferI |
| 597 | break; |
| 598 | case 2: |
| 599 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sRenderTasks |
| 600 | break; |
| 601 | case 1: |
| 602 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sTransformPalette |
| 603 | break; |
| 604 | case 5: |
| 605 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // uTransform |
| 606 | break; |
| 607 | } |
| 608 | } |
| 609 | static void set_uniform_matrix4fv(VertexShaderImpl* impl, int index, const float *value) { |
| 610 | Self* self = (Self*)impl; |
| 611 | switch (index) { |
| 612 | case 6: |
| 613 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sColor0 |
| 614 | break; |
| 615 | case 7: |
| 616 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sColor1 |
| 617 | break; |
| 618 | case 3: |
| 619 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sGpuBufferF |
| 620 | break; |
| 621 | case 4: |
| 622 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sGpuBufferI |
| 623 | break; |
| 624 | case 2: |
| 625 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sRenderTasks |
| 626 | break; |
| 627 | case 1: |
| 628 | assert(0)(static_cast <bool> (0) ? void (0) : __assert_fail ("0" , __builtin_FILE (), __builtin_LINE (), __extension__ __PRETTY_FUNCTION__ )); // sTransformPalette |
| 629 | break; |
| 630 | case 5: |
| 631 | self->uTransform = mat4_scalar::load_from_ptr(value); |
| 632 | break; |
| 633 | } |
| 634 | } |
| 635 | static void load_attribs(VertexShaderImpl* impl, VertexAttrib *attribs, uint32_t start, int instance, int count) {Self* self = (Self*)impl; |
| 636 | load_attrib(self->aPosition, attribs[self->attrib_locations.aPosition], start, instance, count); |
| 637 | load_flat_attrib(self->aData, attribs[self->attrib_locations.aData], start, instance, count); |
| 638 | } |
| 639 | public: |
| 640 | struct InterpOutputs { |
| 641 | vec2_scalar v_backdrop_uv; |
| 642 | vec2_scalar v_src_uv; |
| 643 | }; |
| 644 | private: |
| 645 | ALWAYS_INLINE__attribute__((always_inline)) inline void store_interp_outputs(char* dest_ptr, size_t stride) { |
| 646 | for(int n = 0; n < 4; n++) { |
| 647 | auto* dest = reinterpret_cast<InterpOutputs*>(dest_ptr); |
| 648 | dest->v_backdrop_uv = get_nth(v_backdrop_uv, n); |
| 649 | dest->v_src_uv = get_nth(v_src_uv, n); |
| 650 | dest_ptr += stride; |
| 651 | } |
| 652 | } |
| 653 | static void run(VertexShaderImpl* impl, char* interps, size_t interp_stride) { |
| 654 | Self* self = (Self*)impl; |
| 655 | self->main(); |
| 656 | self->store_interp_outputs(interps, interp_stride); |
| 657 | } |
| 658 | static void init_batch(VertexShaderImpl* impl) { |
| 659 | Self* self = (Self*)impl; self->bind_textures(); } |
| 660 | public: |
| 661 | ps_quad_mix_blend_TEXTURE_2D_vert() { |
| 662 | set_uniform_1i_func = &set_uniform_1i; |
| 663 | set_uniform_4fv_func = &set_uniform_4fv; |
| 664 | set_uniform_matrix4fv_func = &set_uniform_matrix4fv; |
| 665 | init_batch_func = &init_batch; |
| 666 | load_attribs_func = &load_attribs; |
| 667 | run_primitive_func = &run; |
| 668 | } |
| 669 | }; |
| 670 | |
| 671 | |
| 672 | struct ps_quad_mix_blend_TEXTURE_2D_frag : FragmentShaderImpl, ps_quad_mix_blend_TEXTURE_2D_vert { |
| 673 | private: |
| 674 | typedef ps_quad_mix_blend_TEXTURE_2D_frag Self; |
| 675 | #define oFragColorgl_FragColor gl_FragColor |
| 676 | // vec4 oFragColor; |
| 677 | // sampler2D sColor0; |
| 678 | // sampler2D sColor1; |
| 679 | // sampler2D sColor2; |
| 680 | struct RectWithSize_scalar { |
| 681 | vec2_scalar p0; |
| 682 | vec2_scalar size; |
| 683 | RectWithSize_scalar() = default; |
| 684 | RectWithSize_scalar(vec2_scalar p0, vec2_scalar size) : p0(p0), size(size){} |
| 685 | }; |
| 686 | struct RectWithSize { |
| 687 | vec2 p0; |
| 688 | vec2 size; |
| 689 | RectWithSize() = default; |
| 690 | RectWithSize(vec2 p0, vec2 size) : p0(p0), size(size){} |
| 691 | RectWithSize(vec2_scalar p0, vec2_scalar size):p0(p0),size(size){ |
| 692 | } |
| 693 | IMPLICIT RectWithSize(RectWithSize_scalar s):p0(s.p0),size(s.size){ |
| 694 | } |
| 695 | friend RectWithSize if_then_else(I32 c, RectWithSize t, RectWithSize e) { return RectWithSize( |
| 696 | if_then_else(c, t.p0, e.p0), if_then_else(c, t.size, e.size)); |
| 697 | }}; |
| 698 | struct RectWithEndpoint_scalar { |
| 699 | vec2_scalar p0; |
| 700 | vec2_scalar p1; |
| 701 | RectWithEndpoint_scalar() = default; |
| 702 | RectWithEndpoint_scalar(vec2_scalar p0, vec2_scalar p1) : p0(p0), p1(p1){} |
| 703 | }; |
| 704 | struct RectWithEndpoint { |
| 705 | vec2 p0; |
| 706 | vec2 p1; |
| 707 | RectWithEndpoint() = default; |
| 708 | RectWithEndpoint(vec2 p0, vec2 p1) : p0(p0), p1(p1){} |
| 709 | RectWithEndpoint(vec2_scalar p0, vec2_scalar p1):p0(p0),p1(p1){ |
| 710 | } |
| 711 | IMPLICIT RectWithEndpoint(RectWithEndpoint_scalar s):p0(s.p0),p1(s.p1){ |
| 712 | } |
| 713 | friend RectWithEndpoint if_then_else(I32 c, RectWithEndpoint t, RectWithEndpoint e) { return RectWithEndpoint( |
| 714 | if_then_else(c, t.p0, e.p0), if_then_else(c, t.p1, e.p1)); |
| 715 | }}; |
| 716 | // vec4_scalar vTransformBounds; |
| 717 | // sampler2D sGpuBufferF; |
| 718 | // isampler2D sGpuBufferI; |
| 719 | // vec4_scalar v_color; |
| 720 | // ivec4_scalar v_flags; |
| 721 | vec2 v_backdrop_uv; |
| 722 | // vec4_scalar v_backdrop_uv_bounds; |
| 723 | vec2 v_src_uv; |
| 724 | // vec4_scalar v_src_uv_bounds; |
| 725 | // ivec2_scalar v_op; |
| 726 | int32_t static constexpr MIX_BLEND_MULTIPLY = 1; |
| 727 | int32_t static constexpr MIX_BLEND_SCREEN = 2; |
| 728 | int32_t static constexpr MIX_BLEND_OVERLAY = 3; |
| 729 | int32_t static constexpr MIX_BLEND_DARKEN = 4; |
| 730 | int32_t static constexpr MIX_BLEND_LIGHTEN = 5; |
| 731 | int32_t static constexpr MIX_BLEND_COLOR_DODGE = 6; |
| 732 | int32_t static constexpr MIX_BLEND_COLOR_BURN = 7; |
| 733 | int32_t static constexpr MIX_BLEND_HARD_LIGHT = 8; |
| 734 | int32_t static constexpr MIX_BLEND_SOFT_LIGHT = 9; |
| 735 | int32_t static constexpr MIX_BLEND_DIFFERENCE = 10; |
| 736 | int32_t static constexpr MIX_BLEND_EXCLUSION = 11; |
| 737 | int32_t static constexpr MIX_BLEND_HUE = 12; |
| 738 | int32_t static constexpr MIX_BLEND_SAUTURATION = 13; |
| 739 | int32_t static constexpr MIX_BLEND_COLOR = 14; |
| 740 | int32_t static constexpr MIX_BLEND_lumINOSITY = 15; |
| 741 | int32_t static constexpr MIX_BLEND_PLUS_LIGHTER = 16; |
| 742 | float antialiasing_fragment() { |
| 743 | float alpha = 1.f; |
| 744 | return alpha; |
| 745 | } |
| 746 | vec3 multiply(vec3 cb, vec3 cs) { |
| 747 | return (cb)*(cs); |
| 748 | } |
| 749 | vec3 screen(vec3 cb, vec3 cs) { |
| 750 | return ((cb)+(cs))-((cb)*(cs)); |
| 751 | } |
| 752 | vec3 hard_light(vec3 cb, vec3 cs) { |
| 753 | vec3 m = multiply(cb, (2.f)*(cs)); |
| 754 | vec3 s = screen(cb, ((2.f)*(cs))-(1.f)); |
| 755 | vec3_scalar edge = make_vec3(0.5f, 0.5f, 0.5f); |
| 756 | return mix(m, s, step(edge, cs)); |
| 757 | } |
| 758 | Float color_dodge(Float cb, Float cs) { |
| 759 | I32 ret_mask = ~0; |
| 760 | Float ret; |
| 761 | auto _c8_ = (cb)==(0.f); |
| 762 | ret = 0.f; |
| 763 | ret_mask = ~I32(_c8_); |
| 764 | auto _c9_ = (cs)==(1.f); |
| 765 | auto _c10_ = (~(_c8_))&(_c9_); |
| 766 | ret = if_then_else(ret_mask & I32(_c10_), 1.f, ret); |
| 767 | ret_mask &= ~I32(_c10_); |
| 768 | _c9_ = (~(_c8_))&(~(_c9_)); |
| 769 | ret = if_then_else(ret_mask & I32(_c9_), min(1.f, (cb)/((1.f)-(cs))), ret); |
| 770 | ret_mask &= ~I32(_c9_); |
| 771 | return ret; |
| 772 | } |
| 773 | Float color_burn(Float cb, Float cs) { |
| 774 | I32 ret_mask = ~0; |
| 775 | Float ret; |
| 776 | auto _c14_ = (cb)==(1.f); |
| 777 | ret = 1.f; |
| 778 | ret_mask = ~I32(_c14_); |
| 779 | auto _c15_ = (cs)==(0.f); |
| 780 | auto _c16_ = (~(_c14_))&(_c15_); |
| 781 | ret = if_then_else(ret_mask & I32(_c16_), 0.f, ret); |
| 782 | ret_mask &= ~I32(_c16_); |
| 783 | _c15_ = (~(_c14_))&(~(_c15_)); |
| 784 | ret = if_then_else(ret_mask & I32(_c15_), (1.f)-(min(1.f, ((1.f)-(cb))/(cs))), ret); |
| 785 | ret_mask &= ~I32(_c15_); |
| 786 | return ret; |
| 787 | } |
| 788 | Float soft_light(Float cb, Float cs) { |
| 789 | I32 ret_mask = ~0; |
| 790 | Float ret; |
| 791 | auto _c20_ = (cs)<=(0.5f); |
| 792 | { |
| 793 | ret = (cb)-((((1.f)-((2.f)*(cs)))*(cb))*((1.f)-(cb))); |
| 794 | ret_mask = ~I32(_c20_); |
| 795 | } |
| 796 | { |
| 797 | Float D; |
| 798 | auto _c21_ = (cb)<=(0.25f); |
| 799 | auto _c22_ = (~(_c20_))&(_c21_); |
| 800 | D = if_then_else(_c22_,(((((16.f)*(cb))-(12.f))*(cb))+(4.f))*(cb),D); |
| 801 | _c21_ = (~(_c20_))&(~(_c21_)); |
| 802 | D = if_then_else(_c21_,sqrt__glsl_sqrt(cb),D); |
| 803 | ret = if_then_else(ret_mask & I32(~(_c20_)), (cb)+((((2.f)*(cs))-(1.f))*((D)-(cb))), ret); |
| 804 | ret_mask &= ~I32(~(_c20_)); |
Value stored to 'ret_mask' is never read | |
| 805 | } |
| 806 | return ret; |
| 807 | } |
| 808 | vec3 difference(vec3 cb, vec3 cs) { |
| 809 | return abs__glsl_abs((cb)-(cs)); |
| 810 | } |
| 811 | Float lum(vec3 c) { |
| 812 | vec3_scalar f = make_vec3(0.3f, 0.59f, 0.11f); |
| 813 | return dot(c, f); |
| 814 | } |
| 815 | vec3 clip_color(vec3 C) { |
| 816 | Float L = lum(C); |
| 817 | Float n = min((C).x, min((C).y, (C).z)); |
| 818 | Float x = max((C).x, max((C).y, (C).z)); |
| 819 | auto _c25_ = ((n)<(0.f))&&((L)!=(n)); |
| 820 | C = if_then_else(_c25_,(L)+((((C)-(L))*(L))/((L)-(n))),C); |
| 821 | auto _c26_ = ((x)>(1.f))&&((x)!=(L)); |
| 822 | C = if_then_else(_c26_,(L)+((((C)-(L))*((1.f)-(L)))/((x)-(L))),C); |
| 823 | return C; |
| 824 | } |
| 825 | vec3 set_lum(vec3 C, Float l) { |
| 826 | Float d = (l)-(lum(C)); |
| 827 | return clip_color((C)+(d)); |
| 828 | } |
| 829 | void set_sat_inner(Float& Cmin, Float& Cmid, Float& Cmax, Float s, I32 _cond_mask_) { |
| 830 | auto _c47_ = (Cmax)>(Cmin); |
| 831 | auto _c48_ = (_cond_mask_)&(_c47_); |
| 832 | { |
| 833 | Cmid = if_then_else(_c48_,(((Cmid)-(Cmin))*(s))/((Cmax)-(Cmin)),Cmid); |
| 834 | Cmax = if_then_else(_c48_,s,Cmax); |
| 835 | } |
| 836 | _c47_ = (_cond_mask_)&(~(_c47_)); |
| 837 | { |
| 838 | Cmid = if_then_else(_c47_,0.f,Cmid); |
| 839 | Cmax = if_then_else(_c47_,0.f,Cmax); |
| 840 | } |
| 841 | Cmin = if_then_else(_cond_mask_,0.f,Cmin); |
| 842 | } |
| 843 | vec3 set_sat(vec3 C, Float s) { |
| 844 | auto _c36_ = ((C).x)<=((C).y); |
| 845 | { |
| 846 | auto _c37_ = ((C).y)<=((C).z); |
| 847 | auto _c38_ = (_c36_)&(_c37_); |
| 848 | { |
| 849 | set_sat_inner((C).x, (C).y, (C).z, s, _c38_); |
| 850 | } |
| 851 | _c37_ = (_c36_)&(~(_c37_)); |
| 852 | { |
| 853 | auto _c39_ = ((C).x)<=((C).z); |
| 854 | auto _c40_ = (_c37_)&(_c39_); |
| 855 | { |
| 856 | set_sat_inner((C).x, (C).z, (C).y, s, _c40_); |
| 857 | } |
| 858 | _c39_ = (_c37_)&(~(_c39_)); |
| 859 | { |
| 860 | set_sat_inner((C).z, (C).x, (C).y, s, _c39_); |
| 861 | } |
| 862 | } |
| 863 | } |
| 864 | { |
| 865 | auto _c41_ = ((C).x)<=((C).z); |
| 866 | auto _c42_ = (~(_c36_))&(_c41_); |
| 867 | { |
| 868 | set_sat_inner((C).y, (C).x, (C).z, s, _c42_); |
| 869 | } |
| 870 | _c41_ = (~(_c36_))&(~(_c41_)); |
| 871 | { |
| 872 | auto _c43_ = ((C).y)<=((C).z); |
| 873 | auto _c44_ = (_c41_)&(_c43_); |
| 874 | { |
| 875 | set_sat_inner((C).y, (C).z, (C).x, s, _c44_); |
| 876 | } |
| 877 | _c43_ = (_c41_)&(~(_c43_)); |
| 878 | { |
| 879 | set_sat_inner((C).z, (C).y, (C).x, s, _c43_); |
| 880 | } |
| 881 | } |
| 882 | } |
| 883 | return C; |
| 884 | } |
| 885 | Float sat(vec3 c) { |
| 886 | return (max((c).x, max((c).y, (c).z)))-(min((c).x, min((c).y, (c).z))); |
| 887 | } |
| 888 | vec3 hue(vec3 cb, vec3 cs) { |
| 889 | return set_lum(set_sat(cs, sat(cb)), lum(cb)); |
| 890 | } |
| 891 | vec3 saturation(vec3 cb, vec3 cs) { |
| 892 | return set_lum(set_sat(cb, sat(cs)), lum(cb)); |
| 893 | } |
| 894 | vec3 luminosity(vec3 cb, vec3 cs) { |
| 895 | return set_lum(cb, lum(cs)); |
| 896 | } |
| 897 | vec4 pattern_fragment(vec4_scalar base_color) { |
| 898 | vec2 backdrop_uv = clamp(v_backdrop_uv, (v_backdrop_uv_bounds).sel(X,Y), (v_backdrop_uv_bounds).sel(Z,W)); |
| 899 | vec2 src_uv = clamp(v_src_uv, (v_src_uv_bounds).sel(X,Y), (v_src_uv_bounds).sel(Z,W)); |
| 900 | vec4 cb = texture(sColor0, backdrop_uv); |
| 901 | vec4 cs = texture(sColor1, src_uv); |
| 902 | auto _c3_ = ((cb).w)!=(0.f); |
| 903 | { |
| 904 | (cb).lsel(R,G,B) = if_then_else(_c3_,(cb).sel(R,G,B)/(cb).w,(cb).sel(R,G,B)); |
| 905 | } |
| 906 | auto _c4_ = ((cs).w)!=(0.f); |
| 907 | { |
| 908 | (cs).lsel(R,G,B) = if_then_else(_c4_,(cs).sel(R,G,B)/(cs).w,(cs).sel(R,G,B)); |
| 909 | } |
| 910 | vec4 result = make_vec4(1.f, 1.f, 0.f, 1.f); |
| 911 | switch (((v_op).x)&(255)) { |
| 912 | case MIX_BLEND_MULTIPLY: |
| 913 | (result).lsel(R,G,B) = multiply((cb).sel(R,G,B), (cs).sel(R,G,B)); |
| 914 | break; |
| 915 | case MIX_BLEND_OVERLAY: |
| 916 | (result).lsel(R,G,B) = hard_light((cs).sel(R,G,B), (cb).sel(R,G,B)); |
| 917 | break; |
| 918 | case MIX_BLEND_DARKEN: |
| 919 | (result).lsel(R,G,B) = min((cs).sel(R,G,B), (cb).sel(R,G,B)); |
| 920 | break; |
| 921 | case MIX_BLEND_LIGHTEN: |
| 922 | (result).lsel(R,G,B) = max((cs).sel(R,G,B), (cb).sel(R,G,B)); |
| 923 | break; |
| 924 | case MIX_BLEND_COLOR_DODGE: |
| 925 | (result).x = color_dodge((cb).x, (cs).x); |
| 926 | (result).y = color_dodge((cb).y, (cs).y); |
| 927 | (result).z = color_dodge((cb).z, (cs).z); |
| 928 | break; |
| 929 | case MIX_BLEND_COLOR_BURN: |
| 930 | (result).x = color_burn((cb).x, (cs).x); |
| 931 | (result).y = color_burn((cb).y, (cs).y); |
| 932 | (result).z = color_burn((cb).z, (cs).z); |
| 933 | break; |
| 934 | case MIX_BLEND_HARD_LIGHT: |
| 935 | (result).lsel(R,G,B) = hard_light((cb).sel(R,G,B), (cs).sel(R,G,B)); |
| 936 | break; |
| 937 | case MIX_BLEND_SOFT_LIGHT: |
| 938 | (result).x = soft_light((cb).x, (cs).x); |
| 939 | (result).y = soft_light((cb).y, (cs).y); |
| 940 | (result).z = soft_light((cb).z, (cs).z); |
| 941 | break; |
| 942 | case MIX_BLEND_DIFFERENCE: |
| 943 | (result).lsel(R,G,B) = difference((cb).sel(R,G,B), (cs).sel(R,G,B)); |
| 944 | break; |
| 945 | case MIX_BLEND_HUE: |
| 946 | (result).lsel(R,G,B) = hue((cb).sel(R,G,B), (cs).sel(R,G,B)); |
| 947 | break; |
| 948 | case MIX_BLEND_SAUTURATION: |
| 949 | (result).lsel(R,G,B) = saturation((cb).sel(R,G,B), (cs).sel(R,G,B)); |
| 950 | break; |
| 951 | case MIX_BLEND_COLOR: |
| 952 | (result).lsel(R,G,B) = set_lum((cs).sel(R,G,B), lum((cb).sel(R,G,B))); |
| 953 | break; |
| 954 | case MIX_BLEND_lumINOSITY: |
| 955 | (result).lsel(R,G,B) = luminosity((cb).sel(R,G,B), (cs).sel(R,G,B)); |
| 956 | break; |
| 957 | case MIX_BLEND_SCREEN: |
| 958 | case MIX_BLEND_EXCLUSION: |
| 959 | case MIX_BLEND_PLUS_LIGHTER: |
| 960 | break; |
| 961 | default: |
| 962 | break; |
| 963 | } |
| 964 | (result).lsel(R,G,B) = (((1.f)-((cb).w))*((cs).sel(R,G,B)))+(((cb).w)*((result).sel(R,G,B))); |
| 965 | (result).w = (cs).w; |
| 966 | (result).lsel(R,G,B) *= (result).w; |
| 967 | return (base_color)*(result); |
| 968 | } |
| 969 | ALWAYS_INLINE__attribute__((always_inline)) inline void main() { |
| 970 | vec4_scalar base_color = v_color; |
| 971 | base_color *= antialiasing_fragment(); |
| 972 | vec4 output_color = pattern_fragment(base_color); |
| 973 | if (((v_flags).z)!=(0)) { |
| 974 | { |
| 975 | output_color = (output_color).sel(R,R,R,R); |
| 976 | } |
| 977 | } |
| 978 | oFragColorgl_FragColor = output_color; |
| 979 | } |
| 980 | typedef ps_quad_mix_blend_TEXTURE_2D_vert::InterpOutputs InterpInputs; |
| 981 | InterpInputs interp_step; |
| 982 | struct InterpPerspective { |
| 983 | vec2 v_backdrop_uv; |
| 984 | vec2 v_src_uv; |
| 985 | }; |
| 986 | InterpPerspective interp_perspective; |
| 987 | static 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_; |
| 988 | self->v_backdrop_uv = init_interp(init->v_backdrop_uv, step->v_backdrop_uv); |
| 989 | self->interp_step.v_backdrop_uv = step->v_backdrop_uv * 4.0f; |
| 990 | self->v_src_uv = init_interp(init->v_src_uv, step->v_src_uv); |
| 991 | self->interp_step.v_src_uv = step->v_src_uv * 4.0f; |
| 992 | } |
| 993 | static 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_; |
| 994 | Float w = 1.0f / self->gl_FragCoord.w; |
| 995 | self->interp_perspective.v_backdrop_uv = init_interp(init->v_backdrop_uv, step->v_backdrop_uv); |
| 996 | self->v_backdrop_uv = self->interp_perspective.v_backdrop_uv * w; |
| 997 | self->interp_step.v_backdrop_uv = step->v_backdrop_uv * 4.0f; |
| 998 | self->interp_perspective.v_src_uv = init_interp(init->v_src_uv, step->v_src_uv); |
| 999 | self->v_src_uv = self->interp_perspective.v_src_uv * w; |
| 1000 | self->interp_step.v_src_uv = step->v_src_uv * 4.0f; |
| 1001 | } |
| 1002 | ALWAYS_INLINE__attribute__((always_inline)) inline void step_interp_inputs(int steps = 4) { |
| 1003 | float chunks = steps * 0.25f; |
| 1004 | v_backdrop_uv += interp_step.v_backdrop_uv * chunks; |
| 1005 | v_src_uv += interp_step.v_src_uv * chunks; |
| 1006 | } |
| 1007 | ALWAYS_INLINE__attribute__((always_inline)) inline void step_perspective_inputs(int steps = 4) { |
| 1008 | step_perspective(steps); |
| 1009 | float chunks = steps * 0.25f; |
| 1010 | Float w = 1.0f / gl_FragCoord.w; |
| 1011 | interp_perspective.v_backdrop_uv += interp_step.v_backdrop_uv * chunks; |
| 1012 | v_backdrop_uv = w * interp_perspective.v_backdrop_uv; |
| 1013 | interp_perspective.v_src_uv += interp_step.v_src_uv * chunks; |
| 1014 | v_src_uv = w * interp_perspective.v_src_uv; |
| 1015 | } |
| 1016 | static void run(FragmentShaderImpl* impl) { |
| 1017 | Self* self = (Self*)impl; |
| 1018 | self->main(); |
| 1019 | self->step_interp_inputs(); |
| 1020 | } |
| 1021 | static void skip(FragmentShaderImpl* impl, int steps) { |
| 1022 | Self* self = (Self*)impl; |
| 1023 | self->step_interp_inputs(steps); |
| 1024 | } |
| 1025 | static void run_perspective(FragmentShaderImpl* impl) { |
| 1026 | Self* self = (Self*)impl; |
| 1027 | self->main(); |
| 1028 | self->step_perspective_inputs(); |
| 1029 | } |
| 1030 | static void skip_perspective(FragmentShaderImpl* impl, int steps) { |
| 1031 | Self* self = (Self*)impl; |
| 1032 | self->step_perspective_inputs(steps); |
| 1033 | } |
| 1034 | public: |
| 1035 | ps_quad_mix_blend_TEXTURE_2D_frag() { |
| 1036 | init_span_func = &read_interp_inputs; |
| 1037 | run_func = &run; |
| 1038 | skip_func = &skip; |
| 1039 | enable_perspective(); |
| 1040 | init_span_w_func = &read_perspective_inputs; |
| 1041 | run_w_func = &run_perspective; |
| 1042 | skip_w_func = &skip_perspective; |
| 1043 | } |
| 1044 | }; |
| 1045 | |
| 1046 | struct ps_quad_mix_blend_TEXTURE_2D_program : ProgramImpl, ps_quad_mix_blend_TEXTURE_2D_frag { |
| 1047 | int get_uniform(const char *name) const override { |
| 1048 | if (strcmp("sColor0", name) == 0) { return 6; } |
| 1049 | if (strcmp("sColor1", name) == 0) { return 7; } |
| 1050 | if (strcmp("sGpuBufferF", name) == 0) { return 3; } |
| 1051 | if (strcmp("sGpuBufferI", name) == 0) { return 4; } |
| 1052 | if (strcmp("sRenderTasks", name) == 0) { return 2; } |
| 1053 | if (strcmp("sTransformPalette", name) == 0) { return 1; } |
| 1054 | if (strcmp("uTransform", name) == 0) { return 5; } |
| 1055 | return -1; |
| 1056 | } |
| 1057 | void bind_attrib(const char* name, int index) override { |
| 1058 | attrib_locations.bind_loc(name, index); |
| 1059 | } |
| 1060 | int get_attrib(const char* name) const override { |
| 1061 | return attrib_locations.get_loc(name); |
| 1062 | } |
| 1063 | size_t interpolants_size() const override { return sizeof(InterpOutputs); } |
| 1064 | VertexShaderImpl* get_vertex_shader() override { |
| 1065 | return this; |
| 1066 | } |
| 1067 | FragmentShaderImpl* get_fragment_shader() override { |
| 1068 | return this; |
| 1069 | } |
| 1070 | const char* get_name() const override { return "ps_quad_mix_blend_TEXTURE_2D"; } |
| 1071 | static ProgramImpl* loader() { return new ps_quad_mix_blend_TEXTURE_2D_program; } |
| 1072 | }; |
| 1073 | |
| 1074 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_MULTIPLY; |
| 1075 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_SCREEN; |
| 1076 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_OVERLAY; |
| 1077 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_DARKEN; |
| 1078 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_LIGHTEN; |
| 1079 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_COLOR_DODGE; |
| 1080 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_COLOR_BURN; |
| 1081 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_HARD_LIGHT; |
| 1082 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_SOFT_LIGHT; |
| 1083 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_DIFFERENCE; |
| 1084 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_EXCLUSION; |
| 1085 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_HUE; |
| 1086 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_SAUTURATION; |
| 1087 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_COLOR; |
| 1088 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_lumINOSITY; |
| 1089 | int32_t constexpr ps_quad_mix_blend_TEXTURE_2D_frag::MIX_BLEND_PLUS_LIGHTER; |