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 half2x2 testMatrix2x2; 11 half3x3 testMatrix3x3; 12}; 13struct Inputs { 14}; 15struct Outputs { 16 half4 sk_FragColor [[color(0)]]; 17}; 18thread bool operator==(const half2x2 left, const half2x2 right);thread bool operator!=(const half2x2 left, const half2x2 right);thread bool operator==(const half3x3 left, const half3x3 right);thread bool operator!=(const half3x3 left, const half3x3 right);thread bool operator==(const float2x2 left, const float2x2 right);thread bool operator!=(const float2x2 left, const float2x2 right);thread bool operator==(const float3x3 left, const float3x3 right);thread bool operator!=(const float3x3 left, const float3x3 right);thread bool operator==(const half2x2 left, const half2x2 right) {return all(left[0] == right[0]) && all(left[1] == right[1]);}thread bool operator!=(const half2x2 left, const half2x2 right) {return !(left == right);}thread bool operator==(const half3x3 left, const half3x3 right) {return all(left[0] == right[0]) && all(left[1] == right[1]) && all(left[2] == right[2]);}thread bool operator!=(const half3x3 left, const half3x3 right) {return !(left == right);}thread bool operator==(const float2x2 left, const float2x2 right) {return all(left[0] == right[0]) && all(left[1] == right[1]);}thread bool operator!=(const float2x2 left, const float2x2 right) {return !(left == right);}thread bool operator==(const float3x3 left, const float3x3 right) {return all(left[0] == right[0]) && all(left[1] == right[1]) && all(left[2] == right[2]);}thread bool operator!=(const float3x3 left, const float3x3 right) {return !(left == right);}float3x3 float3x3_from_float2x2(float2x2 x0) { 19 return float3x3(float3(x0[0].xy, 0.0), float3(x0[1].xy, 0.0), float3(0.0, 0.0, 1.0)); 20} 21float2x2 float2x2_from_float3x3(float3x3 x0) { 22 return float2x2(float2(x0[0].xy), float2(x0[1].xy)); 23} 24half4 half4_from_half2x2(half2x2 x) {return half4(x[0].xy, x[1].xy);}fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 25 Outputs _out; 26 (void)_out; 27 bool _0_ok = true; 28 _0_ok = _0_ok && _uniforms.testMatrix2x2 == half2x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h)); 29 _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)); 30 _0_ok = _0_ok && _uniforms.testMatrix2x2 != half2x2(100.0h); 31 _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)); 32 float _1_zero = float(_uniforms.colorGreen.x); 33 float _2_one = float(_uniforms.colorGreen.y); 34 float _3_two = 2.0 * _2_one; 35 float _4_nine = 9.0 * _2_one; 36 _0_ok = _0_ok && float2x2(float2(_2_one, _1_zero), float2(_1_zero, _2_one)) == float2x2(float2(1.0, 0.0), float2(0.0, 1.0)); 37 _0_ok = _0_ok && float2x2(float2(_2_one, _1_zero), float2(_2_one)) != float2x2(float2(1.0, 0.0), float2(0.0, 1.0)); 38 _0_ok = _0_ok && float2x2(_2_one) == float2x2(1.0); 39 _0_ok = _0_ok && float2x2(_2_one) != float2x2(0.0); 40 _0_ok = _0_ok && float2x2(-_2_one) == float2x2(-1.0); 41 _0_ok = _0_ok && float2x2(_1_zero) == float2x2(-0.0); 42 _0_ok = _0_ok && (-1.0 * float2x2(-_2_one)) == float2x2(1.0); 43 _0_ok = _0_ok && (-1.0 * float2x2(_1_zero)) == float2x2(-0.0); 44 _0_ok = _0_ok && float2x2(_2_one) == float2x2(float2(1.0, 0.0), float2(0.0, 1.0)); 45 _0_ok = _0_ok && float2x2(_3_two) != float2x2(float2(1.0, 0.0), float2(0.0, 1.0)); 46 _0_ok = _0_ok && float2x2(_2_one) == float2x2(1.0); 47 _0_ok = _0_ok && float2x2(_2_one) != float2x2(0.0); 48 _0_ok = _0_ok && float3x3(float3(_2_one, _1_zero, _1_zero), float3(_1_zero, _2_one, _1_zero), float3(_1_zero, _1_zero, _2_one)) == float3x3_from_float2x2(float2x2(1.0)); 49 _0_ok = _0_ok && float3x3(float3(_4_nine, _1_zero, _1_zero), float3(_1_zero, _4_nine, _1_zero), float3(_1_zero, _1_zero, _2_one)) == float3x3_from_float2x2(float2x2(9.0)); 50 _0_ok = _0_ok && float3x3(_2_one) == float3x3_from_float2x2(float2x2(1.0)); 51 _0_ok = _0_ok && float3x3(float3(_4_nine, 0.0, 0.0), float3(0.0, _4_nine, 0.0), float3(0.0, 0.0, _2_one)) == float3x3_from_float2x2(float2x2(9.0)); 52 _0_ok = _0_ok && float2x2_from_float3x3(float3x3(_2_one)) == float2x2(1.0); 53 _0_ok = _0_ok && float2x2_from_float3x3(float3x3(_2_one)) == float2x2(1.0); 54 _0_ok = _0_ok && float2x2(float2(_2_one, _1_zero), float2(_1_zero, _2_one)) == float2x2(1.0); 55 _0_ok = _0_ok && float2x2(float2(_2_one, _1_zero), float2(_1_zero, _2_one)) == float2x2(1.0); 56 _0_ok = _0_ok && float2x2(float2(_2_one, _1_zero), float2(_1_zero, _2_one)) == float2x2(1.0); 57 _0_ok = _0_ok && all(float4(half4_from_half2x2(_uniforms.testMatrix2x2)) * float4(_2_one) == float4(1.0, 2.0, 3.0, 4.0)); 58 _0_ok = _0_ok && all(float4(half4_from_half2x2(_uniforms.testMatrix2x2)) * float4(_2_one) == float4(half4_from_half2x2(_uniforms.testMatrix2x2))); 59 _0_ok = _0_ok && all(float4(half4_from_half2x2(_uniforms.testMatrix2x2)) * float4(_1_zero) == float4(0.0)); 60 float3x3 _5_m = float3x3(float3(_2_one, _3_two, 3.0), float3(4.0, 5.0, 6.0), float3(7.0, 8.0, _4_nine)); 61 _0_ok = _0_ok && all(_5_m[0] == float3(1.0, 2.0, 3.0)); 62 _0_ok = _0_ok && all(_5_m[1] == float3(4.0, 5.0, 6.0)); 63 _0_ok = _0_ok && all(_5_m[2] == float3(7.0, 8.0, 9.0)); 64 _0_ok = _0_ok && _5_m[0].x == 1.0; 65 _0_ok = _0_ok && _5_m[0].y == 2.0; 66 _0_ok = _0_ok && _5_m[0].z == 3.0; 67 _0_ok = _0_ok && _5_m[1].x == 4.0; 68 _0_ok = _0_ok && _5_m[1].y == 5.0; 69 _0_ok = _0_ok && _5_m[1].z == 6.0; 70 _0_ok = _0_ok && _5_m[2].x == 7.0; 71 _0_ok = _0_ok && _5_m[2].y == 8.0; 72 _0_ok = _0_ok && _5_m[2].z == 9.0; 73 _out.sk_FragColor = _0_ok ? _uniforms.colorGreen : _uniforms.colorRed; 74 return _out; 75} 76