f201af8b00
The following types of expression are hoisted directly into the inlined code: - Struct field access: `myStruct.myField` - Swizzles: `myVector.xzy` - Simple array indexes: `myArray[0]` This significantly reduces the number of temporary variables generated by the inliner. Change-Id: Ifed226ecc87b096ec1e38752c0c38ae32bd31578 Bug: skia:10737, skia:10786 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319919 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
45 lines
1.7 KiB
Metal
45 lines
1.7 KiB
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
float4 srcdst;
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _outputStruct;
|
|
thread Outputs* _out = &_outputStruct;
|
|
float4 _0_blend_hard_light;
|
|
{
|
|
float4 _3_blend_overlay;
|
|
{
|
|
float _5_blend_overlay_component;
|
|
{
|
|
_5_blend_overlay_component = 2.0 * _in.src.x <= _in.src.w ? (2.0 * _in.dst.x) * _in.src.x : _in.dst.w * _in.src.w - (2.0 * (_in.src.w - _in.src.x)) * (_in.dst.w - _in.dst.x);
|
|
}
|
|
float _6_blend_overlay_component;
|
|
{
|
|
_6_blend_overlay_component = 2.0 * _in.src.y <= _in.src.w ? (2.0 * _in.dst.y) * _in.src.y : _in.dst.w * _in.src.w - (2.0 * (_in.src.w - _in.src.y)) * (_in.dst.w - _in.dst.y);
|
|
}
|
|
float _7_blend_overlay_component;
|
|
{
|
|
_7_blend_overlay_component = 2.0 * _in.src.z <= _in.src.w ? (2.0 * _in.dst.z) * _in.src.z : _in.dst.w * _in.src.w - (2.0 * (_in.src.w - _in.src.z)) * (_in.dst.w - _in.dst.z);
|
|
}
|
|
float4 _4_result = float4(_5_blend_overlay_component, _6_blend_overlay_component, _7_blend_overlay_component, _in.dst.w + (1.0 - _in.dst.w) * _in.src.w);
|
|
|
|
|
|
|
|
_4_result.xyz = _4_result.xyz + _in.src.xyz * (1.0 - _in.dst.w) + _in.dst.xyz * (1.0 - _in.src.w);
|
|
_3_blend_overlay = _4_result;
|
|
}
|
|
_0_blend_hard_light = _3_blend_overlay;
|
|
|
|
}
|
|
|
|
_out->sk_FragColor = _0_blend_hard_light;
|
|
|
|
return *_out;
|
|
}
|