1#include <metal_stdlib> 2#include <simd/simd.h> 3using namespace metal; 4struct Uniforms { 5 float4 colorGreen; 6 float4 colorRed; 7 float2x2 testMatrix2x2; 8 float3x3 testMatrix3x3; 9}; 10struct Inputs { 11}; 12struct Outputs { 13 float4 sk_FragColor [[color(0)]]; 14}; 15thread bool operator==(const float2x2 left, const float2x2 right) { 16 return all(left[0] == right[0]) && 17 all(left[1] == right[1]); 18} 19thread bool operator!=(const float2x2 left, const float2x2 right) { 20 return !(left == right); 21} 22thread bool operator==(const float3x3 left, const float3x3 right) { 23 return all(left[0] == right[0]) && 24 all(left[1] == right[1]) && 25 all(left[2] == right[2]); 26} 27thread bool operator!=(const float3x3 left, const float3x3 right) { 28 return !(left == right); 29} 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 bool _0_ok = true; 35 _0_ok = _0_ok && _uniforms.testMatrix2x2 == float2x2(float2(1.0, 2.0), float2(3.0, 4.0)); 36 _0_ok = _0_ok && _uniforms.testMatrix3x3 == float3x3(float3(1.0, 2.0, 3.0), float3(4.0, 5.0, 6.0), float3(7.0, 8.0, 9.0)); 37 _0_ok = _0_ok && _uniforms.testMatrix2x2 != float2x2(100.0); 38 _0_ok = _0_ok && _uniforms.testMatrix3x3 != float3x3(float3(9.0, 8.0, 7.0), float3(6.0, 5.0, 4.0), float3(3.0, 2.0, 1.0)); 39 _out.sk_FragColor = _0_ok ? _uniforms.colorGreen : _uniforms.colorRed; 40 return _out; 41} 42