1#include <metal_stdlib> 2#include <simd/simd.h> 3using namespace metal; 4struct Inputs { 5}; 6struct Outputs { 7 half4 sk_FragColor [[color(0)]]; 8}; 9fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 10 Outputs _out; 11 (void)_out; 12 half4 result = half4(0.0h); 13 { 14 half a = 0.0h; 15 half b = 0.0h; 16 for (; a < 10.0h && b < 10.0h; (++a , ++b)) { 17 result.x = result.x + a; 18 result.y = result.y + b; 19 } 20 } 21 { 22 int c = 0; 23 for (; c < 10; ++c) { 24 result.z = result.z + 1.0h; 25 } 26 } 27 { 28 array<float, 2> d = array<float, 2>{0.0, 10.0}; 29 array<float, 4> e = array<float, 4>{1.0, 2.0, 3.0, 4.0}; 30 float f = 9.0; 31 for (; d[0] < d[1]; ++d[0]) { 32 result.w = half(e[0] * f); 33 } 34 } 35 { 36 for (; ; ) break; 37 } 38 for (; ; ) break; 39 _out.sk_FragColor = result; 40 return _out; 41} 42