Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert

raw
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
7 using namespace metal;
8
9 template<typename T, size_t Num>
10 struct 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
47 constant spvUnsafeArray<float4, 4> _68 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(2.0), float4(3.0) });
48
49 struct main0_out
50 {
51 float4 gl_Position [[position]];
52 };
53
54 struct main0_in
55 {
56 int Index1 [[attribute(0)]];
57 int Index2 [[attribute(1)]];
58 };
59
60 static inline __attribute__((always_inline))
61 float4 consume_constant_arrays2(spvUnsafeArray<float4, 4> positions, spvUnsafeArray<float4, 4> positions2, thread int& Index1, thread int& Index2)
62 {
63 spvUnsafeArray<float4, 4> indexable;
64 indexable = positions;
65 spvUnsafeArray<float4, 4> indexable_1;
66 indexable_1 = positions2;
67 return indexable[Index1] + indexable_1[Index2];
68 }
69
70 static inline __attribute__((always_inline))
71 float4 consume_constant_arrays(spvUnsafeArray<float4, 4> positions, spvUnsafeArray<float4, 4> positions2, thread int& Index1, thread int& Index2)
72 {
73 return consume_constant_arrays2(positions, positions2, Index1, Index2);
74 }
75
76 vertex main0_out main0(main0_in in [[stage_in]])
77 {
78 main0_out out = {};
79 spvUnsafeArray<float4, 4> LUT2;
80 LUT2[0] = float4(10.0);
81 LUT2[1] = float4(11.0);
82 LUT2[2] = float4(12.0);
83 LUT2[3] = float4(13.0);
84 out.gl_Position = consume_constant_arrays(_68, LUT2, in.Index1, in.Index2);
85 return out;
86 }
87