xref: /aosp_15_r20/external/skia/tests/sksl/metal/SwizzleHelper.metal (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#include <metal_stdlib>
2#include <simd/simd.h>
3#ifdef __clang__
4#pragma clang diagnostic ignored "-Wall"
5#endif
6using namespace metal;
7struct Inputs {
8};
9struct Outputs {
10    half4 sk_FragColor [[color(0)]];
11};
12struct Globals {
13    half2 glob;
14};
15half4 fn_h4hh2h2h3(thread Globals& _globals, half a, thread half2& b, thread half2& c, thread half3& d) {
16    a = _out.sk_FragColor.x + a;
17    b = _out.sk_FragColor.yz - _globals.glob.y;
18    c *= a;
19    d = _out.sk_FragColor.www / d;
20    return half4(a, b.x, c.y, d.x);
21}
22fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
23    Globals _globals{half2(1.0h)};
24    (void)_globals;
25    Outputs _out;
26    (void)_out;
27    half2 _skTemp0;
28    half2 _skTemp1;
29    half3 _skTemp2;
30    half4 _skTemp3;
31    half2 a = half2(1.0h);
32    half3 b = half3(2.0h);
33    half3x3 d = half3x3(4.0h);
34    _out.sk_FragColor = ((_skTemp3 = fn_h4hh2h2h3(_globals, a.x, _skTemp0, (_skTemp1 = _globals.glob.yx), (_skTemp2 = d[1].zyx))), (b.yz = _skTemp0), (_globals.glob.yx = _skTemp1), (d[1].zyx = _skTemp2), _skTemp3);
35    return _out;
36}
37