1#include <metal_stdlib> 2#include <simd/simd.h> 3using namespace metal; 4struct Uniforms { 5 half4 colorRed; 6 half4 colorGreen; 7 half4 testInputs; 8}; 9struct Inputs { 10}; 11struct Outputs { 12 half4 sk_FragColor [[color(0)]]; 13}; 14half fn_hh4(half4 v) { 15 for (int x = 1;x <= 2; ++x) { 16 return v.x; 17 } 18} 19fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 20 Outputs _out; 21 (void)_out; 22 half4 v = _uniforms.testInputs; 23 v = half4(0.0h, v.zyx); 24 v = half4(0.0h, 0.0h, v.xw); 25 v = half4(1.0h, 1.0h, v.wx); 26 v = half4(v.zy, 1.0h, 1.0h); 27 v = half4(v.xx, 1.0h, 1.0h); 28 v = v.wzwz; 29 v = half3(fn_hh4(v), 123.0h, 456.0h).yyzz; 30 v = half3(fn_hh4(v), 123.0h, 456.0h).yyzz; 31 v = half4(123.0h, 456.0h, 456.0h, fn_hh4(v)); 32 v = half4(123.0h, 456.0h, 456.0h, fn_hh4(v)); 33 v = half3(fn_hh4(v), 123.0h, 456.0h).yxxz; 34 v = half3(fn_hh4(v), 123.0h, 456.0h).yxxz; 35 v = half4(1.0h, 1.0h, 2.0h, 3.0h); 36 v = half4(_uniforms.colorRed.xyz, 1.0h); 37 v = half4(_uniforms.colorRed.x, 1.0h, _uniforms.colorRed.yz); 38 v.wzyx = v; 39 v.xw = v.yz; 40 v.zyx = half3(v.ww, 1.0h); 41 _out.sk_FragColor = all(v == half4(1.0h)) ? _uniforms.colorGreen : _uniforms.colorRed; 42 return _out; 43} 44