2021-03-16 14:40:11 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
2021-03-15 18:58:57 +00:00
|
|
|
struct Uniforms {
|
2020-10-06 18:43:32 +00:00
|
|
|
float4 src;
|
|
|
|
float4 dst;
|
2020-09-25 17:35:58 +00:00
|
|
|
};
|
2021-03-15 18:58:57 +00:00
|
|
|
struct Inputs {
|
|
|
|
};
|
2020-09-25 17:35:58 +00:00
|
|
|
struct Outputs {
|
|
|
|
float4 sk_FragColor [[color(0)]];
|
|
|
|
};
|
2021-03-22 15:57:41 +00:00
|
|
|
float _blend_overlay_component_hh2h2(float2 s, float2 d) {
|
2020-11-23 19:48:06 +00:00
|
|
|
return 2.0 * d.x <= d.y ? (2.0 * s.x) * d.x : s.y * d.y - (2.0 * (d.y - d.x)) * (s.y - s.x);
|
|
|
|
}
|
2021-03-15 18:58:57 +00:00
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
2021-01-19 18:07:55 +00:00
|
|
|
Outputs _out;
|
2021-01-22 03:24:28 +00:00
|
|
|
(void)_out;
|
2021-03-22 15:57:41 +00:00
|
|
|
float4 _0_result = float4(_blend_overlay_component_hh2h2(_uniforms.src.xw, _uniforms.dst.xw), _blend_overlay_component_hh2h2(_uniforms.src.yw, _uniforms.dst.yw), _blend_overlay_component_hh2h2(_uniforms.src.zw, _uniforms.dst.zw), _uniforms.src.w + (1.0 - _uniforms.src.w) * _uniforms.dst.w);
|
2021-03-15 18:58:57 +00:00
|
|
|
_0_result.xyz = _0_result.xyz + _uniforms.dst.xyz * (1.0 - _uniforms.src.w) + _uniforms.src.xyz * (1.0 - _uniforms.dst.w);
|
2021-03-15 22:08:38 +00:00
|
|
|
_out.sk_FragColor = _0_result;
|
2021-01-19 18:07:55 +00:00
|
|
|
return _out;
|
2020-09-25 17:35:58 +00:00
|
|
|
}
|