#pragma clang diagnostic ignored "-Wmissing-prototypes" #include #include using namespace metal; // Implementation of the signed GLSL findMSB() function template inline T spvFindSMSB(T x) { T v = select(x, T(-1) - x, x < T(0)); return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); } // Implementation of the unsigned GLSL findMSB() function template inline T spvFindUMSB(T x) { return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); } // Implementation of the GLSL sign() function for integer types template::value>::type> inline T sign(T x) { return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); } struct SSBO { int4 ints; uint4 uints; }; kernel void main0(device SSBO& _6 [[buffer(0)]]) { int4 _19 = _6.ints; uint4 _20 = _6.uints; _6.ints = abs(_19); _6.uints = uint4(abs(_19)); _6.ints = abs(int4(_20)); _6.uints = uint4(abs(int4(_20))); _6.ints = sign(_19); _6.uints = uint4(sign(_19)); _6.ints = sign(int4(_20)); _6.uints = uint4(sign(int4(_20))); _6.ints = spvFindSMSB(int4(_20)); _6.uints = uint4(spvFindSMSB(int4(_20))); _6.ints = int4(spvFindUMSB(uint4(_19))); _6.uints = spvFindUMSB(uint4(_19)); _6.ints = min(_19, _19); _6.uints = uint4(min(_19, int4(_20))); _6.ints = min(int4(_20), int4(_20)); _6.uints = uint4(min(int4(_20), _19)); _6.ints = int4(min(uint4(_19), _20)); _6.uints = min(uint4(_19), _20); _6.ints = int4(min(_20, uint4(_19))); _6.uints = min(_20, uint4(_19)); _6.ints = max(_19, _19); _6.uints = uint4(max(_19, _19)); _6.ints = max(int4(_20), _19); _6.uints = uint4(max(int4(_20), _19)); _6.ints = int4(max(uint4(_19), _20)); _6.uints = max(uint4(_19), uint4(_19)); _6.ints = int4(max(_20, uint4(_19))); _6.uints = max(_20, uint4(_19)); _6.ints = clamp(int4(_20), int4(_20), int4(_20)); _6.uints = uint4(clamp(int4(_20), int4(_20), int4(_20))); _6.ints = int4(clamp(uint4(_19), uint4(_19), uint4(_19))); _6.uints = clamp(uint4(_19), uint4(_19), uint4(_19)); }