1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Inputs {
5    float4 src;
6    float4 dst;
7};
8struct Outputs {
9    float4 sk_FragColor [[color(0)]];
10};
11
12
13fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
14    Outputs _outputStruct;
15    thread Outputs* _out = &_outputStruct;
16    float4 _0_blend_hard_light;
17    {
18        float4 _4_blend_overlay;
19        {
20            float _6_blend_overlay_component;
21            {
22                _6_blend_overlay_component = 2.0 * _in.src.x <= _in.src.w ? (2.0 * _in.dst.x) * _in.src.x : _in.dst.w * _in.src.w - (2.0 * (_in.src.w - _in.src.x)) * (_in.dst.w - _in.dst.x);
23            }
24            float _7_blend_overlay_component;
25            {
26                _7_blend_overlay_component = 2.0 * _in.src.y <= _in.src.w ? (2.0 * _in.dst.y) * _in.src.y : _in.dst.w * _in.src.w - (2.0 * (_in.src.w - _in.src.y)) * (_in.dst.w - _in.dst.y);
27            }
28            float _8_blend_overlay_component;
29            {
30                _8_blend_overlay_component = 2.0 * _in.src.z <= _in.src.w ? (2.0 * _in.dst.z) * _in.src.z : _in.dst.w * _in.src.w - (2.0 * (_in.src.w - _in.src.z)) * (_in.dst.w - _in.dst.z);
31            }
32            float4 _5_result = float4(_6_blend_overlay_component, _7_blend_overlay_component, _8_blend_overlay_component, _in.dst.w + (1.0 - _in.dst.w) * _in.src.w);
33
34
35
36            _5_result.xyz = _5_result.xyz + _in.src.xyz * (1.0 - _in.dst.w) + _in.dst.xyz * (1.0 - _in.src.w);
37            _4_blend_overlay = _5_result;
38        }
39        _0_blend_hard_light = _4_blend_overlay;
40
41    }
42
43    _out->sk_FragColor = _0_blend_hard_light;
44
45    return *_out;
46}
47