• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    float unknownInput;
6};
7struct Inputs {
8};
9struct Outputs {
10    half4 sk_FragColor [[color(0)]];
11};
12fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
13    Outputs _out;
14    (void)_out;
15    if (_uniforms.unknownInput > 5.0) {
16        _out.sk_FragColor = half4(0.75h);
17    } else {
18        discard_fragment();
19    }
20    int i = 0;
21    while (i < 10) {
22        _out.sk_FragColor *= 0.5h;
23        i++;
24    }
25    do {
26        _out.sk_FragColor += 0.25h;
27    } while (_out.sk_FragColor.x < 0.75h);
28    for (int i = 0;i < 10; i++) {
29        if (i % 2 == 1) break; else if (i > 100) return _out; else continue;
30    }
31    return _out;
32}
33