• 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};
13struct Globals {
14    int scratchVar;
15};
16bool test_flat_b() {
17    return true;
18}
19bool test_if_b(Uniforms _uniforms, thread Globals& _globals) {
20    if (_uniforms.colorGreen.y > 0.0h) {
21        return true;
22    } else {
23        ++_globals.scratchVar;
24    }
25    ++_globals.scratchVar;
26    return false;
27}
28bool test_else_b(Uniforms _uniforms) {
29    if (_uniforms.colorGreen.y == 0.0h) {
30        return false;
31    } else {
32        return true;
33    }
34}
35bool test_loop_if_b(Uniforms _uniforms, thread Globals& _globals) {
36    for (int x = 0;x <= 1; ++x) {
37        if (_uniforms.colorGreen.y == 0.0h) {
38            return false;
39        } else {
40            return true;
41        }
42    }
43    ++_globals.scratchVar;
44    return true;
45}
46fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
47    Globals _globals{0};
48    (void)_globals;
49    Outputs _out;
50    (void)_out;
51    _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;
52    return _out;
53}
54