xref: /aosp_15_r20/external/skia/tests/sksl/blend/BlendHardLight.hlsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1cbuffer _UniformBuffer : register(b0, space0)
2{
3    float4 _9_src : packoffset(c0);
4    float4 _9_dst : packoffset(c1);
5};
6
7
8static float4 sk_FragColor;
9
10struct SPIRV_Cross_Output
11{
12    float4 sk_FragColor : SV_Target0;
13};
14
15float blend_overlay_component_Qhh2h2(float2 _15, float2 _16)
16{
17    float _26 = 0.0f;
18    if ((2.0f * _16.x) <= _16.y)
19    {
20        _26 = (2.0f * _15.x) * _16.x;
21    }
22    else
23    {
24        _26 = (_15.y * _16.y) - ((2.0f * (_16.y - _16.x)) * (_15.y - _15.x));
25    }
26    return _26;
27}
28
29float4 blend_overlay_h4h4h4(float4 _58, float4 _59)
30{
31    float2 _64 = _58.xw;
32    float2 _67 = _59.xw;
33    float2 _71 = _58.yw;
34    float2 _74 = _59.yw;
35    float2 _78 = _58.zw;
36    float2 _81 = _59.zw;
37    float4 result = float4(blend_overlay_component_Qhh2h2(_64, _67), blend_overlay_component_Qhh2h2(_71, _74), blend_overlay_component_Qhh2h2(_78, _81), _58.w + ((1.0f - _58.w) * _59.w));
38    float4 _94 = result;
39    float3 _110 = _94.xyz + ((_59.xyz * (1.0f - _58.w)) + (_58.xyz * (1.0f - _59.w)));
40    float4 _111 = result;
41    float4 _112 = float4(_110.x, _110.y, _110.z, _111.w);
42    result = _112;
43    return _112;
44}
45
46void frag_main()
47{
48    float4 _121 = _9_dst;
49    float4 _125 = _9_src;
50    sk_FragColor = blend_overlay_h4h4h4(_121, _125);
51}
52
53SPIRV_Cross_Output main()
54{
55    frag_main();
56    SPIRV_Cross_Output stage_output;
57    stage_output.sk_FragColor = sk_FragColor;
58    return stage_output;
59}
60