• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    half4 colorGreen;
6    half4 colorRed;
7};
8struct Inputs {
9};
10struct Outputs {
11    half4 sk_FragColor [[color(0)]];
12};
13half2 tricky_h2hhh2h(half x, half y, thread half2& color, half z);
14half2 _skOutParamHelper0_tricky_h2hhh2h(half _var0, half _var1, thread half4& color, half _var3) {
15    half2 _var2 = color.xz;
16    half2 _skResult = tricky_h2hhh2h(_var0, _var1, _var2, _var3);
17    color.xz = _var2;
18    return _skResult;
19}
20void func_vh4(thread half4& color);
21void _skOutParamHelper1_func_vh4(thread half4& result) {
22    half4 _var0 = result;
23    func_vh4(_var0);
24    result = _var0;
25}
26half2 tricky_h2hhh2h(half x, half y, thread half2& color, half z) {
27    color = color.yx;
28    return half2(x + y, z);
29}
30void func_vh4(thread half4& color) {
31    half2 t =     _skOutParamHelper0_tricky_h2hhh2h(1.0h, 2.0h, color, 5.0h);
32    color.yw = t;
33}
34fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
35    Outputs _out;
36    (void)_out;
37    half4 result = half4(0.0h, 1.0h, 2.0h, 3.0h);
38    _skOutParamHelper1_func_vh4(result);
39    _out.sk_FragColor = all(result == half4(2.0h, 3.0h, 0.0h, 5.0h)) ? _uniforms.colorGreen : _uniforms.colorRed;
40    return _out;
41}
42