1#include <metal_stdlib> 2#include <simd/simd.h> 3using namespace metal; 4struct Uniforms { 5 half4 colorGreen; 6 half4 colorRed; 7 half2x2 testMatrix2x2; 8 half3x3 testMatrix3x3; 9}; 10struct Inputs { 11}; 12struct Outputs { 13 half4 sk_FragColor [[color(0)]]; 14}; 15 16thread bool operator==(const half2x2 left, const half2x2 right); 17thread bool operator!=(const half2x2 left, const half2x2 right); 18 19thread bool operator==(const half3x3 left, const half3x3 right); 20thread bool operator!=(const half3x3 left, const half3x3 right); 21thread bool operator==(const half2x2 left, const half2x2 right) { 22 return all(left[0] == right[0]) && 23 all(left[1] == right[1]); 24} 25thread bool operator!=(const half2x2 left, const half2x2 right) { 26 return !(left == right); 27} 28thread bool operator==(const half3x3 left, const half3x3 right) { 29 return all(left[0] == right[0]) && 30 all(left[1] == right[1]) && 31 all(left[2] == right[2]); 32} 33thread bool operator!=(const half3x3 left, const half3x3 right) { 34 return !(left == right); 35} 36fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 37 Outputs _out; 38 (void)_out; 39 bool _0_ok = true; 40 _0_ok = _0_ok && _uniforms.testMatrix2x2 == half2x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h)); 41 _0_ok = _0_ok && _uniforms.testMatrix3x3 == half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h)); 42 _0_ok = _0_ok && _uniforms.testMatrix2x2 != half2x2(100.0h); 43 _0_ok = _0_ok && _uniforms.testMatrix3x3 != half3x3(half3(9.0h, 8.0h, 7.0h), half3(6.0h, 5.0h, 4.0h), half3(3.0h, 2.0h, 1.0h)); 44 _out.sk_FragColor = _0_ok ? _uniforms.colorGreen : _uniforms.colorRed; 45 return _out; 46} 47