0f37907ac7
This CL is conceptually a revert of http://review.skia.org/320258, although the code has changed shape a bit since that CL was landed. This fix was too aggressive, and can lead to functions being dead- stripped while they still have an active reference. Change-Id: I6ce8b0ad9cc2a42e8be8cb10d3a8219149eca6aa Bug: skia:10776 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325462 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
28 lines
659 B
Metal
28 lines
659 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
float4 src;
|
|
float4 dst;
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
|
|
|
|
float4 blend_src_atop(float4 src, float4 dst) {
|
|
return dst.w * src + (1.0 - src.w) * dst;
|
|
}
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _outputStruct;
|
|
thread Outputs* _out = &_outputStruct;
|
|
float4 _0_blend_src_atop;
|
|
{
|
|
_0_blend_src_atop = _in.dst.w * _in.src + (1.0 - _in.src.w) * _in.dst;
|
|
}
|
|
|
|
_out->sk_FragColor = _0_blend_src_atop;
|
|
|
|
return *_out;
|
|
}
|