92748af1a5
This drastically reduces the number of functions which we allow to be inlined. If this change does not hurt our performance, it will allow us to trivially remove hundreds of LOC. All current data leads us to believe that it may affect the Mali 400 but is highly unlikely to change results on any other device in the tree. More info: http://go/optimization-in-sksl-inliner Change-Id: Ia6b706742ce5407453e0e697b6c1f9201084c0e8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384858 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
23 lines
597 B
Metal
23 lines
597 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_darken(float4 src, float4 dst) {
|
|
float4 result = src + (1.0 - src.w) * dst;
|
|
result.xyz = min(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz);
|
|
return result;
|
|
}
|
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _out;
|
|
(void)_out;
|
|
_out.sk_FragColor = blend_darken(_in.src, _in.dst);
|
|
return _out;
|
|
}
|