1#pragma clang diagnostic ignored "-Wmissing-prototypes"
2#pragma clang diagnostic ignored "-Wmissing-braces"
3
4#include <metal_stdlib>
5#include <simd/simd.h>
6
7using namespace metal;
8
9template<typename T, size_t Num>
10struct spvUnsafeArray
11{
12    T elements[Num ? Num : 1];
13    
14    thread T& operator [] (size_t pos) thread
15    {
16        return elements[pos];
17    }
18    constexpr const thread T& operator [] (size_t pos) const thread
19    {
20        return elements[pos];
21    }
22    
23    device T& operator [] (size_t pos) device
24    {
25        return elements[pos];
26    }
27    constexpr const device T& operator [] (size_t pos) const device
28    {
29        return elements[pos];
30    }
31    
32    constexpr const constant T& operator [] (size_t pos) const constant
33    {
34        return elements[pos];
35    }
36    
37    threadgroup T& operator [] (size_t pos) threadgroup
38    {
39        return elements[pos];
40    }
41    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
42    {
43        return elements[pos];
44    }
45};
46
47struct main0_out
48{
49    float4 FragColor [[color(0)]];
50};
51
52struct main0_in
53{
54    float gl_CullDistance_0 [[user(cull0)]];
55    float gl_CullDistance_1 [[user(cull1)]];
56};
57
58fragment main0_out main0(main0_in in [[stage_in]])
59{
60    main0_out out = {};
61    spvUnsafeArray<float, 2> gl_CullDistance = {};
62    gl_CullDistance[0] = in.gl_CullDistance_0;
63    gl_CullDistance[1] = in.gl_CullDistance_1;
64    out.FragColor = float4((1.0 - gl_CullDistance[0]) - gl_CullDistance[1]);
65    return out;
66}
67
68