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}; 16float foo_ff2(const float2 v) { 17 return v.x * v.y; 18} 19void bar_vf(thread float& x) { 20 array<float, 2> y; 21 y[0] = x; 22 y[1] = x * 2.0; 23 x = foo_ff2(float2(y[0], y[1])); 24} 25fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 26 Outputs _out; 27 (void)_out; 28 float _skTemp0; 29 float x = 10.0; 30 ((bar_vf((_skTemp0 = x))), (x = _skTemp0)); 31 _out.sk_FragColor = x == 200.0 ? _uniforms.colorGreen : _uniforms.colorRed; 32 return _out; 33} 34