2021-08-05 14:35:01 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct Uniforms {
|
|
|
|
float4 colorGreen;
|
|
|
|
float4 colorRed;
|
|
|
|
};
|
|
|
|
struct Inputs {
|
|
|
|
};
|
|
|
|
struct Outputs {
|
|
|
|
float4 sk_FragColor [[color(0)]];
|
|
|
|
};
|
2021-08-04 17:27:05 +00:00
|
|
|
|
2021-08-05 14:35:01 +00:00
|
|
|
template <typename T1, typename T2, size_t N>
|
|
|
|
bool operator==(thread const array<T1, N>& left, thread const array<T2, N>& right) {
|
|
|
|
for (size_t index = 0; index < N; ++index) {
|
2021-08-10 14:31:12 +00:00
|
|
|
if (!(left[index] == right[index])) {
|
2021-08-05 14:35:01 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T1, typename T2, size_t N>
|
|
|
|
bool operator!=(thread const array<T1, N>& left, thread const array<T2, N>& right) {
|
|
|
|
return !(left == right);
|
|
|
|
}
|
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
|
|
Outputs _out;
|
|
|
|
(void)_out;
|
|
|
|
array<int, 2> i2 = array<int, 2>{1, 2};
|
2021-08-09 18:20:54 +00:00
|
|
|
array<int, 2> s2 = array<int, 2>{1, 2};
|
2021-08-05 14:35:01 +00:00
|
|
|
array<float, 2> f2 = array<float, 2>{1.0, 2.0};
|
|
|
|
array<float, 2> h2 = array<float, 2>{1.0, 2.0};
|
|
|
|
const array<float, 2> cf2 = array<float, 2>{1.0, 2.0};
|
|
|
|
_out.sk_FragColor = ((i2 == s2 && f2 == h2) && i2 == array<int, 2>{1, 2}) && h2 == cf2 ? _uniforms.colorGreen : _uniforms.colorRed;
|
|
|
|
return _out;
|
|
|
|
}
|