• 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};
13void bar_vf(thread float& x);
14void _skOutParamHelper0_bar_vf(thread float& x) {
15    float _var0 = x;
16    bar_vf(_var0);
17    x = _var0;
18}
19float foo_ff2(const float2 v) {
20    return v.x * v.y;
21}
22void bar_vf(thread float& x) {
23    array<float, 2> y;
24    y[0] = x;
25    y[1] = x * 2.0;
26    x = foo_ff2(float2(y[0], y[1]));
27}
28fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
29    Outputs _out;
30    (void)_out;
31    float x = 10.0;
32    _skOutParamHelper0_bar_vf(x);
33    _out.sk_FragColor = x == 200.0 ? _uniforms.colorGreen : _uniforms.colorRed;
34    return _out;
35}
36