• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3#ifdef __clang__
4#pragma clang diagnostic ignored "-Wall"
5#endif
6using namespace metal;
7struct Uniforms {
8    half4 colorGreen;
9    half4 colorRed;
10};
11struct Inputs {
12};
13struct Outputs {
14    half4 sk_FragColor [[color(0)]];
15};
16struct Globals {
17    int scratchVar;
18};
19bool test_flat_b() {
20    return true;
21}
22bool test_if_b(Uniforms _uniforms, thread Globals& _globals) {
23    if (_uniforms.colorGreen.y > 0.0h) {
24        return true;
25    } else {
26        ++_globals.scratchVar;
27    }
28    ++_globals.scratchVar;
29    return false;
30}
31bool test_else_b(Uniforms _uniforms) {
32    if (_uniforms.colorGreen.y == 0.0h) {
33        return false;
34    } else {
35        return true;
36    }
37}
38bool test_loop_if_b(Uniforms _uniforms, thread Globals& _globals) {
39    for (int x = 0;x <= 1; ++x) {
40        if (_uniforms.colorGreen.y == 0.0h) {
41            return false;
42        } else {
43            return true;
44        }
45    }
46    ++_globals.scratchVar;
47    return true;
48}
49fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
50    Globals _globals{0};
51    (void)_globals;
52    Outputs _out;
53    (void)_out;
54    _out.sk_FragColor = ((test_flat_b() && test_if_b(_uniforms, _globals)) && test_else_b(_uniforms)) && test_loop_if_b(_uniforms, _globals) ? _uniforms.colorGreen : _uniforms.colorRed;
55    return _out;
56}
57