xref: /aosp_15_r20/external/skia/tests/sksl/blend/BlendSoftLight.hlsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1cbuffer _UniformBuffer : register(b0, space0)
2{
3    float4 _15_src : packoffset(c0);
4    float4 _15_dst : packoffset(c1);
5};
6
7
8static float4 sk_FragColor;
9
10struct SPIRV_Cross_Output
11{
12    float4 sk_FragColor : SV_Target0;
13};
14
15static float _kGuardedDivideEpsilon = 0.0f;
16
17float soft_light_component_Qhh2h2(float2 _21, float2 _22)
18{
19    if ((2.0f * _21.x) <= _21.y)
20    {
21        return ((((_22.x * _22.x) * (_21.y - (2.0f * _21.x))) / (_22.y + _kGuardedDivideEpsilon)) + ((1.0f - _22.y) * _21.x)) + (_22.x * (((-_21.y) + (2.0f * _21.x)) + 1.0f));
22    }
23    else
24    {
25        if ((4.0f * _22.x) <= _22.y)
26        {
27            float _87 = _22.x * _22.x;
28            float DSqd = _87;
29            float _91 = _87 * _22.x;
30            float DCub = _91;
31            float _97 = _22.y * _22.y;
32            float DaSqd = _97;
33            float _101 = _97 * _22.y;
34            float DaCub = _101;
35            return ((((_97 * (_21.x - (_22.x * (((3.0f * _21.y) - (6.0f * _21.x)) - 1.0f)))) + (((12.0f * _22.y) * _87) * (_21.y - (2.0f * _21.x)))) - ((16.0f * _91) * (_21.y - (2.0f * _21.x)))) - (_101 * _21.x)) / (_97 + _kGuardedDivideEpsilon);
36        }
37        else
38        {
39            return (((_22.x * ((_21.y - (2.0f * _21.x)) + 1.0f)) + _21.x) - (sqrt(_22.y * _22.x) * (_21.y - (2.0f * _21.x)))) - (_22.y * _21.x);
40        }
41    }
42}
43
44void frag_main()
45{
46    _kGuardedDivideEpsilon = false ? 9.9999999392252902907785028219223e-09f : 0.0f;
47    float4 _192 = 0.0f.xxxx;
48    if (_15_dst.w == 0.0f)
49    {
50        _192 = _15_src;
51    }
52    else
53    {
54        float2 _203 = _15_src.xw;
55        float2 _207 = _15_dst.xw;
56        float2 _212 = _15_src.yw;
57        float2 _216 = _15_dst.yw;
58        float2 _221 = _15_src.zw;
59        float2 _225 = _15_dst.zw;
60        _192 = float4(soft_light_component_Qhh2h2(_203, _207), soft_light_component_Qhh2h2(_212, _216), soft_light_component_Qhh2h2(_221, _225), _15_src.w + ((1.0f - _15_src.w) * _15_dst.w));
61    }
62    sk_FragColor = _192;
63}
64
65SPIRV_Cross_Output main()
66{
67    frag_main();
68    SPIRV_Cross_Output stage_output;
69    stage_output.sk_FragColor = sk_FragColor;
70    return stage_output;
71}
72