1#include <metal_stdlib> 2#include <simd/simd.h> 3using namespace metal; 4struct Uniforms { 5 float4 colorGreen; 6 float4 colorRed; 7}; 8struct Inputs { 9}; 10struct Outputs { 11 float4 sk_FragColor [[color(0)]]; 12}; 13thread float2x2& operator*=(thread float2x2& left, thread const float2x2& right) { 14 left = left * right; 15 return left; 16} 17 18bool test_half_b() { 19 float2x2 m1 = float2x2(float2(1.0, 2.0), float2(3.0, 4.0)); 20 float2x2 m3 = m1; 21 float2x2 m4 = float2x2(1.0); 22 m3 *= m4; 23 float2x2 m5 = float2x2(m1[0].x); 24 float2x2 m6 = float2x2(float2(1.0, 2.0), float2(3.0, 4.0)); 25 m6 += m5; 26 float4x4 m10 = float4x4(1.0); 27 float4x4 m11 = float4x4(2.0); 28 m11 -= m10; 29 return true; 30} 31fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 32 Outputs _out; 33 (void)_out; 34 float2x2 _2_m1 = float2x2(float2(1.0, 2.0), float2(3.0, 4.0)); 35 float2x2 _4_m3 = _2_m1; 36 float2x2 _5_m4 = float2x2(1.0); 37 _4_m3 *= _5_m4; 38 float2x2 _6_m5 = float2x2(_2_m1[0].x); 39 float2x2 _7_m6 = float2x2(float2(1.0, 2.0), float2(3.0, 4.0)); 40 _7_m6 += _6_m5; 41 float4x4 _10_m10 = float4x4(1.0); 42 float4x4 _11_m11 = float4x4(2.0); 43 _11_m11 -= _10_m10; 44 _out.sk_FragColor = true && test_half_b() ? _uniforms.colorGreen : _uniforms.colorRed; 45 return _out; 46} 47