511c500ad4
These variables were later being eliminated by the dead-code-elimination pass, so you can't see them directly in the final output, but removing them affects the name mangling off all future symbols, so it causes an enormous ripple effect in the diff. And of course, it's a waste of time and memory to synthesize IRNodes just to destroy them later. If we disable control-flow analysis, we lose the dead-code-elimination pass entirely; this change is also beneficial for emitting better code when optimizations are turned off. Change-Id: I882b3be4f3fd99b77d99b6abe128f26bb9252c89 Bug: skia:11319 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375776 Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
44 lines
1.5 KiB
Metal
44 lines
1.5 KiB
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
float4 src;
|
|
float4 dst;
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
|
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _out;
|
|
(void)_out;
|
|
float _0_alpha = _in.dst.w * _in.src.w;
|
|
float3 _1_sda = _in.src.xyz * _in.dst.w;
|
|
float3 _2_dsa = _in.dst.xyz * _in.src.w;
|
|
float3 _3_blend_set_color_luminance;
|
|
float _4_lum = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _1_sda);
|
|
|
|
float3 _5_result = (_4_lum - dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _2_dsa)) + _2_dsa;
|
|
|
|
float _6_minComp = min(min(_5_result.x, _5_result.y), _5_result.z);
|
|
float _7_maxComp = max(max(_5_result.x, _5_result.y), _5_result.z);
|
|
if (_6_minComp < 0.0 && _4_lum != _6_minComp) {
|
|
float _8_d = _4_lum - _6_minComp;
|
|
_5_result = _4_lum + (_5_result - _4_lum) * (_4_lum / _8_d);
|
|
|
|
}
|
|
if (_7_maxComp > _0_alpha && _7_maxComp != _4_lum) {
|
|
float3 _9_n = (_5_result - _4_lum) * (_0_alpha - _4_lum);
|
|
float _10_d = _7_maxComp - _4_lum;
|
|
_3_blend_set_color_luminance = _4_lum + _9_n / _10_d;
|
|
|
|
} else {
|
|
_3_blend_set_color_luminance = _5_result;
|
|
}
|
|
_out.sk_FragColor = float4((((_3_blend_set_color_luminance + _in.dst.xyz) - _2_dsa) + _in.src.xyz) - _1_sda, (_in.src.w + _in.dst.w) - _0_alpha);
|
|
|
|
|
|
return _out;
|
|
}
|