• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 colorWhite;
9    half4 colorGreen;
10    half4 colorRed;
11    float2x2 testMatrix2x2;
12    float3x3 testMatrix3x3;
13    float4x4 testMatrix4x4;
14};
15struct Inputs {
16};
17struct Outputs {
18    half4 sk_FragColor [[color(0)]];
19};
20thread 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 float4x4 left, const float4x4 right);thread bool operator!=(const float4x4 left, const float4x4 right);thread 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 half4x4 left, const half4x4 right);thread bool operator!=(const half4x4 left, const half4x4 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);}thread bool operator==(const float4x4 left, const float4x4 right) {return all(left[0] == right[0]) && all(left[1] == right[1]) && all(left[2] == right[2]) && all(left[3] == right[3]);}thread bool operator!=(const float4x4 left, const float4x4 right) {return !(left == 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 half4x4 left, const half4x4 right) {return all(left[0] == right[0]) && all(left[1] == right[1]) && all(left[2] == right[2]) && all(left[3] == right[3]);}thread bool operator!=(const half4x4 left, const half4x4 right) {return !(left == right);}bool test_iscalar_b(Uniforms _uniforms) {
21    int x = int(_uniforms.colorWhite.x);
22    x = -x;
23    return x == -1;
24}
25bool test_fvec_b(Uniforms _uniforms) {
26    half2 x = _uniforms.colorWhite.xy;
27    x = -x;
28    return all(x == half2(-1.0h));
29}
30bool test_ivec_b(Uniforms _uniforms) {
31    int2 x = int2(int(_uniforms.colorWhite.x));
32    x = -x;
33    return all(x == int2(-1));
34}
35bool test_mat2_b(Uniforms _uniforms) {
36    const float2x2 negated = float2x2(float2(-1.0, -2.0), float2(-3.0, -4.0));
37    float2x2 x = _uniforms.testMatrix2x2;
38    x = (-1.0 * x);
39    return x == negated;
40}
41bool test_mat3_b(Uniforms _uniforms) {
42    const float3x3 negated = float3x3(float3(-1.0, -2.0, -3.0), float3(-4.0, -5.0, -6.0), float3(-7.0, -8.0, -9.0));
43    float3x3 x = _uniforms.testMatrix3x3;
44    x = (-1.0 * x);
45    return x == negated;
46}
47bool test_mat4_b(Uniforms _uniforms) {
48    const float4x4 negated = float4x4(float4(-1.0, -2.0, -3.0, -4.0), float4(-5.0, -6.0, -7.0, -8.0), float4(-9.0, -10.0, -11.0, -12.0), float4(-13.0, -14.0, -15.0, -16.0));
49    float4x4 x = _uniforms.testMatrix4x4;
50    x = (-1.0 * x);
51    return x == negated;
52}
53bool test_hmat2_b(Uniforms _uniforms) {
54    const half2x2 negated = half2x2(half2(-1.0h, -2.0h), half2(-3.0h, -4.0h));
55    half2x2 x = half2x2(_uniforms.testMatrix2x2);
56    x = (-1.0h * x);
57    return x == negated;
58}
59bool test_hmat3_b(Uniforms _uniforms) {
60    const half3x3 negated = half3x3(half3(-1.0h, -2.0h, -3.0h), half3(-4.0h, -5.0h, -6.0h), half3(-7.0h, -8.0h, -9.0h));
61    half3x3 x = half3x3(_uniforms.testMatrix3x3);
62    x = (-1.0h * x);
63    return x == negated;
64}
65bool test_hmat4_b(Uniforms _uniforms) {
66    const half4x4 negated = half4x4(half4(-1.0h, -2.0h, -3.0h, -4.0h), half4(-5.0h, -6.0h, -7.0h, -8.0h), half4(-9.0h, -10.0h, -11.0h, -12.0h), half4(-13.0h, -14.0h, -15.0h, -16.0h));
67    half4x4 x = half4x4(_uniforms.testMatrix4x4);
68    x = (-1.0h * x);
69    return x == negated;
70}
71fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
72    Outputs _out;
73    (void)_out;
74    float _0_x = float(_uniforms.colorWhite.x);
75    _0_x = -_0_x;
76    _out.sk_FragColor = ((((((((_0_x == -1.0 && test_iscalar_b(_uniforms)) && test_fvec_b(_uniforms)) && test_ivec_b(_uniforms)) && test_mat2_b(_uniforms)) && test_mat3_b(_uniforms)) && test_mat4_b(_uniforms)) && test_hmat2_b(_uniforms)) && test_hmat3_b(_uniforms)) && test_hmat4_b(_uniforms) ? _uniforms.colorGreen : _uniforms.colorRed;
77    return _out;
78}
79