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} 17thread float3x3& operator*=(thread float3x3& left, thread const float3x3& right) { 18 left = left * right; 19 return left; 20} 21thread float4x4& operator*=(thread float4x4& left, thread const float4x4& right) { 22 left = left * right; 23 return left; 24} 25 26bool test_half_b() { 27 float2x3 m23 = float2x3(23.0); 28 float2x4 m24 = float2x4(24.0); 29 float3x2 m32 = float3x2(32.0); 30 float3x4 m34 = float3x4(34.0); 31 float4x2 m42 = float4x2(42.0); 32 float4x3 m43 = float4x3(44.0); 33 float2x2 m22 = m32 * m23; 34 m22 *= m22; 35 float3x3 m33 = m43 * m34; 36 m33 *= m33; 37 float4x4 m44 = m24 * m42; 38 m44 *= m44; 39 return true; 40} 41fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 42 Outputs _out; 43 (void)_out; 44 float2x3 _0_m23 = float2x3(23.0); 45 float2x4 _1_m24 = float2x4(24.0); 46 float3x2 _2_m32 = float3x2(32.0); 47 float3x4 _3_m34 = float3x4(34.0); 48 float4x2 _4_m42 = float4x2(42.0); 49 float4x3 _5_m43 = float4x3(44.0); 50 float2x2 _6_m22 = _2_m32 * _0_m23; 51 _6_m22 *= _6_m22; 52 float3x3 _7_m33 = _5_m43 * _3_m34; 53 _7_m33 *= _7_m33; 54 float4x4 _8_m44 = _1_m24 * _4_m42; 55 _8_m44 *= _8_m44; 56 _out.sk_FragColor = true && test_half_b() ? _uniforms.colorGreen : _uniforms.colorRed; 57 return _out; 58} 59