Debian Codegraph @

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

raw
1 #pragma clang diagnostic ignored "-Wmissing-prototypes"
2
3 #include <metal_stdlib>
4 #include <simd/simd.h>
5
6 using namespace metal;
7
8 constant float4 _68[4] = { float4(0.0), float4(1.0), float4(2.0), float4(3.0) };
9
10 struct main0_out
11 {
12 float4 gl_Position [[position]];
13 };
14
15 struct main0_in
16 {
17 int Index1 [[attribute(0)]];
18 int Index2 [[attribute(1)]];
19 };
20
21 template<typename T, uint A>
22 inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
23 {
24 for (uint i = 0; i < A; i++)
25 {
26 dst[i] = src[i];
27 }
28 }
29
30 template<typename T, uint A>
31 inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
32 {
33 for (uint i = 0; i < A; i++)
34 {
35 dst[i] = src[i];
36 }
37 }
38
39 template<typename T, uint A>
40 inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
41 {
42 for (uint i = 0; i < A; i++)
43 {
44 dst[i] = src[i];
45 }
46 }
47
48 template<typename T, uint A>
49 inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
50 {
51 for (uint i = 0; i < A; i++)
52 {
53 dst[i] = src[i];
54 }
55 }
56
57 template<typename T, uint A>
58 inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
59 {
60 for (uint i = 0; i < A; i++)
61 {
62 dst[i] = src[i];
63 }
64 }
65
66 template<typename T, uint A>
67 inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
68 {
69 for (uint i = 0; i < A; i++)
70 {
71 dst[i] = src[i];
72 }
73 }
74
75 template<typename T, uint A>
76 inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A])
77 {
78 for (uint i = 0; i < A; i++)
79 {
80 dst[i] = src[i];
81 }
82 }
83
84 template<typename T, uint A>
85 inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A])
86 {
87 for (uint i = 0; i < A; i++)
88 {
89 dst[i] = src[i];
90 }
91 }
92
93 template<typename T, uint A>
94 inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A])
95 {
96 for (uint i = 0; i < A; i++)
97 {
98 dst[i] = src[i];
99 }
100 }
101
102 template<typename T, uint A>
103 inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A])
104 {
105 for (uint i = 0; i < A; i++)
106 {
107 dst[i] = src[i];
108 }
109 }
110
111 template<typename T, uint A>
112 inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A])
113 {
114 for (uint i = 0; i < A; i++)
115 {
116 dst[i] = src[i];
117 }
118 }
119
120 template<typename T, uint A>
121 inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A])
122 {
123 for (uint i = 0; i < A; i++)
124 {
125 dst[i] = src[i];
126 }
127 }
128
129 static inline __attribute__((always_inline))
130 float4 consume_constant_arrays2(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2)
131 {
132 float4 indexable[4];
133 spvArrayCopyFromStackToStack1(indexable, positions);
134 float4 indexable_1[4];
135 spvArrayCopyFromStackToStack1(indexable_1, positions2);
136 return indexable[Index1] + indexable_1[Index2];
137 }
138
139 static inline __attribute__((always_inline))
140 float4 consume_constant_arrays(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2)
141 {
142 return consume_constant_arrays2(positions, positions2, Index1, Index2);
143 }
144
145 vertex main0_out main0(main0_in in [[stage_in]])
146 {
147 float4 _68_array_copy[4] = { float4(0.0), float4(1.0), float4(2.0), float4(3.0) };
148 main0_out out = {};
149 float4 LUT2[4];
150 LUT2[0] = float4(10.0);
151 LUT2[1] = float4(11.0);
152 LUT2[2] = float4(12.0);
153 LUT2[3] = float4(13.0);
154 out.gl_Position = consume_constant_arrays(_68_array_copy, LUT2, in.Index1, in.Index2);
155 return out;
156 }
157