reach-vb HF staff commited on
Commit
c4764a2
1 Parent(s): a7e4fab

61bbc5823650d91cea505e7f3c8c5fe1eda8c1e0aea2a4aaafeda1ade4b51a6e

Browse files
Files changed (50) hide show
  1. lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSProcessInfo.hpp +354 -0
  2. lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSRange.hpp +83 -0
  3. lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSSet.hpp +87 -0
  4. lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSSharedPtr.hpp +311 -0
  5. lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSString.hpp +255 -0
  6. lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSTypes.hpp +51 -0
  7. lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSURL.hpp +90 -0
  8. lib/python3.11/site-packages/mlx/include/metal_cpp/LICENSE.txt +202 -0
  9. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLAccelerationStructure.hpp +1826 -0
  10. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLAccelerationStructureCommandEncoder.hpp +290 -0
  11. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLAccelerationStructureTypes.hpp +169 -0
  12. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLArgument.hpp +848 -0
  13. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLArgumentEncoder.hpp +244 -0
  14. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBinaryArchive.hpp +139 -0
  15. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBlitCommandEncoder.hpp +246 -0
  16. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBlitPass.hpp +165 -0
  17. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBuffer.hpp +109 -0
  18. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCaptureManager.hpp +220 -0
  19. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCaptureScope.hpp +92 -0
  20. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCommandBuffer.hpp +474 -0
  21. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCommandEncoder.hpp +101 -0
  22. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCommandQueue.hpp +89 -0
  23. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLComputeCommandEncoder.hpp +362 -0
  24. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLComputePass.hpp +181 -0
  25. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLComputePipeline.hpp +373 -0
  26. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCounters.hpp +258 -0
  27. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDefines.hpp +41 -0
  28. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDepthStencil.hpp +269 -0
  29. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDevice.hpp +1426 -0
  30. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDrawable.hpp +99 -0
  31. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDynamicLibrary.hpp +82 -0
  32. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLEvent.hpp +159 -0
  33. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFence.hpp +57 -0
  34. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionConstantValues.hpp +85 -0
  35. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionDescriptor.hpp +157 -0
  36. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionHandle.hpp +61 -0
  37. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionLog.hpp +114 -0
  38. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionStitching.hpp +307 -0
  39. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLHeaderBridge.hpp +0 -0
  40. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLHeap.hpp +329 -0
  41. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIOCommandBuffer.hpp +200 -0
  42. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIOCommandQueue.hpp +225 -0
  43. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIOCompressor.hpp +94 -0
  44. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIndirectCommandBuffer.hpp +240 -0
  45. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIndirectCommandEncoder.hpp +203 -0
  46. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIntersectionFunctionTable.hpp +181 -0
  47. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLLibrary.hpp +691 -0
  48. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLLinkedFunctions.hpp +115 -0
  49. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLParallelRenderCommandEncoder.hpp +94 -0
  50. lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLPipeline.hpp +109 -0
lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSProcessInfo.hpp ADDED
@@ -0,0 +1,354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Foundation/NSProcessInfo.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "NSDefines.hpp"
26
+ #include "NSNotification.hpp"
27
+ #include "NSObject.hpp"
28
+ #include "NSPrivate.hpp"
29
+ #include "NSTypes.hpp"
30
+
31
+ #include <functional>
32
+
33
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
34
+
35
+ namespace NS
36
+ {
37
+ _NS_CONST(NotificationName, ProcessInfoThermalStateDidChangeNotification);
38
+ _NS_CONST(NotificationName, ProcessInfoPowerStateDidChangeNotification);
39
+
40
+ _NS_ENUM(NS::Integer, ProcessInfoThermalState) {
41
+ ProcessInfoThermalStateNominal = 0,
42
+ ProcessInfoThermalStateFair = 1,
43
+ ProcessInfoThermalStateSerious = 2,
44
+ ProcessInfoThermalStateCritical = 3
45
+ };
46
+
47
+ _NS_OPTIONS(std::uint64_t, ActivityOptions) {
48
+ ActivityIdleDisplaySleepDisabled = (1ULL << 40),
49
+ ActivityIdleSystemSleepDisabled = (1ULL << 20),
50
+ ActivitySuddenTerminationDisabled = (1ULL << 14),
51
+ ActivityAutomaticTerminationDisabled = (1ULL << 15),
52
+ ActivityUserInitiated = (0x00FFFFFFULL | ActivityIdleSystemSleepDisabled),
53
+ ActivityUserInitiatedAllowingIdleSystemSleep = (ActivityUserInitiated & ~ActivityIdleSystemSleepDisabled),
54
+ ActivityBackground = 0x000000FFULL,
55
+ ActivityLatencyCritical = 0xFF00000000ULL,
56
+ };
57
+
58
+ class ProcessInfo : public Referencing<ProcessInfo>
59
+ {
60
+ public:
61
+ static ProcessInfo* processInfo();
62
+
63
+ class Array* arguments() const;
64
+ class Dictionary* environment() const;
65
+ class String* hostName() const;
66
+ class String* processName() const;
67
+ void setProcessName(const String* pString);
68
+ int processIdentifier() const;
69
+ class String* globallyUniqueString() const;
70
+
71
+ class String* userName() const;
72
+ class String* fullUserName() const;
73
+
74
+ UInteger operatingSystem() const;
75
+ OperatingSystemVersion operatingSystemVersion() const;
76
+ class String* operatingSystemVersionString() const;
77
+ bool isOperatingSystemAtLeastVersion(OperatingSystemVersion version) const;
78
+
79
+ UInteger processorCount() const;
80
+ UInteger activeProcessorCount() const;
81
+ unsigned long long physicalMemory() const;
82
+ TimeInterval systemUptime() const;
83
+
84
+ void disableSuddenTermination();
85
+ void enableSuddenTermination();
86
+
87
+ void disableAutomaticTermination(const class String* pReason);
88
+ void enableAutomaticTermination(const class String* pReason);
89
+ bool automaticTerminationSupportEnabled() const;
90
+ void setAutomaticTerminationSupportEnabled(bool enabled);
91
+
92
+ class Object* beginActivity(ActivityOptions options, const class String* pReason);
93
+ void endActivity(class Object* pActivity);
94
+ void performActivity(ActivityOptions options, const class String* pReason, void (^block)(void));
95
+ void performActivity(ActivityOptions options, const class String* pReason, const std::function<void()>& func);
96
+ void performExpiringActivity(const class String* pReason, void (^block)(bool expired));
97
+ void performExpiringActivity(const class String* pReason, const std::function<void(bool expired)>& func);
98
+
99
+ ProcessInfoThermalState thermalState() const;
100
+ bool isLowPowerModeEnabled() const;
101
+
102
+ bool isiOSAppOnMac() const;
103
+ bool isMacCatalystApp() const;
104
+ };
105
+ }
106
+
107
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
108
+
109
+ _NS_PRIVATE_DEF_CONST(NS::NotificationName, ProcessInfoThermalStateDidChangeNotification);
110
+ _NS_PRIVATE_DEF_CONST(NS::NotificationName, ProcessInfoPowerStateDidChangeNotification);
111
+
112
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
113
+
114
+ _NS_INLINE NS::ProcessInfo* NS::ProcessInfo::processInfo()
115
+ {
116
+ return Object::sendMessage<ProcessInfo*>(_NS_PRIVATE_CLS(NSProcessInfo), _NS_PRIVATE_SEL(processInfo));
117
+ }
118
+
119
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
120
+
121
+ _NS_INLINE NS::Array* NS::ProcessInfo::arguments() const
122
+ {
123
+ return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(arguments));
124
+ }
125
+
126
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
127
+
128
+ _NS_INLINE NS::Dictionary* NS::ProcessInfo::environment() const
129
+ {
130
+ return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(environment));
131
+ }
132
+
133
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
134
+
135
+ _NS_INLINE NS::String* NS::ProcessInfo::hostName() const
136
+ {
137
+ return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(hostName));
138
+ }
139
+
140
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
141
+
142
+ _NS_INLINE NS::String* NS::ProcessInfo::processName() const
143
+ {
144
+ return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(processName));
145
+ }
146
+
147
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
148
+
149
+ _NS_INLINE void NS::ProcessInfo::setProcessName(const String* pString)
150
+ {
151
+ Object::sendMessage<void>(this, _NS_PRIVATE_SEL(setProcessName_), pString);
152
+ }
153
+
154
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
155
+
156
+ _NS_INLINE int NS::ProcessInfo::processIdentifier() const
157
+ {
158
+ return Object::sendMessage<int>(this, _NS_PRIVATE_SEL(processIdentifier));
159
+ }
160
+
161
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
162
+
163
+ _NS_INLINE NS::String* NS::ProcessInfo::globallyUniqueString() const
164
+ {
165
+ return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(globallyUniqueString));
166
+ }
167
+
168
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
169
+
170
+ _NS_INLINE NS::String* NS::ProcessInfo::userName() const
171
+ {
172
+ return Object::sendMessageSafe<String*>(this, _NS_PRIVATE_SEL(userName));
173
+ }
174
+
175
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
176
+
177
+ _NS_INLINE NS::String* NS::ProcessInfo::fullUserName() const
178
+ {
179
+ return Object::sendMessageSafe<String*>(this, _NS_PRIVATE_SEL(fullUserName));
180
+ }
181
+
182
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
183
+
184
+ _NS_INLINE NS::UInteger NS::ProcessInfo::operatingSystem() const
185
+ {
186
+ return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(operatingSystem));
187
+ }
188
+
189
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
190
+
191
+ _NS_INLINE NS::OperatingSystemVersion NS::ProcessInfo::operatingSystemVersion() const
192
+ {
193
+ return Object::sendMessage<OperatingSystemVersion>(this, _NS_PRIVATE_SEL(operatingSystemVersion));
194
+ }
195
+
196
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
197
+
198
+ _NS_INLINE NS::String* NS::ProcessInfo::operatingSystemVersionString() const
199
+ {
200
+ return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(operatingSystemVersionString));
201
+ }
202
+
203
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
204
+
205
+ _NS_INLINE bool NS::ProcessInfo::isOperatingSystemAtLeastVersion(OperatingSystemVersion version) const
206
+ {
207
+ return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isOperatingSystemAtLeastVersion_), version);
208
+ }
209
+
210
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
211
+
212
+ _NS_INLINE NS::UInteger NS::ProcessInfo::processorCount() const
213
+ {
214
+ return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(processorCount));
215
+ }
216
+
217
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
218
+
219
+ _NS_INLINE NS::UInteger NS::ProcessInfo::activeProcessorCount() const
220
+ {
221
+ return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(activeProcessorCount));
222
+ }
223
+
224
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
225
+
226
+ _NS_INLINE unsigned long long NS::ProcessInfo::physicalMemory() const
227
+ {
228
+ return Object::sendMessage<unsigned long long>(this, _NS_PRIVATE_SEL(physicalMemory));
229
+ }
230
+
231
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
232
+
233
+ _NS_INLINE NS::TimeInterval NS::ProcessInfo::systemUptime() const
234
+ {
235
+ return Object::sendMessage<TimeInterval>(this, _NS_PRIVATE_SEL(systemUptime));
236
+ }
237
+
238
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
239
+
240
+ _NS_INLINE void NS::ProcessInfo::disableSuddenTermination()
241
+ {
242
+ Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(disableSuddenTermination));
243
+ }
244
+
245
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
246
+
247
+ _NS_INLINE void NS::ProcessInfo::enableSuddenTermination()
248
+ {
249
+ Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(enableSuddenTermination));
250
+ }
251
+
252
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
253
+
254
+ _NS_INLINE void NS::ProcessInfo::disableAutomaticTermination(const String* pReason)
255
+ {
256
+ Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(disableAutomaticTermination_), pReason);
257
+ }
258
+
259
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
260
+
261
+ _NS_INLINE void NS::ProcessInfo::enableAutomaticTermination(const String* pReason)
262
+ {
263
+ Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(enableAutomaticTermination_), pReason);
264
+ }
265
+
266
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
267
+
268
+ _NS_INLINE bool NS::ProcessInfo::automaticTerminationSupportEnabled() const
269
+ {
270
+ return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(automaticTerminationSupportEnabled));
271
+ }
272
+
273
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
274
+
275
+ _NS_INLINE void NS::ProcessInfo::setAutomaticTerminationSupportEnabled(bool enabled)
276
+ {
277
+ Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(setAutomaticTerminationSupportEnabled_), enabled);
278
+ }
279
+
280
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
281
+
282
+ _NS_INLINE NS::Object* NS::ProcessInfo::beginActivity(ActivityOptions options, const String* pReason)
283
+ {
284
+ return Object::sendMessage<Object*>(this, _NS_PRIVATE_SEL(beginActivityWithOptions_reason_), options, pReason);
285
+ }
286
+
287
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
288
+
289
+ _NS_INLINE void NS::ProcessInfo::endActivity(Object* pActivity)
290
+ {
291
+ Object::sendMessage<void>(this, _NS_PRIVATE_SEL(endActivity_), pActivity);
292
+ }
293
+
294
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
295
+
296
+ _NS_INLINE void NS::ProcessInfo::performActivity(ActivityOptions options, const String* pReason, void (^block)(void))
297
+ {
298
+ Object::sendMessage<void>(this, _NS_PRIVATE_SEL(performActivityWithOptions_reason_usingBlock_), options, pReason, block);
299
+ }
300
+
301
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
302
+
303
+ _NS_INLINE void NS::ProcessInfo::performActivity(ActivityOptions options, const String* pReason, const std::function<void()>& function)
304
+ {
305
+ __block std::function<void()> blockFunction = function;
306
+
307
+ performActivity(options, pReason, ^() { blockFunction(); });
308
+ }
309
+
310
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
311
+
312
+ _NS_INLINE void NS::ProcessInfo::performExpiringActivity(const String* pReason, void (^block)(bool expired))
313
+ {
314
+ Object::sendMessageSafe<void>(this, _NS_PRIVATE_SEL(performExpiringActivityWithReason_usingBlock_), pReason, block);
315
+ }
316
+
317
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
318
+
319
+ _NS_INLINE void NS::ProcessInfo::performExpiringActivity(const String* pReason, const std::function<void(bool expired)>& function)
320
+ {
321
+ __block std::function<void(bool expired)> blockFunction = function;
322
+
323
+ performExpiringActivity(pReason, ^(bool expired) { blockFunction(expired); });
324
+ }
325
+
326
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
327
+
328
+ _NS_INLINE NS::ProcessInfoThermalState NS::ProcessInfo::thermalState() const
329
+ {
330
+ return Object::sendMessage<ProcessInfoThermalState>(this, _NS_PRIVATE_SEL(thermalState));
331
+ }
332
+
333
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
334
+
335
+ _NS_INLINE bool NS::ProcessInfo::isLowPowerModeEnabled() const
336
+ {
337
+ return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(isLowPowerModeEnabled));
338
+ }
339
+
340
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
341
+
342
+ _NS_INLINE bool NS::ProcessInfo::isiOSAppOnMac() const
343
+ {
344
+ return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(isiOSAppOnMac));
345
+ }
346
+
347
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
348
+
349
+ _NS_INLINE bool NS::ProcessInfo::isMacCatalystApp() const
350
+ {
351
+ return Object::sendMessageSafe<bool>(this, _NS_PRIVATE_SEL(isMacCatalystApp));
352
+ }
353
+
354
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSRange.hpp ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Foundation/NSRange.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "NSDefines.hpp"
26
+ #include "NSTypes.hpp"
27
+
28
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
29
+
30
+ namespace NS
31
+ {
32
+ struct Range
33
+ {
34
+ static Range Make(UInteger loc, UInteger len);
35
+
36
+ Range(UInteger loc, UInteger len);
37
+
38
+ bool Equal(const Range& range) const;
39
+ bool LocationInRange(UInteger loc) const;
40
+ UInteger Max() const;
41
+
42
+ UInteger location;
43
+ UInteger length;
44
+ } _NS_PACKED;
45
+ }
46
+
47
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
48
+
49
+ _NS_INLINE NS::Range::Range(UInteger loc, UInteger len)
50
+ : location(loc)
51
+ , length(len)
52
+ {
53
+ }
54
+
55
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
56
+
57
+ _NS_INLINE NS::Range NS::Range::Make(UInteger loc, UInteger len)
58
+ {
59
+ return Range(loc, len);
60
+ }
61
+
62
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
63
+
64
+ _NS_INLINE bool NS::Range::Equal(const Range& range) const
65
+ {
66
+ return (location == range.location) && (length == range.length);
67
+ }
68
+
69
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
70
+
71
+ _NS_INLINE bool NS::Range::LocationInRange(UInteger loc) const
72
+ {
73
+ return (!(loc < location)) && ((loc - location) < length);
74
+ }
75
+
76
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
77
+
78
+ _NS_INLINE NS::UInteger NS::Range::Max() const
79
+ {
80
+ return location + length;
81
+ }
82
+
83
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSSet.hpp ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Foundation/NSSet.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "NSObject.hpp"
26
+ #include "NSEnumerator.hpp"
27
+
28
+ /*****Immutable Set*******/
29
+
30
+ namespace NS
31
+ {
32
+ class Set : public NS::Copying <Set>
33
+ {
34
+ public:
35
+ UInteger count() const;
36
+ Enumerator<Object>* objectEnumerator() const;
37
+
38
+ static Set* alloc();
39
+
40
+ Set* init();
41
+ Set* init(const Object* const* pObjects, UInteger count);
42
+ Set* init(const class Coder* pCoder);
43
+
44
+ };
45
+ }
46
+
47
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
48
+
49
+ _NS_INLINE NS::UInteger NS::Set::count() const
50
+ {
51
+ return NS::Object::sendMessage<NS::UInteger>(this, _NS_PRIVATE_SEL(count));
52
+ }
53
+
54
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
55
+
56
+ _NS_INLINE NS::Enumerator<NS::Object>* NS::Set::objectEnumerator() const
57
+ {
58
+ return NS::Object::sendMessage<Enumerator<NS::Object>*>(this, _NS_PRIVATE_SEL(objectEnumerator));
59
+ }
60
+
61
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
62
+
63
+ _NS_INLINE NS::Set* NS::Set::alloc()
64
+ {
65
+ return NS::Object::alloc<Set>(_NS_PRIVATE_CLS(NSSet));
66
+ }
67
+
68
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
69
+
70
+ _NS_INLINE NS::Set* NS::Set::init()
71
+ {
72
+ return NS::Object::init<Set>();
73
+ }
74
+
75
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
76
+
77
+ _NS_INLINE NS::Set* NS::Set::init(const Object* const* pObjects, NS::UInteger count)
78
+ {
79
+ return NS::Object::sendMessage<Set*>(this, _NS_PRIVATE_SEL(initWithObjects_count_), pObjects, count);
80
+ }
81
+
82
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
83
+
84
+ _NS_INLINE NS::Set* NS::Set::init(const class Coder* pCoder)
85
+ {
86
+ return Object::sendMessage<Set*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);
87
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSSharedPtr.hpp ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Foundation/NSSharedPtr.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "NSDefines.hpp"
24
+
25
+ namespace NS
26
+ {
27
+ template <class _Class>
28
+ class SharedPtr
29
+ {
30
+ public:
31
+ /**
32
+ * Create a new null pointer.
33
+ */
34
+ SharedPtr();
35
+
36
+ /**
37
+ * Destroy this SharedPtr, decreasing the reference count.
38
+ */
39
+ ~SharedPtr();
40
+
41
+ /**
42
+ * SharedPtr copy constructor.
43
+ */
44
+ SharedPtr(const SharedPtr<_Class>& other) noexcept;
45
+
46
+ /**
47
+ * Construction from another pointee type.
48
+ */
49
+ template <class _OtherClass>
50
+ SharedPtr(const SharedPtr<_OtherClass>& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> * = nullptr) noexcept;
51
+
52
+ /**
53
+ * SharedPtr move constructor.
54
+ */
55
+ SharedPtr(SharedPtr<_Class>&& other) noexcept;
56
+
57
+ /**
58
+ * Move from another pointee type.
59
+ */
60
+ template <class _OtherClass>
61
+ SharedPtr(SharedPtr<_OtherClass>&& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> * = nullptr) noexcept;
62
+
63
+ /**
64
+ * Copy assignment operator.
65
+ * Copying increases reference count. Only releases previous pointee if objects are different.
66
+ */
67
+ SharedPtr& operator=(const SharedPtr<_Class>& other);
68
+
69
+ /**
70
+ * Copy-assignment from different pointee.
71
+ * Copying increases reference count. Only releases previous pointee if objects are different.
72
+ */
73
+ template <class _OtherClass>
74
+ typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, SharedPtr &>
75
+ operator=(const SharedPtr<_OtherClass>& other);
76
+
77
+ /**
78
+ * Move assignment operator.
79
+ * Move without affecting reference counts, unless pointees are equal. Moved-from object is reset to nullptr.
80
+ */
81
+ SharedPtr& operator=(SharedPtr<_Class>&& other);
82
+
83
+ /**
84
+ * Move-asignment from different pointee.
85
+ * Move without affecting reference counts, unless pointees are equal. Moved-from object is reset to nullptr.
86
+ */
87
+ template <class _OtherClass>
88
+ typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, SharedPtr &>
89
+ operator=(SharedPtr<_OtherClass>&& other);
90
+
91
+ /**
92
+ * Access raw pointee.
93
+ * @warning Avoid wrapping the returned value again, as it may lead double frees unless this object becomes detached.
94
+ */
95
+ _Class* get() const;
96
+
97
+ /**
98
+ * Call operations directly on the pointee.
99
+ */
100
+ _Class* operator->() const;
101
+
102
+ /**
103
+ * Implicit cast to bool.
104
+ */
105
+ explicit operator bool() const;
106
+
107
+ /**
108
+ * Reset this SharedPtr to null, decreasing the reference count.
109
+ */
110
+ void reset();
111
+
112
+ /**
113
+ * Detach the SharedPtr from the pointee, without decreasing the reference count.
114
+ */
115
+ void detach();
116
+
117
+ template <class _OtherClass>
118
+ friend SharedPtr<_OtherClass> RetainPtr(_OtherClass* ptr);
119
+
120
+ template <class _OtherClass>
121
+ friend SharedPtr<_OtherClass> TransferPtr(_OtherClass* ptr);
122
+
123
+ private:
124
+ _Class* m_pObject;
125
+ };
126
+
127
+ /**
128
+ * Create a SharedPtr by retaining an existing raw pointer.
129
+ * Increases the reference count of the passed-in object.
130
+ * If the passed-in object was in an AutoreleasePool, it will be removed from it.
131
+ */
132
+ template <class _Class>
133
+ _NS_INLINE NS::SharedPtr<_Class> RetainPtr(_Class* pObject)
134
+ {
135
+ NS::SharedPtr<_Class> ret;
136
+ ret.m_pObject = pObject->retain();
137
+ return ret;
138
+ }
139
+
140
+ /*
141
+ * Create a SharedPtr by transfering the ownership of an existing raw pointer to SharedPtr.
142
+ * Does not increase the reference count of the passed-in pointer, it is assumed to be >= 1.
143
+ * This method does not remove objects from an AutoreleasePool.
144
+ */
145
+ template <class _Class>
146
+ _NS_INLINE NS::SharedPtr<_Class> TransferPtr(_Class* pObject)
147
+ {
148
+ NS::SharedPtr<_Class> ret;
149
+ ret.m_pObject = pObject;
150
+ return ret;
151
+ }
152
+
153
+ }
154
+
155
+ template <class _Class>
156
+ _NS_INLINE NS::SharedPtr<_Class>::SharedPtr()
157
+ : m_pObject(nullptr)
158
+ {
159
+ }
160
+
161
+ template <class _Class>
162
+ _NS_INLINE NS::SharedPtr<_Class>::~SharedPtr()
163
+ {
164
+ if (m_pObject)
165
+ {
166
+ m_pObject->release();
167
+ }
168
+ }
169
+
170
+ template <class _Class>
171
+ _NS_INLINE NS::SharedPtr<_Class>::SharedPtr(const NS::SharedPtr<_Class>& other) noexcept
172
+ : m_pObject(other.m_pObject->retain())
173
+ {
174
+ }
175
+
176
+ template <class _Class>
177
+ template <class _OtherClass>
178
+ _NS_INLINE NS::SharedPtr<_Class>::SharedPtr(const NS::SharedPtr<_OtherClass>& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> *) noexcept
179
+ : m_pObject(reinterpret_cast<_Class*>(other.get()->retain()))
180
+ {
181
+ }
182
+
183
+ template <class _Class>
184
+ _NS_INLINE NS::SharedPtr<_Class>::SharedPtr(NS::SharedPtr<_Class>&& other) noexcept
185
+ : m_pObject(other.m_pObject)
186
+ {
187
+ other.m_pObject = nullptr;
188
+ }
189
+
190
+ template <class _Class>
191
+ template <class _OtherClass>
192
+ _NS_INLINE NS::SharedPtr<_Class>::SharedPtr(NS::SharedPtr<_OtherClass>&& other, typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>> *) noexcept
193
+ : m_pObject(reinterpret_cast<_Class*>(other.get()))
194
+ {
195
+ other.detach();
196
+ }
197
+
198
+ template <class _Class>
199
+ _NS_INLINE _Class* NS::SharedPtr<_Class>::get() const
200
+ {
201
+ return m_pObject;
202
+ }
203
+
204
+ template <class _Class>
205
+ _NS_INLINE _Class* NS::SharedPtr<_Class>::operator->() const
206
+ {
207
+ return m_pObject;
208
+ }
209
+
210
+ template <class _Class>
211
+ _NS_INLINE NS::SharedPtr<_Class>::operator bool() const
212
+ {
213
+ return nullptr != m_pObject;
214
+ }
215
+
216
+ template <class _Class>
217
+ _NS_INLINE void NS::SharedPtr<_Class>::reset()
218
+ {
219
+ m_pObject->release();
220
+ m_pObject = nullptr;
221
+ }
222
+
223
+ template <class _Class>
224
+ _NS_INLINE void NS::SharedPtr<_Class>::detach()
225
+ {
226
+ m_pObject = nullptr;
227
+ }
228
+
229
+ template <class _Class>
230
+ _NS_INLINE NS::SharedPtr<_Class>& NS::SharedPtr<_Class>::operator=(const SharedPtr<_Class>& other)
231
+ {
232
+ if (m_pObject != other.m_pObject)
233
+ {
234
+ if (m_pObject)
235
+ {
236
+ m_pObject->release();
237
+ }
238
+ m_pObject = other.m_pObject->retain();
239
+ }
240
+ return *this;
241
+ }
242
+
243
+ template <class _Class>
244
+ template <class _OtherClass>
245
+ typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, NS::SharedPtr<_Class> &>
246
+ _NS_INLINE NS::SharedPtr<_Class>::operator=(const SharedPtr<_OtherClass>& other)
247
+ {
248
+ if (m_pObject != other.get())
249
+ {
250
+ if (m_pObject)
251
+ {
252
+ m_pObject->release();
253
+ }
254
+ m_pObject = reinterpret_cast<_Class*>(other.get()->retain());
255
+ }
256
+ return *this;
257
+ }
258
+
259
+ template <class _Class>
260
+ _NS_INLINE NS::SharedPtr<_Class>& NS::SharedPtr<_Class>::operator=(SharedPtr<_Class>&& other)
261
+ {
262
+ if (m_pObject != other.m_pObject)
263
+ {
264
+ if (m_pObject)
265
+ {
266
+ m_pObject->release();
267
+ }
268
+ m_pObject = other.m_pObject;
269
+ }
270
+ else
271
+ {
272
+ m_pObject = other.m_pObject;
273
+ other.m_pObject->release();
274
+ }
275
+ other.m_pObject = nullptr;
276
+ return *this;
277
+ }
278
+
279
+ template <class _Class>
280
+ template <class _OtherClass>
281
+ typename std::enable_if_t<std::is_convertible_v<_OtherClass *, _Class *>, NS::SharedPtr<_Class> &>
282
+ _NS_INLINE NS::SharedPtr<_Class>::operator=(SharedPtr<_OtherClass>&& other)
283
+ {
284
+ if (m_pObject != other.get())
285
+ {
286
+ if (m_pObject)
287
+ {
288
+ m_pObject->release();
289
+ }
290
+ m_pObject = reinterpret_cast<_Class*>(other.get());
291
+ other.detach();
292
+ }
293
+ else
294
+ {
295
+ m_pObject = other.get();
296
+ other.reset();
297
+ }
298
+ return *this;
299
+ }
300
+
301
+ template <class _ClassLhs, class _ClassRhs>
302
+ _NS_INLINE bool operator==(const NS::SharedPtr<_ClassLhs>& lhs, const NS::SharedPtr<_ClassRhs>& rhs)
303
+ {
304
+ return lhs.get() == rhs.get();
305
+ }
306
+
307
+ template <class _ClassLhs, class _ClassRhs>
308
+ _NS_INLINE bool operator!=(const NS::SharedPtr<_ClassLhs>& lhs, const NS::SharedPtr<_ClassRhs>& rhs)
309
+ {
310
+ return lhs.get() != rhs.get();
311
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSString.hpp ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Foundation/NSString.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "NSDefines.hpp"
26
+ #include "NSObjCRuntime.hpp"
27
+ #include "NSObject.hpp"
28
+ #include "NSPrivate.hpp"
29
+ #include "NSRange.hpp"
30
+ #include "NSTypes.hpp"
31
+
32
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
33
+
34
+ namespace NS
35
+ {
36
+ _NS_ENUM(NS::UInteger, StringEncoding) {
37
+ ASCIIStringEncoding = 1,
38
+ NEXTSTEPStringEncoding = 2,
39
+ JapaneseEUCStringEncoding = 3,
40
+ UTF8StringEncoding = 4,
41
+ ISOLatin1StringEncoding = 5,
42
+ SymbolStringEncoding = 6,
43
+ NonLossyASCIIStringEncoding = 7,
44
+ ShiftJISStringEncoding = 8,
45
+ ISOLatin2StringEncoding = 9,
46
+ UnicodeStringEncoding = 10,
47
+ WindowsCP1251StringEncoding = 11,
48
+ WindowsCP1252StringEncoding = 12,
49
+ WindowsCP1253StringEncoding = 13,
50
+ WindowsCP1254StringEncoding = 14,
51
+ WindowsCP1250StringEncoding = 15,
52
+ ISO2022JPStringEncoding = 21,
53
+ MacOSRomanStringEncoding = 30,
54
+
55
+ UTF16StringEncoding = UnicodeStringEncoding,
56
+
57
+ UTF16BigEndianStringEncoding = 0x90000100,
58
+ UTF16LittleEndianStringEncoding = 0x94000100,
59
+
60
+ UTF32StringEncoding = 0x8c000100,
61
+ UTF32BigEndianStringEncoding = 0x98000100,
62
+ UTF32LittleEndianStringEncoding = 0x9c000100
63
+ };
64
+
65
+ _NS_OPTIONS(NS::UInteger, StringCompareOptions) {
66
+ CaseInsensitiveSearch = 1,
67
+ LiteralSearch = 2,
68
+ BackwardsSearch = 4,
69
+ AnchoredSearch = 8,
70
+ NumericSearch = 64,
71
+ DiacriticInsensitiveSearch = 128,
72
+ WidthInsensitiveSearch = 256,
73
+ ForcedOrderingSearch = 512,
74
+ RegularExpressionSearch = 1024
75
+ };
76
+
77
+ using unichar = unsigned short;
78
+
79
+ class String : public Copying<String>
80
+ {
81
+ public:
82
+ static String* string();
83
+ static String* string(const String* pString);
84
+ static String* string(const char* pString, StringEncoding encoding);
85
+
86
+ static String* alloc();
87
+ String* init();
88
+ String* init(const String* pString);
89
+ String* init(const char* pString, StringEncoding encoding);
90
+ String* init(void* pBytes, UInteger len, StringEncoding encoding, bool freeBuffer);
91
+
92
+ unichar character(UInteger index) const;
93
+ UInteger length() const;
94
+
95
+ const char* cString(StringEncoding encoding) const;
96
+ const char* utf8String() const;
97
+ UInteger maximumLengthOfBytes(StringEncoding encoding) const;
98
+ UInteger lengthOfBytes(StringEncoding encoding) const;
99
+
100
+ bool isEqualToString(const String* pString) const;
101
+ Range rangeOfString(const String* pString, StringCompareOptions options) const;
102
+
103
+ const char* fileSystemRepresentation() const;
104
+
105
+ String* stringByAppendingString(const String* pString) const;
106
+ ComparisonResult caseInsensitiveCompare(const String* pString) const;
107
+ };
108
+
109
+ /// Create an NS::String* from a string literal.
110
+ #define MTLSTR(literal) (NS::String*)__builtin___CFStringMakeConstantString("" literal "")
111
+
112
+ template <std::size_t _StringLen>
113
+ [[deprecated("please use MTLSTR(str)")]] constexpr const String* MakeConstantString(const char (&str)[_StringLen])
114
+ {
115
+ return reinterpret_cast<const String*>(__CFStringMakeConstantString(str));
116
+ }
117
+
118
+ }
119
+
120
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
121
+
122
+ _NS_INLINE NS::String* NS::String::string()
123
+ {
124
+ return Object::sendMessage<String*>(_NS_PRIVATE_CLS(NSString), _NS_PRIVATE_SEL(string));
125
+ }
126
+
127
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
128
+
129
+ _NS_INLINE NS::String* NS::String::string(const String* pString)
130
+ {
131
+ return Object::sendMessage<String*>(_NS_PRIVATE_CLS(NSString), _NS_PRIVATE_SEL(stringWithString_), pString);
132
+ }
133
+
134
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
135
+
136
+ _NS_INLINE NS::String* NS::String::string(const char* pString, StringEncoding encoding)
137
+ {
138
+ return Object::sendMessage<String*>(_NS_PRIVATE_CLS(NSString), _NS_PRIVATE_SEL(stringWithCString_encoding_), pString, encoding);
139
+ }
140
+
141
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
142
+
143
+ _NS_INLINE NS::String* NS::String::alloc()
144
+ {
145
+ return Object::alloc<String>(_NS_PRIVATE_CLS(NSString));
146
+ }
147
+
148
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
149
+
150
+ _NS_INLINE NS::String* NS::String::init()
151
+ {
152
+ return Object::init<String>();
153
+ }
154
+
155
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
156
+
157
+ _NS_INLINE NS::String* NS::String::init(const String* pString)
158
+ {
159
+ return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(initWithString_), pString);
160
+ }
161
+
162
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
163
+
164
+ _NS_INLINE NS::String* NS::String::init(const char* pString, StringEncoding encoding)
165
+ {
166
+ return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(initWithCString_encoding_), pString, encoding);
167
+ }
168
+
169
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
170
+
171
+ _NS_INLINE NS::String* NS::String::init(void* pBytes, UInteger len, StringEncoding encoding, bool freeBuffer)
172
+ {
173
+ return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(initWithBytesNoCopy_length_encoding_freeWhenDone_), pBytes, len, encoding, freeBuffer);
174
+ }
175
+
176
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
177
+
178
+ _NS_INLINE NS::unichar NS::String::character(UInteger index) const
179
+ {
180
+ return Object::sendMessage<unichar>(this, _NS_PRIVATE_SEL(characterAtIndex_), index);
181
+ }
182
+
183
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
184
+
185
+ _NS_INLINE NS::UInteger NS::String::length() const
186
+ {
187
+ return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(length));
188
+ }
189
+
190
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
191
+
192
+ _NS_INLINE const char* NS::String::cString(StringEncoding encoding) const
193
+ {
194
+ return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(cStringUsingEncoding_), encoding);
195
+ }
196
+
197
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
198
+
199
+ _NS_INLINE const char* NS::String::utf8String() const
200
+ {
201
+ return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(UTF8String));
202
+ }
203
+
204
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
205
+
206
+ _NS_INLINE NS::UInteger NS::String::maximumLengthOfBytes(StringEncoding encoding) const
207
+ {
208
+ return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(maximumLengthOfBytesUsingEncoding_), encoding);
209
+ }
210
+
211
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
212
+
213
+ _NS_INLINE NS::UInteger NS::String::lengthOfBytes(StringEncoding encoding) const
214
+ {
215
+ return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(lengthOfBytesUsingEncoding_), encoding);
216
+ }
217
+
218
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
219
+
220
+ _NS_INLINE bool NS::String::isEqualToString(const NS::String* pString) const
221
+ {
222
+ return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isEqualToString_), pString);
223
+ }
224
+
225
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
226
+
227
+ _NS_INLINE NS::Range NS::String::rangeOfString(const NS::String* pString, NS::StringCompareOptions options) const
228
+ {
229
+ return Object::sendMessage<Range>(this, _NS_PRIVATE_SEL(rangeOfString_options_), pString, options);
230
+ }
231
+
232
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
233
+
234
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
235
+
236
+ _NS_INLINE const char* NS::String::fileSystemRepresentation() const
237
+ {
238
+ return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(fileSystemRepresentation));
239
+ }
240
+
241
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
242
+
243
+ _NS_INLINE NS::String* NS::String::stringByAppendingString(const String* pString) const
244
+ {
245
+ return Object::sendMessage<NS::String*>(this, _NS_PRIVATE_SEL(stringByAppendingString_), pString);
246
+ }
247
+
248
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
249
+
250
+ _NS_INLINE NS::ComparisonResult NS::String::caseInsensitiveCompare(const String* pString) const
251
+ {
252
+ return Object::sendMessage<NS::ComparisonResult>(this, _NS_PRIVATE_SEL(caseInsensitiveCompare_), pString);
253
+ }
254
+
255
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSTypes.hpp ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Foundation/NSTypes.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "NSDefines.hpp"
26
+
27
+ #include <CoreFoundation/CoreFoundation.h>
28
+ #include <cstdint>
29
+
30
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
31
+
32
+ namespace NS
33
+ {
34
+ using TimeInterval = double;
35
+
36
+ using Integer = std::intptr_t;
37
+ using UInteger = std::uintptr_t;
38
+
39
+ const Integer IntegerMax = INTPTR_MAX;
40
+ const Integer IntegerMin = INTPTR_MIN;
41
+ const UInteger UIntegerMax = UINTPTR_MAX;
42
+
43
+ struct OperatingSystemVersion
44
+ {
45
+ Integer majorVersion;
46
+ Integer minorVersion;
47
+ Integer patchVersion;
48
+ } _NS_PACKED;
49
+ }
50
+
51
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/Foundation/NSURL.hpp ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Foundation/NSURL.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "NSDefines.hpp"
26
+ #include "NSObject.hpp"
27
+ #include "NSPrivate.hpp"
28
+ #include "NSTypes.hpp"
29
+
30
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
31
+
32
+ namespace NS
33
+ {
34
+ class URL : public Copying<URL>
35
+ {
36
+ public:
37
+ static URL* fileURLWithPath(const class String* pPath);
38
+
39
+ static URL* alloc();
40
+ URL* init();
41
+ URL* init(const class String* pString);
42
+ URL* initFileURLWithPath(const class String* pPath);
43
+
44
+ const char* fileSystemRepresentation() const;
45
+ };
46
+ }
47
+
48
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
49
+
50
+ _NS_INLINE NS::URL* NS::URL::fileURLWithPath(const String* pPath)
51
+ {
52
+ return Object::sendMessage<URL*>(_NS_PRIVATE_CLS(NSURL), _NS_PRIVATE_SEL(fileURLWithPath_), pPath);
53
+ }
54
+
55
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
56
+
57
+ _NS_INLINE NS::URL* NS::URL::alloc()
58
+ {
59
+ return Object::alloc<URL>(_NS_PRIVATE_CLS(NSURL));
60
+ }
61
+
62
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
63
+
64
+ _NS_INLINE NS::URL* NS::URL::init()
65
+ {
66
+ return Object::init<URL>();
67
+ }
68
+
69
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
70
+
71
+ _NS_INLINE NS::URL* NS::URL::init(const String* pString)
72
+ {
73
+ return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(initWithString_), pString);
74
+ }
75
+
76
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
77
+
78
+ _NS_INLINE NS::URL* NS::URL::initFileURLWithPath(const String* pPath)
79
+ {
80
+ return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(initFileURLWithPath_), pPath);
81
+ }
82
+
83
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
84
+
85
+ _NS_INLINE const char* NS::URL::fileSystemRepresentation() const
86
+ {
87
+ return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(fileSystemRepresentation));
88
+ }
89
+
90
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/LICENSE.txt ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright © 2023 Apple Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLAccelerationStructure.hpp ADDED
@@ -0,0 +1,1826 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLAccelerationStructure.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLAccelerationStructure.hpp"
30
+ #include "MTLAccelerationStructureTypes.hpp"
31
+ #include "MTLResource.hpp"
32
+ #include "MTLStageInputOutputDescriptor.hpp"
33
+ #include "MTLTypes.hpp"
34
+
35
+ namespace MTL
36
+ {
37
+ _MTL_OPTIONS(NS::UInteger, AccelerationStructureUsage) {
38
+ AccelerationStructureUsageNone = 0,
39
+ AccelerationStructureUsageRefit = 1,
40
+ AccelerationStructureUsagePreferFastBuild = 2,
41
+ AccelerationStructureUsageExtendedLimits = 4,
42
+ };
43
+
44
+ _MTL_OPTIONS(uint32_t, AccelerationStructureInstanceOptions) {
45
+ AccelerationStructureInstanceOptionNone = 0,
46
+ AccelerationStructureInstanceOptionDisableTriangleCulling = 1,
47
+ AccelerationStructureInstanceOptionTriangleFrontFacingWindingCounterClockwise = 2,
48
+ AccelerationStructureInstanceOptionOpaque = 4,
49
+ AccelerationStructureInstanceOptionNonOpaque = 8,
50
+ };
51
+
52
+ class AccelerationStructureDescriptor : public NS::Copying<AccelerationStructureDescriptor>
53
+ {
54
+ public:
55
+ static class AccelerationStructureDescriptor* alloc();
56
+
57
+ class AccelerationStructureDescriptor* init();
58
+
59
+ MTL::AccelerationStructureUsage usage() const;
60
+ void setUsage(MTL::AccelerationStructureUsage usage);
61
+ };
62
+
63
+ class AccelerationStructureGeometryDescriptor : public NS::Copying<AccelerationStructureGeometryDescriptor>
64
+ {
65
+ public:
66
+ static class AccelerationStructureGeometryDescriptor* alloc();
67
+
68
+ class AccelerationStructureGeometryDescriptor* init();
69
+
70
+ NS::UInteger intersectionFunctionTableOffset() const;
71
+ void setIntersectionFunctionTableOffset(NS::UInteger intersectionFunctionTableOffset);
72
+
73
+ bool opaque() const;
74
+ void setOpaque(bool opaque);
75
+
76
+ bool allowDuplicateIntersectionFunctionInvocation() const;
77
+ void setAllowDuplicateIntersectionFunctionInvocation(bool allowDuplicateIntersectionFunctionInvocation);
78
+
79
+ NS::String* label() const;
80
+ void setLabel(const NS::String* label);
81
+
82
+ class Buffer* primitiveDataBuffer() const;
83
+ void setPrimitiveDataBuffer(const class Buffer* primitiveDataBuffer);
84
+
85
+ NS::UInteger primitiveDataBufferOffset() const;
86
+ void setPrimitiveDataBufferOffset(NS::UInteger primitiveDataBufferOffset);
87
+
88
+ NS::UInteger primitiveDataStride() const;
89
+ void setPrimitiveDataStride(NS::UInteger primitiveDataStride);
90
+
91
+ NS::UInteger primitiveDataElementSize() const;
92
+ void setPrimitiveDataElementSize(NS::UInteger primitiveDataElementSize);
93
+ };
94
+
95
+ _MTL_ENUM(uint32_t, MotionBorderMode) {
96
+ MotionBorderModeClamp = 0,
97
+ MotionBorderModeVanish = 1,
98
+ };
99
+
100
+ class PrimitiveAccelerationStructureDescriptor : public NS::Copying<PrimitiveAccelerationStructureDescriptor, MTL::AccelerationStructureDescriptor>
101
+ {
102
+ public:
103
+ static class PrimitiveAccelerationStructureDescriptor* alloc();
104
+
105
+ class PrimitiveAccelerationStructureDescriptor* init();
106
+
107
+ NS::Array* geometryDescriptors() const;
108
+ void setGeometryDescriptors(const NS::Array* geometryDescriptors);
109
+
110
+ MTL::MotionBorderMode motionStartBorderMode() const;
111
+ void setMotionStartBorderMode(MTL::MotionBorderMode motionStartBorderMode);
112
+
113
+ MTL::MotionBorderMode motionEndBorderMode() const;
114
+ void setMotionEndBorderMode(MTL::MotionBorderMode motionEndBorderMode);
115
+
116
+ float motionStartTime() const;
117
+ void setMotionStartTime(float motionStartTime);
118
+
119
+ float motionEndTime() const;
120
+ void setMotionEndTime(float motionEndTime);
121
+
122
+ NS::UInteger motionKeyframeCount() const;
123
+ void setMotionKeyframeCount(NS::UInteger motionKeyframeCount);
124
+
125
+ static MTL::PrimitiveAccelerationStructureDescriptor* descriptor();
126
+ };
127
+
128
+ class AccelerationStructureTriangleGeometryDescriptor : public NS::Copying<AccelerationStructureTriangleGeometryDescriptor, MTL::AccelerationStructureGeometryDescriptor>
129
+ {
130
+ public:
131
+ static class AccelerationStructureTriangleGeometryDescriptor* alloc();
132
+
133
+ class AccelerationStructureTriangleGeometryDescriptor* init();
134
+
135
+ class Buffer* vertexBuffer() const;
136
+ void setVertexBuffer(const class Buffer* vertexBuffer);
137
+
138
+ NS::UInteger vertexBufferOffset() const;
139
+ void setVertexBufferOffset(NS::UInteger vertexBufferOffset);
140
+
141
+ MTL::AttributeFormat vertexFormat() const;
142
+ void setVertexFormat(MTL::AttributeFormat vertexFormat);
143
+
144
+ NS::UInteger vertexStride() const;
145
+ void setVertexStride(NS::UInteger vertexStride);
146
+
147
+ class Buffer* indexBuffer() const;
148
+ void setIndexBuffer(const class Buffer* indexBuffer);
149
+
150
+ NS::UInteger indexBufferOffset() const;
151
+ void setIndexBufferOffset(NS::UInteger indexBufferOffset);
152
+
153
+ MTL::IndexType indexType() const;
154
+ void setIndexType(MTL::IndexType indexType);
155
+
156
+ NS::UInteger triangleCount() const;
157
+ void setTriangleCount(NS::UInteger triangleCount);
158
+
159
+ class Buffer* transformationMatrixBuffer() const;
160
+ void setTransformationMatrixBuffer(const class Buffer* transformationMatrixBuffer);
161
+
162
+ NS::UInteger transformationMatrixBufferOffset() const;
163
+ void setTransformationMatrixBufferOffset(NS::UInteger transformationMatrixBufferOffset);
164
+
165
+ static MTL::AccelerationStructureTriangleGeometryDescriptor* descriptor();
166
+ };
167
+
168
+ class AccelerationStructureBoundingBoxGeometryDescriptor : public NS::Copying<AccelerationStructureBoundingBoxGeometryDescriptor, MTL::AccelerationStructureGeometryDescriptor>
169
+ {
170
+ public:
171
+ static class AccelerationStructureBoundingBoxGeometryDescriptor* alloc();
172
+
173
+ class AccelerationStructureBoundingBoxGeometryDescriptor* init();
174
+
175
+ class Buffer* boundingBoxBuffer() const;
176
+ void setBoundingBoxBuffer(const class Buffer* boundingBoxBuffer);
177
+
178
+ NS::UInteger boundingBoxBufferOffset() const;
179
+ void setBoundingBoxBufferOffset(NS::UInteger boundingBoxBufferOffset);
180
+
181
+ NS::UInteger boundingBoxStride() const;
182
+ void setBoundingBoxStride(NS::UInteger boundingBoxStride);
183
+
184
+ NS::UInteger boundingBoxCount() const;
185
+ void setBoundingBoxCount(NS::UInteger boundingBoxCount);
186
+
187
+ static MTL::AccelerationStructureBoundingBoxGeometryDescriptor* descriptor();
188
+ };
189
+
190
+ class MotionKeyframeData : public NS::Referencing<MotionKeyframeData>
191
+ {
192
+ public:
193
+ static class MotionKeyframeData* alloc();
194
+
195
+ class MotionKeyframeData* init();
196
+
197
+ class Buffer* buffer() const;
198
+ void setBuffer(const class Buffer* buffer);
199
+
200
+ NS::UInteger offset() const;
201
+ void setOffset(NS::UInteger offset);
202
+
203
+ static MTL::MotionKeyframeData* data();
204
+ };
205
+
206
+ class AccelerationStructureMotionTriangleGeometryDescriptor : public NS::Copying<AccelerationStructureMotionTriangleGeometryDescriptor, MTL::AccelerationStructureGeometryDescriptor>
207
+ {
208
+ public:
209
+ static class AccelerationStructureMotionTriangleGeometryDescriptor* alloc();
210
+
211
+ class AccelerationStructureMotionTriangleGeometryDescriptor* init();
212
+
213
+ NS::Array* vertexBuffers() const;
214
+ void setVertexBuffers(const NS::Array* vertexBuffers);
215
+
216
+ MTL::AttributeFormat vertexFormat() const;
217
+ void setVertexFormat(MTL::AttributeFormat vertexFormat);
218
+
219
+ NS::UInteger vertexStride() const;
220
+ void setVertexStride(NS::UInteger vertexStride);
221
+
222
+ class Buffer* indexBuffer() const;
223
+ void setIndexBuffer(const class Buffer* indexBuffer);
224
+
225
+ NS::UInteger indexBufferOffset() const;
226
+ void setIndexBufferOffset(NS::UInteger indexBufferOffset);
227
+
228
+ MTL::IndexType indexType() const;
229
+ void setIndexType(MTL::IndexType indexType);
230
+
231
+ NS::UInteger triangleCount() const;
232
+ void setTriangleCount(NS::UInteger triangleCount);
233
+
234
+ class Buffer* transformationMatrixBuffer() const;
235
+ void setTransformationMatrixBuffer(const class Buffer* transformationMatrixBuffer);
236
+
237
+ NS::UInteger transformationMatrixBufferOffset() const;
238
+ void setTransformationMatrixBufferOffset(NS::UInteger transformationMatrixBufferOffset);
239
+
240
+ static MTL::AccelerationStructureMotionTriangleGeometryDescriptor* descriptor();
241
+ };
242
+
243
+ class AccelerationStructureMotionBoundingBoxGeometryDescriptor : public NS::Copying<AccelerationStructureMotionBoundingBoxGeometryDescriptor, MTL::AccelerationStructureGeometryDescriptor>
244
+ {
245
+ public:
246
+ static class AccelerationStructureMotionBoundingBoxGeometryDescriptor* alloc();
247
+
248
+ class AccelerationStructureMotionBoundingBoxGeometryDescriptor* init();
249
+
250
+ NS::Array* boundingBoxBuffers() const;
251
+ void setBoundingBoxBuffers(const NS::Array* boundingBoxBuffers);
252
+
253
+ NS::UInteger boundingBoxStride() const;
254
+ void setBoundingBoxStride(NS::UInteger boundingBoxStride);
255
+
256
+ NS::UInteger boundingBoxCount() const;
257
+ void setBoundingBoxCount(NS::UInteger boundingBoxCount);
258
+
259
+ static MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor* descriptor();
260
+ };
261
+
262
+ _MTL_ENUM(NS::Integer, CurveType) {
263
+ CurveTypeRound = 0,
264
+ CurveTypeFlat = 1,
265
+ };
266
+
267
+ _MTL_ENUM(NS::Integer, CurveBasis) {
268
+ CurveBasisBSpline = 0,
269
+ CurveBasisCatmullRom = 1,
270
+ CurveBasisLinear = 2,
271
+ CurveBasisBezier = 3,
272
+ };
273
+
274
+ _MTL_ENUM(NS::Integer, CurveEndCaps) {
275
+ CurveEndCapsNone = 0,
276
+ CurveEndCapsDisk = 1,
277
+ CurveEndCapsSphere = 2,
278
+ };
279
+
280
+ class AccelerationStructureCurveGeometryDescriptor : public NS::Copying<AccelerationStructureCurveGeometryDescriptor, MTL::AccelerationStructureGeometryDescriptor>
281
+ {
282
+ public:
283
+ static class AccelerationStructureCurveGeometryDescriptor* alloc();
284
+
285
+ class AccelerationStructureCurveGeometryDescriptor* init();
286
+
287
+ class Buffer* controlPointBuffer() const;
288
+ void setControlPointBuffer(const class Buffer* controlPointBuffer);
289
+
290
+ NS::UInteger controlPointBufferOffset() const;
291
+ void setControlPointBufferOffset(NS::UInteger controlPointBufferOffset);
292
+
293
+ NS::UInteger controlPointCount() const;
294
+ void setControlPointCount(NS::UInteger controlPointCount);
295
+
296
+ NS::UInteger controlPointStride() const;
297
+ void setControlPointStride(NS::UInteger controlPointStride);
298
+
299
+ MTL::AttributeFormat controlPointFormat() const;
300
+ void setControlPointFormat(MTL::AttributeFormat controlPointFormat);
301
+
302
+ class Buffer* radiusBuffer() const;
303
+ void setRadiusBuffer(const class Buffer* radiusBuffer);
304
+
305
+ NS::UInteger radiusBufferOffset() const;
306
+ void setRadiusBufferOffset(NS::UInteger radiusBufferOffset);
307
+
308
+ MTL::AttributeFormat radiusFormat() const;
309
+ void setRadiusFormat(MTL::AttributeFormat radiusFormat);
310
+
311
+ NS::UInteger radiusStride() const;
312
+ void setRadiusStride(NS::UInteger radiusStride);
313
+
314
+ class Buffer* indexBuffer() const;
315
+ void setIndexBuffer(const class Buffer* indexBuffer);
316
+
317
+ NS::UInteger indexBufferOffset() const;
318
+ void setIndexBufferOffset(NS::UInteger indexBufferOffset);
319
+
320
+ MTL::IndexType indexType() const;
321
+ void setIndexType(MTL::IndexType indexType);
322
+
323
+ NS::UInteger segmentCount() const;
324
+ void setSegmentCount(NS::UInteger segmentCount);
325
+
326
+ NS::UInteger segmentControlPointCount() const;
327
+ void setSegmentControlPointCount(NS::UInteger segmentControlPointCount);
328
+
329
+ MTL::CurveType curveType() const;
330
+ void setCurveType(MTL::CurveType curveType);
331
+
332
+ MTL::CurveBasis curveBasis() const;
333
+ void setCurveBasis(MTL::CurveBasis curveBasis);
334
+
335
+ MTL::CurveEndCaps curveEndCaps() const;
336
+ void setCurveEndCaps(MTL::CurveEndCaps curveEndCaps);
337
+
338
+ static MTL::AccelerationStructureCurveGeometryDescriptor* descriptor();
339
+ };
340
+
341
+ class AccelerationStructureMotionCurveGeometryDescriptor : public NS::Copying<AccelerationStructureMotionCurveGeometryDescriptor, MTL::AccelerationStructureGeometryDescriptor>
342
+ {
343
+ public:
344
+ static class AccelerationStructureMotionCurveGeometryDescriptor* alloc();
345
+
346
+ class AccelerationStructureMotionCurveGeometryDescriptor* init();
347
+
348
+ NS::Array* controlPointBuffers() const;
349
+ void setControlPointBuffers(const NS::Array* controlPointBuffers);
350
+
351
+ NS::UInteger controlPointCount() const;
352
+ void setControlPointCount(NS::UInteger controlPointCount);
353
+
354
+ NS::UInteger controlPointStride() const;
355
+ void setControlPointStride(NS::UInteger controlPointStride);
356
+
357
+ MTL::AttributeFormat controlPointFormat() const;
358
+ void setControlPointFormat(MTL::AttributeFormat controlPointFormat);
359
+
360
+ NS::Array* radiusBuffers() const;
361
+ void setRadiusBuffers(const NS::Array* radiusBuffers);
362
+
363
+ MTL::AttributeFormat radiusFormat() const;
364
+ void setRadiusFormat(MTL::AttributeFormat radiusFormat);
365
+
366
+ NS::UInteger radiusStride() const;
367
+ void setRadiusStride(NS::UInteger radiusStride);
368
+
369
+ class Buffer* indexBuffer() const;
370
+ void setIndexBuffer(const class Buffer* indexBuffer);
371
+
372
+ NS::UInteger indexBufferOffset() const;
373
+ void setIndexBufferOffset(NS::UInteger indexBufferOffset);
374
+
375
+ MTL::IndexType indexType() const;
376
+ void setIndexType(MTL::IndexType indexType);
377
+
378
+ NS::UInteger segmentCount() const;
379
+ void setSegmentCount(NS::UInteger segmentCount);
380
+
381
+ NS::UInteger segmentControlPointCount() const;
382
+ void setSegmentControlPointCount(NS::UInteger segmentControlPointCount);
383
+
384
+ MTL::CurveType curveType() const;
385
+ void setCurveType(MTL::CurveType curveType);
386
+
387
+ MTL::CurveBasis curveBasis() const;
388
+ void setCurveBasis(MTL::CurveBasis curveBasis);
389
+
390
+ MTL::CurveEndCaps curveEndCaps() const;
391
+ void setCurveEndCaps(MTL::CurveEndCaps curveEndCaps);
392
+
393
+ static MTL::AccelerationStructureMotionCurveGeometryDescriptor* descriptor();
394
+ };
395
+
396
+ struct AccelerationStructureInstanceDescriptor
397
+ {
398
+ MTL::PackedFloat4x3 transformationMatrix;
399
+ MTL::AccelerationStructureInstanceOptions options;
400
+ uint32_t mask;
401
+ uint32_t intersectionFunctionTableOffset;
402
+ uint32_t accelerationStructureIndex;
403
+ } _MTL_PACKED;
404
+
405
+ struct AccelerationStructureUserIDInstanceDescriptor
406
+ {
407
+ MTL::PackedFloat4x3 transformationMatrix;
408
+ MTL::AccelerationStructureInstanceOptions options;
409
+ uint32_t mask;
410
+ uint32_t intersectionFunctionTableOffset;
411
+ uint32_t accelerationStructureIndex;
412
+ uint32_t userID;
413
+ } _MTL_PACKED;
414
+
415
+ _MTL_ENUM(NS::UInteger, AccelerationStructureInstanceDescriptorType) {
416
+ AccelerationStructureInstanceDescriptorTypeDefault = 0,
417
+ AccelerationStructureInstanceDescriptorTypeUserID = 1,
418
+ AccelerationStructureInstanceDescriptorTypeMotion = 2,
419
+ AccelerationStructureInstanceDescriptorTypeIndirect = 3,
420
+ AccelerationStructureInstanceDescriptorTypeIndirectMotion = 4,
421
+ };
422
+
423
+ struct AccelerationStructureMotionInstanceDescriptor
424
+ {
425
+ MTL::AccelerationStructureInstanceOptions options;
426
+ uint32_t mask;
427
+ uint32_t intersectionFunctionTableOffset;
428
+ uint32_t accelerationStructureIndex;
429
+ uint32_t userID;
430
+ uint32_t motionTransformsStartIndex;
431
+ uint32_t motionTransformsCount;
432
+ MTL::MotionBorderMode motionStartBorderMode;
433
+ MTL::MotionBorderMode motionEndBorderMode;
434
+ float motionStartTime;
435
+ float motionEndTime;
436
+ } _MTL_PACKED;
437
+
438
+ struct IndirectAccelerationStructureInstanceDescriptor
439
+ {
440
+ MTL::PackedFloat4x3 transformationMatrix;
441
+ MTL::AccelerationStructureInstanceOptions options;
442
+ uint32_t mask;
443
+ uint32_t intersectionFunctionTableOffset;
444
+ uint32_t userID;
445
+ MTL::ResourceID accelerationStructureID;
446
+ } _MTL_PACKED;
447
+
448
+ struct IndirectAccelerationStructureMotionInstanceDescriptor
449
+ {
450
+ MTL::AccelerationStructureInstanceOptions options;
451
+ uint32_t mask;
452
+ uint32_t intersectionFunctionTableOffset;
453
+ uint32_t userID;
454
+ MTL::ResourceID accelerationStructureID;
455
+ uint32_t motionTransformsStartIndex;
456
+ uint32_t motionTransformsCount;
457
+ MTL::MotionBorderMode motionStartBorderMode;
458
+ MTL::MotionBorderMode motionEndBorderMode;
459
+ float motionStartTime;
460
+ float motionEndTime;
461
+ } _MTL_PACKED;
462
+
463
+ class InstanceAccelerationStructureDescriptor : public NS::Copying<InstanceAccelerationStructureDescriptor, MTL::AccelerationStructureDescriptor>
464
+ {
465
+ public:
466
+ static class InstanceAccelerationStructureDescriptor* alloc();
467
+
468
+ class InstanceAccelerationStructureDescriptor* init();
469
+
470
+ class Buffer* instanceDescriptorBuffer() const;
471
+ void setInstanceDescriptorBuffer(const class Buffer* instanceDescriptorBuffer);
472
+
473
+ NS::UInteger instanceDescriptorBufferOffset() const;
474
+ void setInstanceDescriptorBufferOffset(NS::UInteger instanceDescriptorBufferOffset);
475
+
476
+ NS::UInteger instanceDescriptorStride() const;
477
+ void setInstanceDescriptorStride(NS::UInteger instanceDescriptorStride);
478
+
479
+ NS::UInteger instanceCount() const;
480
+ void setInstanceCount(NS::UInteger instanceCount);
481
+
482
+ NS::Array* instancedAccelerationStructures() const;
483
+ void setInstancedAccelerationStructures(const NS::Array* instancedAccelerationStructures);
484
+
485
+ MTL::AccelerationStructureInstanceDescriptorType instanceDescriptorType() const;
486
+ void setInstanceDescriptorType(MTL::AccelerationStructureInstanceDescriptorType instanceDescriptorType);
487
+
488
+ class Buffer* motionTransformBuffer() const;
489
+ void setMotionTransformBuffer(const class Buffer* motionTransformBuffer);
490
+
491
+ NS::UInteger motionTransformBufferOffset() const;
492
+ void setMotionTransformBufferOffset(NS::UInteger motionTransformBufferOffset);
493
+
494
+ NS::UInteger motionTransformCount() const;
495
+ void setMotionTransformCount(NS::UInteger motionTransformCount);
496
+
497
+ static MTL::InstanceAccelerationStructureDescriptor* descriptor();
498
+ };
499
+
500
+ class IndirectInstanceAccelerationStructureDescriptor : public NS::Copying<IndirectInstanceAccelerationStructureDescriptor, MTL::AccelerationStructureDescriptor>
501
+ {
502
+ public:
503
+ static class IndirectInstanceAccelerationStructureDescriptor* alloc();
504
+
505
+ class IndirectInstanceAccelerationStructureDescriptor* init();
506
+
507
+ class Buffer* instanceDescriptorBuffer() const;
508
+ void setInstanceDescriptorBuffer(const class Buffer* instanceDescriptorBuffer);
509
+
510
+ NS::UInteger instanceDescriptorBufferOffset() const;
511
+ void setInstanceDescriptorBufferOffset(NS::UInteger instanceDescriptorBufferOffset);
512
+
513
+ NS::UInteger instanceDescriptorStride() const;
514
+ void setInstanceDescriptorStride(NS::UInteger instanceDescriptorStride);
515
+
516
+ NS::UInteger maxInstanceCount() const;
517
+ void setMaxInstanceCount(NS::UInteger maxInstanceCount);
518
+
519
+ class Buffer* instanceCountBuffer() const;
520
+ void setInstanceCountBuffer(const class Buffer* instanceCountBuffer);
521
+
522
+ NS::UInteger instanceCountBufferOffset() const;
523
+ void setInstanceCountBufferOffset(NS::UInteger instanceCountBufferOffset);
524
+
525
+ MTL::AccelerationStructureInstanceDescriptorType instanceDescriptorType() const;
526
+ void setInstanceDescriptorType(MTL::AccelerationStructureInstanceDescriptorType instanceDescriptorType);
527
+
528
+ class Buffer* motionTransformBuffer() const;
529
+ void setMotionTransformBuffer(const class Buffer* motionTransformBuffer);
530
+
531
+ NS::UInteger motionTransformBufferOffset() const;
532
+ void setMotionTransformBufferOffset(NS::UInteger motionTransformBufferOffset);
533
+
534
+ NS::UInteger maxMotionTransformCount() const;
535
+ void setMaxMotionTransformCount(NS::UInteger maxMotionTransformCount);
536
+
537
+ class Buffer* motionTransformCountBuffer() const;
538
+ void setMotionTransformCountBuffer(const class Buffer* motionTransformCountBuffer);
539
+
540
+ NS::UInteger motionTransformCountBufferOffset() const;
541
+ void setMotionTransformCountBufferOffset(NS::UInteger motionTransformCountBufferOffset);
542
+
543
+ static MTL::IndirectInstanceAccelerationStructureDescriptor* descriptor();
544
+ };
545
+
546
+ class AccelerationStructure : public NS::Referencing<AccelerationStructure, Resource>
547
+ {
548
+ public:
549
+ NS::UInteger size() const;
550
+
551
+ MTL::ResourceID gpuResourceID() const;
552
+ };
553
+
554
+ }
555
+
556
+ // static method: alloc
557
+ _MTL_INLINE MTL::AccelerationStructureDescriptor* MTL::AccelerationStructureDescriptor::alloc()
558
+ {
559
+ return NS::Object::alloc<MTL::AccelerationStructureDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureDescriptor));
560
+ }
561
+
562
+ // method: init
563
+ _MTL_INLINE MTL::AccelerationStructureDescriptor* MTL::AccelerationStructureDescriptor::init()
564
+ {
565
+ return NS::Object::init<MTL::AccelerationStructureDescriptor>();
566
+ }
567
+
568
+ // property: usage
569
+ _MTL_INLINE MTL::AccelerationStructureUsage MTL::AccelerationStructureDescriptor::usage() const
570
+ {
571
+ return Object::sendMessage<MTL::AccelerationStructureUsage>(this, _MTL_PRIVATE_SEL(usage));
572
+ }
573
+
574
+ _MTL_INLINE void MTL::AccelerationStructureDescriptor::setUsage(MTL::AccelerationStructureUsage usage)
575
+ {
576
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setUsage_), usage);
577
+ }
578
+
579
+ // static method: alloc
580
+ _MTL_INLINE MTL::AccelerationStructureGeometryDescriptor* MTL::AccelerationStructureGeometryDescriptor::alloc()
581
+ {
582
+ return NS::Object::alloc<MTL::AccelerationStructureGeometryDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureGeometryDescriptor));
583
+ }
584
+
585
+ // method: init
586
+ _MTL_INLINE MTL::AccelerationStructureGeometryDescriptor* MTL::AccelerationStructureGeometryDescriptor::init()
587
+ {
588
+ return NS::Object::init<MTL::AccelerationStructureGeometryDescriptor>();
589
+ }
590
+
591
+ // property: intersectionFunctionTableOffset
592
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureGeometryDescriptor::intersectionFunctionTableOffset() const
593
+ {
594
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(intersectionFunctionTableOffset));
595
+ }
596
+
597
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setIntersectionFunctionTableOffset(NS::UInteger intersectionFunctionTableOffset)
598
+ {
599
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTableOffset_), intersectionFunctionTableOffset);
600
+ }
601
+
602
+ // property: opaque
603
+ _MTL_INLINE bool MTL::AccelerationStructureGeometryDescriptor::opaque() const
604
+ {
605
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(opaque));
606
+ }
607
+
608
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setOpaque(bool opaque)
609
+ {
610
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaque_), opaque);
611
+ }
612
+
613
+ // property: allowDuplicateIntersectionFunctionInvocation
614
+ _MTL_INLINE bool MTL::AccelerationStructureGeometryDescriptor::allowDuplicateIntersectionFunctionInvocation() const
615
+ {
616
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(allowDuplicateIntersectionFunctionInvocation));
617
+ }
618
+
619
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setAllowDuplicateIntersectionFunctionInvocation(bool allowDuplicateIntersectionFunctionInvocation)
620
+ {
621
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAllowDuplicateIntersectionFunctionInvocation_), allowDuplicateIntersectionFunctionInvocation);
622
+ }
623
+
624
+ // property: label
625
+ _MTL_INLINE NS::String* MTL::AccelerationStructureGeometryDescriptor::label() const
626
+ {
627
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
628
+ }
629
+
630
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setLabel(const NS::String* label)
631
+ {
632
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
633
+ }
634
+
635
+ // property: primitiveDataBuffer
636
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureGeometryDescriptor::primitiveDataBuffer() const
637
+ {
638
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(primitiveDataBuffer));
639
+ }
640
+
641
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setPrimitiveDataBuffer(const MTL::Buffer* primitiveDataBuffer)
642
+ {
643
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPrimitiveDataBuffer_), primitiveDataBuffer);
644
+ }
645
+
646
+ // property: primitiveDataBufferOffset
647
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureGeometryDescriptor::primitiveDataBufferOffset() const
648
+ {
649
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(primitiveDataBufferOffset));
650
+ }
651
+
652
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setPrimitiveDataBufferOffset(NS::UInteger primitiveDataBufferOffset)
653
+ {
654
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPrimitiveDataBufferOffset_), primitiveDataBufferOffset);
655
+ }
656
+
657
+ // property: primitiveDataStride
658
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureGeometryDescriptor::primitiveDataStride() const
659
+ {
660
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(primitiveDataStride));
661
+ }
662
+
663
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setPrimitiveDataStride(NS::UInteger primitiveDataStride)
664
+ {
665
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPrimitiveDataStride_), primitiveDataStride);
666
+ }
667
+
668
+ // property: primitiveDataElementSize
669
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureGeometryDescriptor::primitiveDataElementSize() const
670
+ {
671
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(primitiveDataElementSize));
672
+ }
673
+
674
+ _MTL_INLINE void MTL::AccelerationStructureGeometryDescriptor::setPrimitiveDataElementSize(NS::UInteger primitiveDataElementSize)
675
+ {
676
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPrimitiveDataElementSize_), primitiveDataElementSize);
677
+ }
678
+
679
+ // static method: alloc
680
+ _MTL_INLINE MTL::PrimitiveAccelerationStructureDescriptor* MTL::PrimitiveAccelerationStructureDescriptor::alloc()
681
+ {
682
+ return NS::Object::alloc<MTL::PrimitiveAccelerationStructureDescriptor>(_MTL_PRIVATE_CLS(MTLPrimitiveAccelerationStructureDescriptor));
683
+ }
684
+
685
+ // method: init
686
+ _MTL_INLINE MTL::PrimitiveAccelerationStructureDescriptor* MTL::PrimitiveAccelerationStructureDescriptor::init()
687
+ {
688
+ return NS::Object::init<MTL::PrimitiveAccelerationStructureDescriptor>();
689
+ }
690
+
691
+ // property: geometryDescriptors
692
+ _MTL_INLINE NS::Array* MTL::PrimitiveAccelerationStructureDescriptor::geometryDescriptors() const
693
+ {
694
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(geometryDescriptors));
695
+ }
696
+
697
+ _MTL_INLINE void MTL::PrimitiveAccelerationStructureDescriptor::setGeometryDescriptors(const NS::Array* geometryDescriptors)
698
+ {
699
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setGeometryDescriptors_), geometryDescriptors);
700
+ }
701
+
702
+ // property: motionStartBorderMode
703
+ _MTL_INLINE MTL::MotionBorderMode MTL::PrimitiveAccelerationStructureDescriptor::motionStartBorderMode() const
704
+ {
705
+ return Object::sendMessage<MTL::MotionBorderMode>(this, _MTL_PRIVATE_SEL(motionStartBorderMode));
706
+ }
707
+
708
+ _MTL_INLINE void MTL::PrimitiveAccelerationStructureDescriptor::setMotionStartBorderMode(MTL::MotionBorderMode motionStartBorderMode)
709
+ {
710
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionStartBorderMode_), motionStartBorderMode);
711
+ }
712
+
713
+ // property: motionEndBorderMode
714
+ _MTL_INLINE MTL::MotionBorderMode MTL::PrimitiveAccelerationStructureDescriptor::motionEndBorderMode() const
715
+ {
716
+ return Object::sendMessage<MTL::MotionBorderMode>(this, _MTL_PRIVATE_SEL(motionEndBorderMode));
717
+ }
718
+
719
+ _MTL_INLINE void MTL::PrimitiveAccelerationStructureDescriptor::setMotionEndBorderMode(MTL::MotionBorderMode motionEndBorderMode)
720
+ {
721
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionEndBorderMode_), motionEndBorderMode);
722
+ }
723
+
724
+ // property: motionStartTime
725
+ _MTL_INLINE float MTL::PrimitiveAccelerationStructureDescriptor::motionStartTime() const
726
+ {
727
+ return Object::sendMessage<float>(this, _MTL_PRIVATE_SEL(motionStartTime));
728
+ }
729
+
730
+ _MTL_INLINE void MTL::PrimitiveAccelerationStructureDescriptor::setMotionStartTime(float motionStartTime)
731
+ {
732
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionStartTime_), motionStartTime);
733
+ }
734
+
735
+ // property: motionEndTime
736
+ _MTL_INLINE float MTL::PrimitiveAccelerationStructureDescriptor::motionEndTime() const
737
+ {
738
+ return Object::sendMessage<float>(this, _MTL_PRIVATE_SEL(motionEndTime));
739
+ }
740
+
741
+ _MTL_INLINE void MTL::PrimitiveAccelerationStructureDescriptor::setMotionEndTime(float motionEndTime)
742
+ {
743
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionEndTime_), motionEndTime);
744
+ }
745
+
746
+ // property: motionKeyframeCount
747
+ _MTL_INLINE NS::UInteger MTL::PrimitiveAccelerationStructureDescriptor::motionKeyframeCount() const
748
+ {
749
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(motionKeyframeCount));
750
+ }
751
+
752
+ _MTL_INLINE void MTL::PrimitiveAccelerationStructureDescriptor::setMotionKeyframeCount(NS::UInteger motionKeyframeCount)
753
+ {
754
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionKeyframeCount_), motionKeyframeCount);
755
+ }
756
+
757
+ // static method: descriptor
758
+ _MTL_INLINE MTL::PrimitiveAccelerationStructureDescriptor* MTL::PrimitiveAccelerationStructureDescriptor::descriptor()
759
+ {
760
+ return Object::sendMessage<MTL::PrimitiveAccelerationStructureDescriptor*>(_MTL_PRIVATE_CLS(MTLPrimitiveAccelerationStructureDescriptor), _MTL_PRIVATE_SEL(descriptor));
761
+ }
762
+
763
+ // static method: alloc
764
+ _MTL_INLINE MTL::AccelerationStructureTriangleGeometryDescriptor* MTL::AccelerationStructureTriangleGeometryDescriptor::alloc()
765
+ {
766
+ return NS::Object::alloc<MTL::AccelerationStructureTriangleGeometryDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureTriangleGeometryDescriptor));
767
+ }
768
+
769
+ // method: init
770
+ _MTL_INLINE MTL::AccelerationStructureTriangleGeometryDescriptor* MTL::AccelerationStructureTriangleGeometryDescriptor::init()
771
+ {
772
+ return NS::Object::init<MTL::AccelerationStructureTriangleGeometryDescriptor>();
773
+ }
774
+
775
+ // property: vertexBuffer
776
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureTriangleGeometryDescriptor::vertexBuffer() const
777
+ {
778
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(vertexBuffer));
779
+ }
780
+
781
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setVertexBuffer(const MTL::Buffer* vertexBuffer)
782
+ {
783
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexBuffer_), vertexBuffer);
784
+ }
785
+
786
+ // property: vertexBufferOffset
787
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureTriangleGeometryDescriptor::vertexBufferOffset() const
788
+ {
789
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(vertexBufferOffset));
790
+ }
791
+
792
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setVertexBufferOffset(NS::UInteger vertexBufferOffset)
793
+ {
794
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexBufferOffset_), vertexBufferOffset);
795
+ }
796
+
797
+ // property: vertexFormat
798
+ _MTL_INLINE MTL::AttributeFormat MTL::AccelerationStructureTriangleGeometryDescriptor::vertexFormat() const
799
+ {
800
+ return Object::sendMessage<MTL::AttributeFormat>(this, _MTL_PRIVATE_SEL(vertexFormat));
801
+ }
802
+
803
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setVertexFormat(MTL::AttributeFormat vertexFormat)
804
+ {
805
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexFormat_), vertexFormat);
806
+ }
807
+
808
+ // property: vertexStride
809
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureTriangleGeometryDescriptor::vertexStride() const
810
+ {
811
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(vertexStride));
812
+ }
813
+
814
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setVertexStride(NS::UInteger vertexStride)
815
+ {
816
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexStride_), vertexStride);
817
+ }
818
+
819
+ // property: indexBuffer
820
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureTriangleGeometryDescriptor::indexBuffer() const
821
+ {
822
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(indexBuffer));
823
+ }
824
+
825
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setIndexBuffer(const MTL::Buffer* indexBuffer)
826
+ {
827
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBuffer_), indexBuffer);
828
+ }
829
+
830
+ // property: indexBufferOffset
831
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureTriangleGeometryDescriptor::indexBufferOffset() const
832
+ {
833
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(indexBufferOffset));
834
+ }
835
+
836
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setIndexBufferOffset(NS::UInteger indexBufferOffset)
837
+ {
838
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBufferOffset_), indexBufferOffset);
839
+ }
840
+
841
+ // property: indexType
842
+ _MTL_INLINE MTL::IndexType MTL::AccelerationStructureTriangleGeometryDescriptor::indexType() const
843
+ {
844
+ return Object::sendMessage<MTL::IndexType>(this, _MTL_PRIVATE_SEL(indexType));
845
+ }
846
+
847
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setIndexType(MTL::IndexType indexType)
848
+ {
849
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexType_), indexType);
850
+ }
851
+
852
+ // property: triangleCount
853
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureTriangleGeometryDescriptor::triangleCount() const
854
+ {
855
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(triangleCount));
856
+ }
857
+
858
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setTriangleCount(NS::UInteger triangleCount)
859
+ {
860
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTriangleCount_), triangleCount);
861
+ }
862
+
863
+ // property: transformationMatrixBuffer
864
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureTriangleGeometryDescriptor::transformationMatrixBuffer() const
865
+ {
866
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(transformationMatrixBuffer));
867
+ }
868
+
869
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setTransformationMatrixBuffer(const MTL::Buffer* transformationMatrixBuffer)
870
+ {
871
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTransformationMatrixBuffer_), transformationMatrixBuffer);
872
+ }
873
+
874
+ // property: transformationMatrixBufferOffset
875
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureTriangleGeometryDescriptor::transformationMatrixBufferOffset() const
876
+ {
877
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(transformationMatrixBufferOffset));
878
+ }
879
+
880
+ _MTL_INLINE void MTL::AccelerationStructureTriangleGeometryDescriptor::setTransformationMatrixBufferOffset(NS::UInteger transformationMatrixBufferOffset)
881
+ {
882
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTransformationMatrixBufferOffset_), transformationMatrixBufferOffset);
883
+ }
884
+
885
+ // static method: descriptor
886
+ _MTL_INLINE MTL::AccelerationStructureTriangleGeometryDescriptor* MTL::AccelerationStructureTriangleGeometryDescriptor::descriptor()
887
+ {
888
+ return Object::sendMessage<MTL::AccelerationStructureTriangleGeometryDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructureTriangleGeometryDescriptor), _MTL_PRIVATE_SEL(descriptor));
889
+ }
890
+
891
+ // static method: alloc
892
+ _MTL_INLINE MTL::AccelerationStructureBoundingBoxGeometryDescriptor* MTL::AccelerationStructureBoundingBoxGeometryDescriptor::alloc()
893
+ {
894
+ return NS::Object::alloc<MTL::AccelerationStructureBoundingBoxGeometryDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureBoundingBoxGeometryDescriptor));
895
+ }
896
+
897
+ // method: init
898
+ _MTL_INLINE MTL::AccelerationStructureBoundingBoxGeometryDescriptor* MTL::AccelerationStructureBoundingBoxGeometryDescriptor::init()
899
+ {
900
+ return NS::Object::init<MTL::AccelerationStructureBoundingBoxGeometryDescriptor>();
901
+ }
902
+
903
+ // property: boundingBoxBuffer
904
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureBoundingBoxGeometryDescriptor::boundingBoxBuffer() const
905
+ {
906
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(boundingBoxBuffer));
907
+ }
908
+
909
+ _MTL_INLINE void MTL::AccelerationStructureBoundingBoxGeometryDescriptor::setBoundingBoxBuffer(const MTL::Buffer* boundingBoxBuffer)
910
+ {
911
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBoundingBoxBuffer_), boundingBoxBuffer);
912
+ }
913
+
914
+ // property: boundingBoxBufferOffset
915
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureBoundingBoxGeometryDescriptor::boundingBoxBufferOffset() const
916
+ {
917
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(boundingBoxBufferOffset));
918
+ }
919
+
920
+ _MTL_INLINE void MTL::AccelerationStructureBoundingBoxGeometryDescriptor::setBoundingBoxBufferOffset(NS::UInteger boundingBoxBufferOffset)
921
+ {
922
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBoundingBoxBufferOffset_), boundingBoxBufferOffset);
923
+ }
924
+
925
+ // property: boundingBoxStride
926
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureBoundingBoxGeometryDescriptor::boundingBoxStride() const
927
+ {
928
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(boundingBoxStride));
929
+ }
930
+
931
+ _MTL_INLINE void MTL::AccelerationStructureBoundingBoxGeometryDescriptor::setBoundingBoxStride(NS::UInteger boundingBoxStride)
932
+ {
933
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBoundingBoxStride_), boundingBoxStride);
934
+ }
935
+
936
+ // property: boundingBoxCount
937
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureBoundingBoxGeometryDescriptor::boundingBoxCount() const
938
+ {
939
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(boundingBoxCount));
940
+ }
941
+
942
+ _MTL_INLINE void MTL::AccelerationStructureBoundingBoxGeometryDescriptor::setBoundingBoxCount(NS::UInteger boundingBoxCount)
943
+ {
944
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBoundingBoxCount_), boundingBoxCount);
945
+ }
946
+
947
+ // static method: descriptor
948
+ _MTL_INLINE MTL::AccelerationStructureBoundingBoxGeometryDescriptor* MTL::AccelerationStructureBoundingBoxGeometryDescriptor::descriptor()
949
+ {
950
+ return Object::sendMessage<MTL::AccelerationStructureBoundingBoxGeometryDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructureBoundingBoxGeometryDescriptor), _MTL_PRIVATE_SEL(descriptor));
951
+ }
952
+
953
+ // static method: alloc
954
+ _MTL_INLINE MTL::MotionKeyframeData* MTL::MotionKeyframeData::alloc()
955
+ {
956
+ return NS::Object::alloc<MTL::MotionKeyframeData>(_MTL_PRIVATE_CLS(MTLMotionKeyframeData));
957
+ }
958
+
959
+ // method: init
960
+ _MTL_INLINE MTL::MotionKeyframeData* MTL::MotionKeyframeData::init()
961
+ {
962
+ return NS::Object::init<MTL::MotionKeyframeData>();
963
+ }
964
+
965
+ // property: buffer
966
+ _MTL_INLINE MTL::Buffer* MTL::MotionKeyframeData::buffer() const
967
+ {
968
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(buffer));
969
+ }
970
+
971
+ _MTL_INLINE void MTL::MotionKeyframeData::setBuffer(const MTL::Buffer* buffer)
972
+ {
973
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_), buffer);
974
+ }
975
+
976
+ // property: offset
977
+ _MTL_INLINE NS::UInteger MTL::MotionKeyframeData::offset() const
978
+ {
979
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(offset));
980
+ }
981
+
982
+ _MTL_INLINE void MTL::MotionKeyframeData::setOffset(NS::UInteger offset)
983
+ {
984
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOffset_), offset);
985
+ }
986
+
987
+ // static method: data
988
+ _MTL_INLINE MTL::MotionKeyframeData* MTL::MotionKeyframeData::data()
989
+ {
990
+ return Object::sendMessage<MTL::MotionKeyframeData*>(_MTL_PRIVATE_CLS(MTLMotionKeyframeData), _MTL_PRIVATE_SEL(data));
991
+ }
992
+
993
+ // static method: alloc
994
+ _MTL_INLINE MTL::AccelerationStructureMotionTriangleGeometryDescriptor* MTL::AccelerationStructureMotionTriangleGeometryDescriptor::alloc()
995
+ {
996
+ return NS::Object::alloc<MTL::AccelerationStructureMotionTriangleGeometryDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureMotionTriangleGeometryDescriptor));
997
+ }
998
+
999
+ // method: init
1000
+ _MTL_INLINE MTL::AccelerationStructureMotionTriangleGeometryDescriptor* MTL::AccelerationStructureMotionTriangleGeometryDescriptor::init()
1001
+ {
1002
+ return NS::Object::init<MTL::AccelerationStructureMotionTriangleGeometryDescriptor>();
1003
+ }
1004
+
1005
+ // property: vertexBuffers
1006
+ _MTL_INLINE NS::Array* MTL::AccelerationStructureMotionTriangleGeometryDescriptor::vertexBuffers() const
1007
+ {
1008
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(vertexBuffers));
1009
+ }
1010
+
1011
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setVertexBuffers(const NS::Array* vertexBuffers)
1012
+ {
1013
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexBuffers_), vertexBuffers);
1014
+ }
1015
+
1016
+ // property: vertexFormat
1017
+ _MTL_INLINE MTL::AttributeFormat MTL::AccelerationStructureMotionTriangleGeometryDescriptor::vertexFormat() const
1018
+ {
1019
+ return Object::sendMessage<MTL::AttributeFormat>(this, _MTL_PRIVATE_SEL(vertexFormat));
1020
+ }
1021
+
1022
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setVertexFormat(MTL::AttributeFormat vertexFormat)
1023
+ {
1024
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexFormat_), vertexFormat);
1025
+ }
1026
+
1027
+ // property: vertexStride
1028
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionTriangleGeometryDescriptor::vertexStride() const
1029
+ {
1030
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(vertexStride));
1031
+ }
1032
+
1033
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setVertexStride(NS::UInteger vertexStride)
1034
+ {
1035
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexStride_), vertexStride);
1036
+ }
1037
+
1038
+ // property: indexBuffer
1039
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureMotionTriangleGeometryDescriptor::indexBuffer() const
1040
+ {
1041
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(indexBuffer));
1042
+ }
1043
+
1044
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setIndexBuffer(const MTL::Buffer* indexBuffer)
1045
+ {
1046
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBuffer_), indexBuffer);
1047
+ }
1048
+
1049
+ // property: indexBufferOffset
1050
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionTriangleGeometryDescriptor::indexBufferOffset() const
1051
+ {
1052
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(indexBufferOffset));
1053
+ }
1054
+
1055
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setIndexBufferOffset(NS::UInteger indexBufferOffset)
1056
+ {
1057
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBufferOffset_), indexBufferOffset);
1058
+ }
1059
+
1060
+ // property: indexType
1061
+ _MTL_INLINE MTL::IndexType MTL::AccelerationStructureMotionTriangleGeometryDescriptor::indexType() const
1062
+ {
1063
+ return Object::sendMessage<MTL::IndexType>(this, _MTL_PRIVATE_SEL(indexType));
1064
+ }
1065
+
1066
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setIndexType(MTL::IndexType indexType)
1067
+ {
1068
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexType_), indexType);
1069
+ }
1070
+
1071
+ // property: triangleCount
1072
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionTriangleGeometryDescriptor::triangleCount() const
1073
+ {
1074
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(triangleCount));
1075
+ }
1076
+
1077
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setTriangleCount(NS::UInteger triangleCount)
1078
+ {
1079
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTriangleCount_), triangleCount);
1080
+ }
1081
+
1082
+ // property: transformationMatrixBuffer
1083
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureMotionTriangleGeometryDescriptor::transformationMatrixBuffer() const
1084
+ {
1085
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(transformationMatrixBuffer));
1086
+ }
1087
+
1088
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setTransformationMatrixBuffer(const MTL::Buffer* transformationMatrixBuffer)
1089
+ {
1090
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTransformationMatrixBuffer_), transformationMatrixBuffer);
1091
+ }
1092
+
1093
+ // property: transformationMatrixBufferOffset
1094
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionTriangleGeometryDescriptor::transformationMatrixBufferOffset() const
1095
+ {
1096
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(transformationMatrixBufferOffset));
1097
+ }
1098
+
1099
+ _MTL_INLINE void MTL::AccelerationStructureMotionTriangleGeometryDescriptor::setTransformationMatrixBufferOffset(NS::UInteger transformationMatrixBufferOffset)
1100
+ {
1101
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTransformationMatrixBufferOffset_), transformationMatrixBufferOffset);
1102
+ }
1103
+
1104
+ // static method: descriptor
1105
+ _MTL_INLINE MTL::AccelerationStructureMotionTriangleGeometryDescriptor* MTL::AccelerationStructureMotionTriangleGeometryDescriptor::descriptor()
1106
+ {
1107
+ return Object::sendMessage<MTL::AccelerationStructureMotionTriangleGeometryDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructureMotionTriangleGeometryDescriptor), _MTL_PRIVATE_SEL(descriptor));
1108
+ }
1109
+
1110
+ // static method: alloc
1111
+ _MTL_INLINE MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor* MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::alloc()
1112
+ {
1113
+ return NS::Object::alloc<MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor));
1114
+ }
1115
+
1116
+ // method: init
1117
+ _MTL_INLINE MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor* MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::init()
1118
+ {
1119
+ return NS::Object::init<MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor>();
1120
+ }
1121
+
1122
+ // property: boundingBoxBuffers
1123
+ _MTL_INLINE NS::Array* MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::boundingBoxBuffers() const
1124
+ {
1125
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(boundingBoxBuffers));
1126
+ }
1127
+
1128
+ _MTL_INLINE void MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::setBoundingBoxBuffers(const NS::Array* boundingBoxBuffers)
1129
+ {
1130
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBoundingBoxBuffers_), boundingBoxBuffers);
1131
+ }
1132
+
1133
+ // property: boundingBoxStride
1134
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::boundingBoxStride() const
1135
+ {
1136
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(boundingBoxStride));
1137
+ }
1138
+
1139
+ _MTL_INLINE void MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::setBoundingBoxStride(NS::UInteger boundingBoxStride)
1140
+ {
1141
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBoundingBoxStride_), boundingBoxStride);
1142
+ }
1143
+
1144
+ // property: boundingBoxCount
1145
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::boundingBoxCount() const
1146
+ {
1147
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(boundingBoxCount));
1148
+ }
1149
+
1150
+ _MTL_INLINE void MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::setBoundingBoxCount(NS::UInteger boundingBoxCount)
1151
+ {
1152
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBoundingBoxCount_), boundingBoxCount);
1153
+ }
1154
+
1155
+ // static method: descriptor
1156
+ _MTL_INLINE MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor* MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor::descriptor()
1157
+ {
1158
+ return Object::sendMessage<MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor), _MTL_PRIVATE_SEL(descriptor));
1159
+ }
1160
+
1161
+ // static method: alloc
1162
+ _MTL_INLINE MTL::AccelerationStructureCurveGeometryDescriptor* MTL::AccelerationStructureCurveGeometryDescriptor::alloc()
1163
+ {
1164
+ return NS::Object::alloc<MTL::AccelerationStructureCurveGeometryDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureCurveGeometryDescriptor));
1165
+ }
1166
+
1167
+ // method: init
1168
+ _MTL_INLINE MTL::AccelerationStructureCurveGeometryDescriptor* MTL::AccelerationStructureCurveGeometryDescriptor::init()
1169
+ {
1170
+ return NS::Object::init<MTL::AccelerationStructureCurveGeometryDescriptor>();
1171
+ }
1172
+
1173
+ // property: controlPointBuffer
1174
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureCurveGeometryDescriptor::controlPointBuffer() const
1175
+ {
1176
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(controlPointBuffer));
1177
+ }
1178
+
1179
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setControlPointBuffer(const MTL::Buffer* controlPointBuffer)
1180
+ {
1181
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointBuffer_), controlPointBuffer);
1182
+ }
1183
+
1184
+ // property: controlPointBufferOffset
1185
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::controlPointBufferOffset() const
1186
+ {
1187
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(controlPointBufferOffset));
1188
+ }
1189
+
1190
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setControlPointBufferOffset(NS::UInteger controlPointBufferOffset)
1191
+ {
1192
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointBufferOffset_), controlPointBufferOffset);
1193
+ }
1194
+
1195
+ // property: controlPointCount
1196
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::controlPointCount() const
1197
+ {
1198
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(controlPointCount));
1199
+ }
1200
+
1201
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setControlPointCount(NS::UInteger controlPointCount)
1202
+ {
1203
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointCount_), controlPointCount);
1204
+ }
1205
+
1206
+ // property: controlPointStride
1207
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::controlPointStride() const
1208
+ {
1209
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(controlPointStride));
1210
+ }
1211
+
1212
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setControlPointStride(NS::UInteger controlPointStride)
1213
+ {
1214
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointStride_), controlPointStride);
1215
+ }
1216
+
1217
+ // property: controlPointFormat
1218
+ _MTL_INLINE MTL::AttributeFormat MTL::AccelerationStructureCurveGeometryDescriptor::controlPointFormat() const
1219
+ {
1220
+ return Object::sendMessage<MTL::AttributeFormat>(this, _MTL_PRIVATE_SEL(controlPointFormat));
1221
+ }
1222
+
1223
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setControlPointFormat(MTL::AttributeFormat controlPointFormat)
1224
+ {
1225
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointFormat_), controlPointFormat);
1226
+ }
1227
+
1228
+ // property: radiusBuffer
1229
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureCurveGeometryDescriptor::radiusBuffer() const
1230
+ {
1231
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(radiusBuffer));
1232
+ }
1233
+
1234
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setRadiusBuffer(const MTL::Buffer* radiusBuffer)
1235
+ {
1236
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRadiusBuffer_), radiusBuffer);
1237
+ }
1238
+
1239
+ // property: radiusBufferOffset
1240
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::radiusBufferOffset() const
1241
+ {
1242
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(radiusBufferOffset));
1243
+ }
1244
+
1245
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setRadiusBufferOffset(NS::UInteger radiusBufferOffset)
1246
+ {
1247
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRadiusBufferOffset_), radiusBufferOffset);
1248
+ }
1249
+
1250
+ // property: radiusFormat
1251
+ _MTL_INLINE MTL::AttributeFormat MTL::AccelerationStructureCurveGeometryDescriptor::radiusFormat() const
1252
+ {
1253
+ return Object::sendMessage<MTL::AttributeFormat>(this, _MTL_PRIVATE_SEL(radiusFormat));
1254
+ }
1255
+
1256
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setRadiusFormat(MTL::AttributeFormat radiusFormat)
1257
+ {
1258
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRadiusFormat_), radiusFormat);
1259
+ }
1260
+
1261
+ // property: radiusStride
1262
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::radiusStride() const
1263
+ {
1264
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(radiusStride));
1265
+ }
1266
+
1267
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setRadiusStride(NS::UInteger radiusStride)
1268
+ {
1269
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRadiusStride_), radiusStride);
1270
+ }
1271
+
1272
+ // property: indexBuffer
1273
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureCurveGeometryDescriptor::indexBuffer() const
1274
+ {
1275
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(indexBuffer));
1276
+ }
1277
+
1278
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setIndexBuffer(const MTL::Buffer* indexBuffer)
1279
+ {
1280
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBuffer_), indexBuffer);
1281
+ }
1282
+
1283
+ // property: indexBufferOffset
1284
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::indexBufferOffset() const
1285
+ {
1286
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(indexBufferOffset));
1287
+ }
1288
+
1289
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setIndexBufferOffset(NS::UInteger indexBufferOffset)
1290
+ {
1291
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBufferOffset_), indexBufferOffset);
1292
+ }
1293
+
1294
+ // property: indexType
1295
+ _MTL_INLINE MTL::IndexType MTL::AccelerationStructureCurveGeometryDescriptor::indexType() const
1296
+ {
1297
+ return Object::sendMessage<MTL::IndexType>(this, _MTL_PRIVATE_SEL(indexType));
1298
+ }
1299
+
1300
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setIndexType(MTL::IndexType indexType)
1301
+ {
1302
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexType_), indexType);
1303
+ }
1304
+
1305
+ // property: segmentCount
1306
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::segmentCount() const
1307
+ {
1308
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(segmentCount));
1309
+ }
1310
+
1311
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setSegmentCount(NS::UInteger segmentCount)
1312
+ {
1313
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSegmentCount_), segmentCount);
1314
+ }
1315
+
1316
+ // property: segmentControlPointCount
1317
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureCurveGeometryDescriptor::segmentControlPointCount() const
1318
+ {
1319
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(segmentControlPointCount));
1320
+ }
1321
+
1322
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setSegmentControlPointCount(NS::UInteger segmentControlPointCount)
1323
+ {
1324
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSegmentControlPointCount_), segmentControlPointCount);
1325
+ }
1326
+
1327
+ // property: curveType
1328
+ _MTL_INLINE MTL::CurveType MTL::AccelerationStructureCurveGeometryDescriptor::curveType() const
1329
+ {
1330
+ return Object::sendMessage<MTL::CurveType>(this, _MTL_PRIVATE_SEL(curveType));
1331
+ }
1332
+
1333
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setCurveType(MTL::CurveType curveType)
1334
+ {
1335
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCurveType_), curveType);
1336
+ }
1337
+
1338
+ // property: curveBasis
1339
+ _MTL_INLINE MTL::CurveBasis MTL::AccelerationStructureCurveGeometryDescriptor::curveBasis() const
1340
+ {
1341
+ return Object::sendMessage<MTL::CurveBasis>(this, _MTL_PRIVATE_SEL(curveBasis));
1342
+ }
1343
+
1344
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setCurveBasis(MTL::CurveBasis curveBasis)
1345
+ {
1346
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCurveBasis_), curveBasis);
1347
+ }
1348
+
1349
+ // property: curveEndCaps
1350
+ _MTL_INLINE MTL::CurveEndCaps MTL::AccelerationStructureCurveGeometryDescriptor::curveEndCaps() const
1351
+ {
1352
+ return Object::sendMessage<MTL::CurveEndCaps>(this, _MTL_PRIVATE_SEL(curveEndCaps));
1353
+ }
1354
+
1355
+ _MTL_INLINE void MTL::AccelerationStructureCurveGeometryDescriptor::setCurveEndCaps(MTL::CurveEndCaps curveEndCaps)
1356
+ {
1357
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCurveEndCaps_), curveEndCaps);
1358
+ }
1359
+
1360
+ // static method: descriptor
1361
+ _MTL_INLINE MTL::AccelerationStructureCurveGeometryDescriptor* MTL::AccelerationStructureCurveGeometryDescriptor::descriptor()
1362
+ {
1363
+ return Object::sendMessage<MTL::AccelerationStructureCurveGeometryDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructureCurveGeometryDescriptor), _MTL_PRIVATE_SEL(descriptor));
1364
+ }
1365
+
1366
+ // static method: alloc
1367
+ _MTL_INLINE MTL::AccelerationStructureMotionCurveGeometryDescriptor* MTL::AccelerationStructureMotionCurveGeometryDescriptor::alloc()
1368
+ {
1369
+ return NS::Object::alloc<MTL::AccelerationStructureMotionCurveGeometryDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructureMotionCurveGeometryDescriptor));
1370
+ }
1371
+
1372
+ // method: init
1373
+ _MTL_INLINE MTL::AccelerationStructureMotionCurveGeometryDescriptor* MTL::AccelerationStructureMotionCurveGeometryDescriptor::init()
1374
+ {
1375
+ return NS::Object::init<MTL::AccelerationStructureMotionCurveGeometryDescriptor>();
1376
+ }
1377
+
1378
+ // property: controlPointBuffers
1379
+ _MTL_INLINE NS::Array* MTL::AccelerationStructureMotionCurveGeometryDescriptor::controlPointBuffers() const
1380
+ {
1381
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(controlPointBuffers));
1382
+ }
1383
+
1384
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setControlPointBuffers(const NS::Array* controlPointBuffers)
1385
+ {
1386
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointBuffers_), controlPointBuffers);
1387
+ }
1388
+
1389
+ // property: controlPointCount
1390
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionCurveGeometryDescriptor::controlPointCount() const
1391
+ {
1392
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(controlPointCount));
1393
+ }
1394
+
1395
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setControlPointCount(NS::UInteger controlPointCount)
1396
+ {
1397
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointCount_), controlPointCount);
1398
+ }
1399
+
1400
+ // property: controlPointStride
1401
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionCurveGeometryDescriptor::controlPointStride() const
1402
+ {
1403
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(controlPointStride));
1404
+ }
1405
+
1406
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setControlPointStride(NS::UInteger controlPointStride)
1407
+ {
1408
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointStride_), controlPointStride);
1409
+ }
1410
+
1411
+ // property: controlPointFormat
1412
+ _MTL_INLINE MTL::AttributeFormat MTL::AccelerationStructureMotionCurveGeometryDescriptor::controlPointFormat() const
1413
+ {
1414
+ return Object::sendMessage<MTL::AttributeFormat>(this, _MTL_PRIVATE_SEL(controlPointFormat));
1415
+ }
1416
+
1417
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setControlPointFormat(MTL::AttributeFormat controlPointFormat)
1418
+ {
1419
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlPointFormat_), controlPointFormat);
1420
+ }
1421
+
1422
+ // property: radiusBuffers
1423
+ _MTL_INLINE NS::Array* MTL::AccelerationStructureMotionCurveGeometryDescriptor::radiusBuffers() const
1424
+ {
1425
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(radiusBuffers));
1426
+ }
1427
+
1428
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setRadiusBuffers(const NS::Array* radiusBuffers)
1429
+ {
1430
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRadiusBuffers_), radiusBuffers);
1431
+ }
1432
+
1433
+ // property: radiusFormat
1434
+ _MTL_INLINE MTL::AttributeFormat MTL::AccelerationStructureMotionCurveGeometryDescriptor::radiusFormat() const
1435
+ {
1436
+ return Object::sendMessage<MTL::AttributeFormat>(this, _MTL_PRIVATE_SEL(radiusFormat));
1437
+ }
1438
+
1439
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setRadiusFormat(MTL::AttributeFormat radiusFormat)
1440
+ {
1441
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRadiusFormat_), radiusFormat);
1442
+ }
1443
+
1444
+ // property: radiusStride
1445
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionCurveGeometryDescriptor::radiusStride() const
1446
+ {
1447
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(radiusStride));
1448
+ }
1449
+
1450
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setRadiusStride(NS::UInteger radiusStride)
1451
+ {
1452
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRadiusStride_), radiusStride);
1453
+ }
1454
+
1455
+ // property: indexBuffer
1456
+ _MTL_INLINE MTL::Buffer* MTL::AccelerationStructureMotionCurveGeometryDescriptor::indexBuffer() const
1457
+ {
1458
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(indexBuffer));
1459
+ }
1460
+
1461
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setIndexBuffer(const MTL::Buffer* indexBuffer)
1462
+ {
1463
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBuffer_), indexBuffer);
1464
+ }
1465
+
1466
+ // property: indexBufferOffset
1467
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionCurveGeometryDescriptor::indexBufferOffset() const
1468
+ {
1469
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(indexBufferOffset));
1470
+ }
1471
+
1472
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setIndexBufferOffset(NS::UInteger indexBufferOffset)
1473
+ {
1474
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexBufferOffset_), indexBufferOffset);
1475
+ }
1476
+
1477
+ // property: indexType
1478
+ _MTL_INLINE MTL::IndexType MTL::AccelerationStructureMotionCurveGeometryDescriptor::indexType() const
1479
+ {
1480
+ return Object::sendMessage<MTL::IndexType>(this, _MTL_PRIVATE_SEL(indexType));
1481
+ }
1482
+
1483
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setIndexType(MTL::IndexType indexType)
1484
+ {
1485
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndexType_), indexType);
1486
+ }
1487
+
1488
+ // property: segmentCount
1489
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionCurveGeometryDescriptor::segmentCount() const
1490
+ {
1491
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(segmentCount));
1492
+ }
1493
+
1494
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setSegmentCount(NS::UInteger segmentCount)
1495
+ {
1496
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSegmentCount_), segmentCount);
1497
+ }
1498
+
1499
+ // property: segmentControlPointCount
1500
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructureMotionCurveGeometryDescriptor::segmentControlPointCount() const
1501
+ {
1502
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(segmentControlPointCount));
1503
+ }
1504
+
1505
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setSegmentControlPointCount(NS::UInteger segmentControlPointCount)
1506
+ {
1507
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSegmentControlPointCount_), segmentControlPointCount);
1508
+ }
1509
+
1510
+ // property: curveType
1511
+ _MTL_INLINE MTL::CurveType MTL::AccelerationStructureMotionCurveGeometryDescriptor::curveType() const
1512
+ {
1513
+ return Object::sendMessage<MTL::CurveType>(this, _MTL_PRIVATE_SEL(curveType));
1514
+ }
1515
+
1516
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setCurveType(MTL::CurveType curveType)
1517
+ {
1518
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCurveType_), curveType);
1519
+ }
1520
+
1521
+ // property: curveBasis
1522
+ _MTL_INLINE MTL::CurveBasis MTL::AccelerationStructureMotionCurveGeometryDescriptor::curveBasis() const
1523
+ {
1524
+ return Object::sendMessage<MTL::CurveBasis>(this, _MTL_PRIVATE_SEL(curveBasis));
1525
+ }
1526
+
1527
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setCurveBasis(MTL::CurveBasis curveBasis)
1528
+ {
1529
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCurveBasis_), curveBasis);
1530
+ }
1531
+
1532
+ // property: curveEndCaps
1533
+ _MTL_INLINE MTL::CurveEndCaps MTL::AccelerationStructureMotionCurveGeometryDescriptor::curveEndCaps() const
1534
+ {
1535
+ return Object::sendMessage<MTL::CurveEndCaps>(this, _MTL_PRIVATE_SEL(curveEndCaps));
1536
+ }
1537
+
1538
+ _MTL_INLINE void MTL::AccelerationStructureMotionCurveGeometryDescriptor::setCurveEndCaps(MTL::CurveEndCaps curveEndCaps)
1539
+ {
1540
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCurveEndCaps_), curveEndCaps);
1541
+ }
1542
+
1543
+ // static method: descriptor
1544
+ _MTL_INLINE MTL::AccelerationStructureMotionCurveGeometryDescriptor* MTL::AccelerationStructureMotionCurveGeometryDescriptor::descriptor()
1545
+ {
1546
+ return Object::sendMessage<MTL::AccelerationStructureMotionCurveGeometryDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructureMotionCurveGeometryDescriptor), _MTL_PRIVATE_SEL(descriptor));
1547
+ }
1548
+
1549
+ // static method: alloc
1550
+ _MTL_INLINE MTL::InstanceAccelerationStructureDescriptor* MTL::InstanceAccelerationStructureDescriptor::alloc()
1551
+ {
1552
+ return NS::Object::alloc<MTL::InstanceAccelerationStructureDescriptor>(_MTL_PRIVATE_CLS(MTLInstanceAccelerationStructureDescriptor));
1553
+ }
1554
+
1555
+ // method: init
1556
+ _MTL_INLINE MTL::InstanceAccelerationStructureDescriptor* MTL::InstanceAccelerationStructureDescriptor::init()
1557
+ {
1558
+ return NS::Object::init<MTL::InstanceAccelerationStructureDescriptor>();
1559
+ }
1560
+
1561
+ // property: instanceDescriptorBuffer
1562
+ _MTL_INLINE MTL::Buffer* MTL::InstanceAccelerationStructureDescriptor::instanceDescriptorBuffer() const
1563
+ {
1564
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(instanceDescriptorBuffer));
1565
+ }
1566
+
1567
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setInstanceDescriptorBuffer(const MTL::Buffer* instanceDescriptorBuffer)
1568
+ {
1569
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorBuffer_), instanceDescriptorBuffer);
1570
+ }
1571
+
1572
+ // property: instanceDescriptorBufferOffset
1573
+ _MTL_INLINE NS::UInteger MTL::InstanceAccelerationStructureDescriptor::instanceDescriptorBufferOffset() const
1574
+ {
1575
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(instanceDescriptorBufferOffset));
1576
+ }
1577
+
1578
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setInstanceDescriptorBufferOffset(NS::UInteger instanceDescriptorBufferOffset)
1579
+ {
1580
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorBufferOffset_), instanceDescriptorBufferOffset);
1581
+ }
1582
+
1583
+ // property: instanceDescriptorStride
1584
+ _MTL_INLINE NS::UInteger MTL::InstanceAccelerationStructureDescriptor::instanceDescriptorStride() const
1585
+ {
1586
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(instanceDescriptorStride));
1587
+ }
1588
+
1589
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setInstanceDescriptorStride(NS::UInteger instanceDescriptorStride)
1590
+ {
1591
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorStride_), instanceDescriptorStride);
1592
+ }
1593
+
1594
+ // property: instanceCount
1595
+ _MTL_INLINE NS::UInteger MTL::InstanceAccelerationStructureDescriptor::instanceCount() const
1596
+ {
1597
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(instanceCount));
1598
+ }
1599
+
1600
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setInstanceCount(NS::UInteger instanceCount)
1601
+ {
1602
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceCount_), instanceCount);
1603
+ }
1604
+
1605
+ // property: instancedAccelerationStructures
1606
+ _MTL_INLINE NS::Array* MTL::InstanceAccelerationStructureDescriptor::instancedAccelerationStructures() const
1607
+ {
1608
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(instancedAccelerationStructures));
1609
+ }
1610
+
1611
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setInstancedAccelerationStructures(const NS::Array* instancedAccelerationStructures)
1612
+ {
1613
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstancedAccelerationStructures_), instancedAccelerationStructures);
1614
+ }
1615
+
1616
+ // property: instanceDescriptorType
1617
+ _MTL_INLINE MTL::AccelerationStructureInstanceDescriptorType MTL::InstanceAccelerationStructureDescriptor::instanceDescriptorType() const
1618
+ {
1619
+ return Object::sendMessage<MTL::AccelerationStructureInstanceDescriptorType>(this, _MTL_PRIVATE_SEL(instanceDescriptorType));
1620
+ }
1621
+
1622
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setInstanceDescriptorType(MTL::AccelerationStructureInstanceDescriptorType instanceDescriptorType)
1623
+ {
1624
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorType_), instanceDescriptorType);
1625
+ }
1626
+
1627
+ // property: motionTransformBuffer
1628
+ _MTL_INLINE MTL::Buffer* MTL::InstanceAccelerationStructureDescriptor::motionTransformBuffer() const
1629
+ {
1630
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(motionTransformBuffer));
1631
+ }
1632
+
1633
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setMotionTransformBuffer(const MTL::Buffer* motionTransformBuffer)
1634
+ {
1635
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionTransformBuffer_), motionTransformBuffer);
1636
+ }
1637
+
1638
+ // property: motionTransformBufferOffset
1639
+ _MTL_INLINE NS::UInteger MTL::InstanceAccelerationStructureDescriptor::motionTransformBufferOffset() const
1640
+ {
1641
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(motionTransformBufferOffset));
1642
+ }
1643
+
1644
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setMotionTransformBufferOffset(NS::UInteger motionTransformBufferOffset)
1645
+ {
1646
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionTransformBufferOffset_), motionTransformBufferOffset);
1647
+ }
1648
+
1649
+ // property: motionTransformCount
1650
+ _MTL_INLINE NS::UInteger MTL::InstanceAccelerationStructureDescriptor::motionTransformCount() const
1651
+ {
1652
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(motionTransformCount));
1653
+ }
1654
+
1655
+ _MTL_INLINE void MTL::InstanceAccelerationStructureDescriptor::setMotionTransformCount(NS::UInteger motionTransformCount)
1656
+ {
1657
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionTransformCount_), motionTransformCount);
1658
+ }
1659
+
1660
+ // static method: descriptor
1661
+ _MTL_INLINE MTL::InstanceAccelerationStructureDescriptor* MTL::InstanceAccelerationStructureDescriptor::descriptor()
1662
+ {
1663
+ return Object::sendMessage<MTL::InstanceAccelerationStructureDescriptor*>(_MTL_PRIVATE_CLS(MTLInstanceAccelerationStructureDescriptor), _MTL_PRIVATE_SEL(descriptor));
1664
+ }
1665
+
1666
+ // static method: alloc
1667
+ _MTL_INLINE MTL::IndirectInstanceAccelerationStructureDescriptor* MTL::IndirectInstanceAccelerationStructureDescriptor::alloc()
1668
+ {
1669
+ return NS::Object::alloc<MTL::IndirectInstanceAccelerationStructureDescriptor>(_MTL_PRIVATE_CLS(MTLIndirectInstanceAccelerationStructureDescriptor));
1670
+ }
1671
+
1672
+ // method: init
1673
+ _MTL_INLINE MTL::IndirectInstanceAccelerationStructureDescriptor* MTL::IndirectInstanceAccelerationStructureDescriptor::init()
1674
+ {
1675
+ return NS::Object::init<MTL::IndirectInstanceAccelerationStructureDescriptor>();
1676
+ }
1677
+
1678
+ // property: instanceDescriptorBuffer
1679
+ _MTL_INLINE MTL::Buffer* MTL::IndirectInstanceAccelerationStructureDescriptor::instanceDescriptorBuffer() const
1680
+ {
1681
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(instanceDescriptorBuffer));
1682
+ }
1683
+
1684
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setInstanceDescriptorBuffer(const MTL::Buffer* instanceDescriptorBuffer)
1685
+ {
1686
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorBuffer_), instanceDescriptorBuffer);
1687
+ }
1688
+
1689
+ // property: instanceDescriptorBufferOffset
1690
+ _MTL_INLINE NS::UInteger MTL::IndirectInstanceAccelerationStructureDescriptor::instanceDescriptorBufferOffset() const
1691
+ {
1692
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(instanceDescriptorBufferOffset));
1693
+ }
1694
+
1695
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setInstanceDescriptorBufferOffset(NS::UInteger instanceDescriptorBufferOffset)
1696
+ {
1697
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorBufferOffset_), instanceDescriptorBufferOffset);
1698
+ }
1699
+
1700
+ // property: instanceDescriptorStride
1701
+ _MTL_INLINE NS::UInteger MTL::IndirectInstanceAccelerationStructureDescriptor::instanceDescriptorStride() const
1702
+ {
1703
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(instanceDescriptorStride));
1704
+ }
1705
+
1706
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setInstanceDescriptorStride(NS::UInteger instanceDescriptorStride)
1707
+ {
1708
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorStride_), instanceDescriptorStride);
1709
+ }
1710
+
1711
+ // property: maxInstanceCount
1712
+ _MTL_INLINE NS::UInteger MTL::IndirectInstanceAccelerationStructureDescriptor::maxInstanceCount() const
1713
+ {
1714
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxInstanceCount));
1715
+ }
1716
+
1717
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setMaxInstanceCount(NS::UInteger maxInstanceCount)
1718
+ {
1719
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxInstanceCount_), maxInstanceCount);
1720
+ }
1721
+
1722
+ // property: instanceCountBuffer
1723
+ _MTL_INLINE MTL::Buffer* MTL::IndirectInstanceAccelerationStructureDescriptor::instanceCountBuffer() const
1724
+ {
1725
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(instanceCountBuffer));
1726
+ }
1727
+
1728
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setInstanceCountBuffer(const MTL::Buffer* instanceCountBuffer)
1729
+ {
1730
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceCountBuffer_), instanceCountBuffer);
1731
+ }
1732
+
1733
+ // property: instanceCountBufferOffset
1734
+ _MTL_INLINE NS::UInteger MTL::IndirectInstanceAccelerationStructureDescriptor::instanceCountBufferOffset() const
1735
+ {
1736
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(instanceCountBufferOffset));
1737
+ }
1738
+
1739
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setInstanceCountBufferOffset(NS::UInteger instanceCountBufferOffset)
1740
+ {
1741
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceCountBufferOffset_), instanceCountBufferOffset);
1742
+ }
1743
+
1744
+ // property: instanceDescriptorType
1745
+ _MTL_INLINE MTL::AccelerationStructureInstanceDescriptorType MTL::IndirectInstanceAccelerationStructureDescriptor::instanceDescriptorType() const
1746
+ {
1747
+ return Object::sendMessage<MTL::AccelerationStructureInstanceDescriptorType>(this, _MTL_PRIVATE_SEL(instanceDescriptorType));
1748
+ }
1749
+
1750
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setInstanceDescriptorType(MTL::AccelerationStructureInstanceDescriptorType instanceDescriptorType)
1751
+ {
1752
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstanceDescriptorType_), instanceDescriptorType);
1753
+ }
1754
+
1755
+ // property: motionTransformBuffer
1756
+ _MTL_INLINE MTL::Buffer* MTL::IndirectInstanceAccelerationStructureDescriptor::motionTransformBuffer() const
1757
+ {
1758
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(motionTransformBuffer));
1759
+ }
1760
+
1761
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setMotionTransformBuffer(const MTL::Buffer* motionTransformBuffer)
1762
+ {
1763
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionTransformBuffer_), motionTransformBuffer);
1764
+ }
1765
+
1766
+ // property: motionTransformBufferOffset
1767
+ _MTL_INLINE NS::UInteger MTL::IndirectInstanceAccelerationStructureDescriptor::motionTransformBufferOffset() const
1768
+ {
1769
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(motionTransformBufferOffset));
1770
+ }
1771
+
1772
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setMotionTransformBufferOffset(NS::UInteger motionTransformBufferOffset)
1773
+ {
1774
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionTransformBufferOffset_), motionTransformBufferOffset);
1775
+ }
1776
+
1777
+ // property: maxMotionTransformCount
1778
+ _MTL_INLINE NS::UInteger MTL::IndirectInstanceAccelerationStructureDescriptor::maxMotionTransformCount() const
1779
+ {
1780
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxMotionTransformCount));
1781
+ }
1782
+
1783
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setMaxMotionTransformCount(NS::UInteger maxMotionTransformCount)
1784
+ {
1785
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxMotionTransformCount_), maxMotionTransformCount);
1786
+ }
1787
+
1788
+ // property: motionTransformCountBuffer
1789
+ _MTL_INLINE MTL::Buffer* MTL::IndirectInstanceAccelerationStructureDescriptor::motionTransformCountBuffer() const
1790
+ {
1791
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(motionTransformCountBuffer));
1792
+ }
1793
+
1794
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setMotionTransformCountBuffer(const MTL::Buffer* motionTransformCountBuffer)
1795
+ {
1796
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionTransformCountBuffer_), motionTransformCountBuffer);
1797
+ }
1798
+
1799
+ // property: motionTransformCountBufferOffset
1800
+ _MTL_INLINE NS::UInteger MTL::IndirectInstanceAccelerationStructureDescriptor::motionTransformCountBufferOffset() const
1801
+ {
1802
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(motionTransformCountBufferOffset));
1803
+ }
1804
+
1805
+ _MTL_INLINE void MTL::IndirectInstanceAccelerationStructureDescriptor::setMotionTransformCountBufferOffset(NS::UInteger motionTransformCountBufferOffset)
1806
+ {
1807
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMotionTransformCountBufferOffset_), motionTransformCountBufferOffset);
1808
+ }
1809
+
1810
+ // static method: descriptor
1811
+ _MTL_INLINE MTL::IndirectInstanceAccelerationStructureDescriptor* MTL::IndirectInstanceAccelerationStructureDescriptor::descriptor()
1812
+ {
1813
+ return Object::sendMessage<MTL::IndirectInstanceAccelerationStructureDescriptor*>(_MTL_PRIVATE_CLS(MTLIndirectInstanceAccelerationStructureDescriptor), _MTL_PRIVATE_SEL(descriptor));
1814
+ }
1815
+
1816
+ // property: size
1817
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructure::size() const
1818
+ {
1819
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
1820
+ }
1821
+
1822
+ // property: gpuResourceID
1823
+ _MTL_INLINE MTL::ResourceID MTL::AccelerationStructure::gpuResourceID() const
1824
+ {
1825
+ return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
1826
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLAccelerationStructureCommandEncoder.hpp ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLAccelerationStructureCommandEncoder.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLAccelerationStructureCommandEncoder.hpp"
30
+ #include "MTLArgument.hpp"
31
+ #include "MTLCommandEncoder.hpp"
32
+
33
+ namespace MTL
34
+ {
35
+ _MTL_OPTIONS(NS::UInteger, AccelerationStructureRefitOptions) {
36
+ AccelerationStructureRefitOptionVertexData = 1,
37
+ AccelerationStructureRefitOptionPerPrimitiveData = 2,
38
+ };
39
+
40
+ class AccelerationStructureCommandEncoder : public NS::Referencing<AccelerationStructureCommandEncoder, CommandEncoder>
41
+ {
42
+ public:
43
+ void buildAccelerationStructure(const class AccelerationStructure* accelerationStructure, const class AccelerationStructureDescriptor* descriptor, const class Buffer* scratchBuffer, NS::UInteger scratchBufferOffset);
44
+
45
+ void refitAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructureDescriptor* descriptor, const class AccelerationStructure* destinationAccelerationStructure, const class Buffer* scratchBuffer, NS::UInteger scratchBufferOffset);
46
+
47
+ void refitAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructureDescriptor* descriptor, const class AccelerationStructure* destinationAccelerationStructure, const class Buffer* scratchBuffer, NS::UInteger scratchBufferOffset, MTL::AccelerationStructureRefitOptions options);
48
+
49
+ void copyAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructure* destinationAccelerationStructure);
50
+
51
+ void writeCompactedAccelerationStructureSize(const class AccelerationStructure* accelerationStructure, const class Buffer* buffer, NS::UInteger offset);
52
+
53
+ void writeCompactedAccelerationStructureSize(const class AccelerationStructure* accelerationStructure, const class Buffer* buffer, NS::UInteger offset, MTL::DataType sizeDataType);
54
+
55
+ void copyAndCompactAccelerationStructure(const class AccelerationStructure* sourceAccelerationStructure, const class AccelerationStructure* destinationAccelerationStructure);
56
+
57
+ void updateFence(const class Fence* fence);
58
+
59
+ void waitForFence(const class Fence* fence);
60
+
61
+ void useResource(const class Resource* resource, MTL::ResourceUsage usage);
62
+
63
+ void useResources(const class Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);
64
+
65
+ void useHeap(const class Heap* heap);
66
+
67
+ void useHeaps(const class Heap* const heaps[], NS::UInteger count);
68
+
69
+ void sampleCountersInBuffer(const class CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
70
+ };
71
+
72
+ class AccelerationStructurePassSampleBufferAttachmentDescriptor : public NS::Copying<AccelerationStructurePassSampleBufferAttachmentDescriptor>
73
+ {
74
+ public:
75
+ static class AccelerationStructurePassSampleBufferAttachmentDescriptor* alloc();
76
+
77
+ class AccelerationStructurePassSampleBufferAttachmentDescriptor* init();
78
+
79
+ class CounterSampleBuffer* sampleBuffer() const;
80
+ void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
81
+
82
+ NS::UInteger startOfEncoderSampleIndex() const;
83
+ void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
84
+
85
+ NS::UInteger endOfEncoderSampleIndex() const;
86
+ void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
87
+ };
88
+
89
+ class AccelerationStructurePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<AccelerationStructurePassSampleBufferAttachmentDescriptorArray>
90
+ {
91
+ public:
92
+ static class AccelerationStructurePassSampleBufferAttachmentDescriptorArray* alloc();
93
+
94
+ class AccelerationStructurePassSampleBufferAttachmentDescriptorArray* init();
95
+
96
+ class AccelerationStructurePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
97
+
98
+ void setObject(const class AccelerationStructurePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
99
+ };
100
+
101
+ class AccelerationStructurePassDescriptor : public NS::Copying<AccelerationStructurePassDescriptor>
102
+ {
103
+ public:
104
+ static class AccelerationStructurePassDescriptor* alloc();
105
+
106
+ class AccelerationStructurePassDescriptor* init();
107
+
108
+ static class AccelerationStructurePassDescriptor* accelerationStructurePassDescriptor();
109
+
110
+ class AccelerationStructurePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
111
+ };
112
+
113
+ }
114
+
115
+ // method: buildAccelerationStructure:descriptor:scratchBuffer:scratchBufferOffset:
116
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::buildAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset)
117
+ {
118
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(buildAccelerationStructure_descriptor_scratchBuffer_scratchBufferOffset_), accelerationStructure, descriptor, scratchBuffer, scratchBufferOffset);
119
+ }
120
+
121
+ // method: refitAccelerationStructure:descriptor:destination:scratchBuffer:scratchBufferOffset:
122
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset)
123
+ {
124
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_), sourceAccelerationStructure, descriptor, destinationAccelerationStructure, scratchBuffer, scratchBufferOffset);
125
+ }
126
+
127
+ // method: refitAccelerationStructure:descriptor:destination:scratchBuffer:scratchBufferOffset:options:
128
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset, MTL::AccelerationStructureRefitOptions options)
129
+ {
130
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_options_), sourceAccelerationStructure, descriptor, destinationAccelerationStructure, scratchBuffer, scratchBufferOffset, options);
131
+ }
132
+
133
+ // method: copyAccelerationStructure:toAccelerationStructure:
134
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::copyAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure)
135
+ {
136
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyAccelerationStructure_toAccelerationStructure_), sourceAccelerationStructure, destinationAccelerationStructure);
137
+ }
138
+
139
+ // method: writeCompactedAccelerationStructureSize:toBuffer:offset:
140
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset)
141
+ {
142
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeCompactedAccelerationStructureSize_toBuffer_offset_), accelerationStructure, buffer, offset);
143
+ }
144
+
145
+ // method: writeCompactedAccelerationStructureSize:toBuffer:offset:sizeDataType:
146
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset, MTL::DataType sizeDataType)
147
+ {
148
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(writeCompactedAccelerationStructureSize_toBuffer_offset_sizeDataType_), accelerationStructure, buffer, offset, sizeDataType);
149
+ }
150
+
151
+ // method: copyAndCompactAccelerationStructure:toAccelerationStructure:
152
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::copyAndCompactAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure)
153
+ {
154
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyAndCompactAccelerationStructure_toAccelerationStructure_), sourceAccelerationStructure, destinationAccelerationStructure);
155
+ }
156
+
157
+ // method: updateFence:
158
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::updateFence(const MTL::Fence* fence)
159
+ {
160
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
161
+ }
162
+
163
+ // method: waitForFence:
164
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::waitForFence(const MTL::Fence* fence)
165
+ {
166
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
167
+ }
168
+
169
+ // method: useResource:usage:
170
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useResource(const MTL::Resource* resource, MTL::ResourceUsage usage)
171
+ {
172
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResource_usage_), resource, usage);
173
+ }
174
+
175
+ // method: useResources:count:usage:
176
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage)
177
+ {
178
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResources_count_usage_), resources, count, usage);
179
+ }
180
+
181
+ // method: useHeap:
182
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useHeap(const MTL::Heap* heap)
183
+ {
184
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeap_), heap);
185
+ }
186
+
187
+ // method: useHeaps:count:
188
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::useHeaps(const MTL::Heap* const heaps[], NS::UInteger count)
189
+ {
190
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeaps_count_), heaps, count);
191
+ }
192
+
193
+ // method: sampleCountersInBuffer:atSampleIndex:withBarrier:
194
+ _MTL_INLINE void MTL::AccelerationStructureCommandEncoder::sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier)
195
+ {
196
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleCountersInBuffer_atSampleIndex_withBarrier_), sampleBuffer, sampleIndex, barrier);
197
+ }
198
+
199
+ // static method: alloc
200
+ _MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::alloc()
201
+ {
202
+ return NS::Object::alloc<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassSampleBufferAttachmentDescriptor));
203
+ }
204
+
205
+ // method: init
206
+ _MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::init()
207
+ {
208
+ return NS::Object::init<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor>();
209
+ }
210
+
211
+ // property: sampleBuffer
212
+ _MTL_INLINE MTL::CounterSampleBuffer* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::sampleBuffer() const
213
+ {
214
+ return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
215
+ }
216
+
217
+ _MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
218
+ {
219
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
220
+ }
221
+
222
+ // property: startOfEncoderSampleIndex
223
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
224
+ {
225
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
226
+ }
227
+
228
+ _MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
229
+ {
230
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
231
+ }
232
+
233
+ // property: endOfEncoderSampleIndex
234
+ _MTL_INLINE NS::UInteger MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
235
+ {
236
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
237
+ }
238
+
239
+ _MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
240
+ {
241
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
242
+ }
243
+
244
+ // static method: alloc
245
+ _MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::alloc()
246
+ {
247
+ return NS::Object::alloc<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray));
248
+ }
249
+
250
+ // method: init
251
+ _MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::init()
252
+ {
253
+ return NS::Object::init<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray>();
254
+ }
255
+
256
+ // method: objectAtIndexedSubscript:
257
+ _MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
258
+ {
259
+ return Object::sendMessage<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
260
+ }
261
+
262
+ // method: setObject:atIndexedSubscript:
263
+ _MTL_INLINE void MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
264
+ {
265
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
266
+ }
267
+
268
+ // static method: alloc
269
+ _MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::alloc()
270
+ {
271
+ return NS::Object::alloc<MTL::AccelerationStructurePassDescriptor>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassDescriptor));
272
+ }
273
+
274
+ // method: init
275
+ _MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::init()
276
+ {
277
+ return NS::Object::init<MTL::AccelerationStructurePassDescriptor>();
278
+ }
279
+
280
+ // static method: accelerationStructurePassDescriptor
281
+ _MTL_INLINE MTL::AccelerationStructurePassDescriptor* MTL::AccelerationStructurePassDescriptor::accelerationStructurePassDescriptor()
282
+ {
283
+ return Object::sendMessage<MTL::AccelerationStructurePassDescriptor*>(_MTL_PRIVATE_CLS(MTLAccelerationStructurePassDescriptor), _MTL_PRIVATE_SEL(accelerationStructurePassDescriptor));
284
+ }
285
+
286
+ // property: sampleBufferAttachments
287
+ _MTL_INLINE MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray* MTL::AccelerationStructurePassDescriptor::sampleBufferAttachments() const
288
+ {
289
+ return Object::sendMessage<MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
290
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLAccelerationStructureTypes.hpp ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLAccelerationStructureTypes.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "MTLDefines.hpp"
26
+ #include "MTLPrivate.hpp"
27
+ #include "MTLResource.hpp"
28
+ #include "MTLStageInputOutputDescriptor.hpp"
29
+
30
+ #include "../Foundation/NSRange.hpp"
31
+
32
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
33
+
34
+ namespace MTL
35
+ {
36
+ struct PackedFloat3
37
+ {
38
+ PackedFloat3();
39
+ PackedFloat3(float x, float y, float z);
40
+
41
+ float& operator[](int idx);
42
+ float operator[](int idx) const;
43
+
44
+ union
45
+ {
46
+ struct
47
+ {
48
+ float x;
49
+ float y;
50
+ float z;
51
+ };
52
+
53
+ float elements[3];
54
+ };
55
+ } _MTL_PACKED;
56
+
57
+ struct PackedFloat4x3
58
+ {
59
+ PackedFloat4x3();
60
+ PackedFloat4x3(const PackedFloat3& col0, const PackedFloat3& col1, const PackedFloat3& col2, const PackedFloat3& col3);
61
+
62
+ PackedFloat3& operator[](int idx);
63
+ const PackedFloat3& operator[](int idx) const;
64
+
65
+ PackedFloat3 columns[4];
66
+ } _MTL_PACKED;
67
+
68
+ struct AxisAlignedBoundingBox
69
+ {
70
+ AxisAlignedBoundingBox();
71
+ AxisAlignedBoundingBox(PackedFloat3 p);
72
+ AxisAlignedBoundingBox(PackedFloat3 min, PackedFloat3 max);
73
+
74
+ PackedFloat3 min;
75
+ PackedFloat3 max;
76
+ } _MTL_PACKED;
77
+ }
78
+
79
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
80
+
81
+ _MTL_INLINE MTL::PackedFloat3::PackedFloat3()
82
+ : x(0.0f)
83
+ , y(0.0f)
84
+ , z(0.0f)
85
+ {
86
+ }
87
+
88
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
89
+
90
+ _MTL_INLINE MTL::PackedFloat3::PackedFloat3(float _x, float _y, float _z)
91
+ : x(_x)
92
+ , y(_y)
93
+ , z(_z)
94
+ {
95
+ }
96
+
97
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
98
+
99
+ _MTL_INLINE float& MTL::PackedFloat3::operator[](int idx)
100
+ {
101
+ return elements[idx];
102
+ }
103
+
104
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
105
+
106
+ _MTL_INLINE float MTL::PackedFloat3::operator[](int idx) const
107
+ {
108
+ return elements[idx];
109
+ }
110
+
111
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
112
+
113
+ _MTL_INLINE MTL::PackedFloat4x3::PackedFloat4x3()
114
+ {
115
+ columns[0] = PackedFloat3(0.0f, 0.0f, 0.0f);
116
+ columns[1] = PackedFloat3(0.0f, 0.0f, 0.0f);
117
+ columns[2] = PackedFloat3(0.0f, 0.0f, 0.0f);
118
+ columns[3] = PackedFloat3(0.0f, 0.0f, 0.0f);
119
+ }
120
+
121
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
122
+
123
+ _MTL_INLINE MTL::PackedFloat4x3::PackedFloat4x3(const PackedFloat3& col0, const PackedFloat3& col1, const PackedFloat3& col2, const PackedFloat3& col3)
124
+ {
125
+ columns[0] = col0;
126
+ columns[1] = col1;
127
+ columns[2] = col2;
128
+ columns[3] = col3;
129
+ }
130
+
131
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
132
+
133
+ _MTL_INLINE MTL::PackedFloat3& MTL::PackedFloat4x3::operator[](int idx)
134
+ {
135
+ return columns[idx];
136
+ }
137
+
138
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
139
+
140
+ _MTL_INLINE const MTL::PackedFloat3& MTL::PackedFloat4x3::operator[](int idx) const
141
+ {
142
+ return columns[idx];
143
+ }
144
+
145
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
146
+
147
+ _MTL_INLINE MTL::AxisAlignedBoundingBox::AxisAlignedBoundingBox()
148
+ : min(INFINITY, INFINITY, INFINITY)
149
+ , max(-INFINITY, -INFINITY, -INFINITY)
150
+ {
151
+ }
152
+
153
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
154
+
155
+ _MTL_INLINE MTL::AxisAlignedBoundingBox::AxisAlignedBoundingBox(PackedFloat3 p)
156
+ : min(p)
157
+ , max(p)
158
+ {
159
+ }
160
+
161
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
162
+
163
+ _MTL_INLINE MTL::AxisAlignedBoundingBox::AxisAlignedBoundingBox(PackedFloat3 _min, PackedFloat3 _max)
164
+ : min(_min)
165
+ , max(_max)
166
+ {
167
+ }
168
+
169
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLArgument.hpp ADDED
@@ -0,0 +1,848 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLArgument.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLArgument.hpp"
30
+ #include "MTLTexture.hpp"
31
+
32
+ namespace MTL
33
+ {
34
+ _MTL_ENUM(NS::UInteger, DataType) {
35
+ DataTypeNone = 0,
36
+ DataTypeStruct = 1,
37
+ DataTypeArray = 2,
38
+ DataTypeFloat = 3,
39
+ DataTypeFloat2 = 4,
40
+ DataTypeFloat3 = 5,
41
+ DataTypeFloat4 = 6,
42
+ DataTypeFloat2x2 = 7,
43
+ DataTypeFloat2x3 = 8,
44
+ DataTypeFloat2x4 = 9,
45
+ DataTypeFloat3x2 = 10,
46
+ DataTypeFloat3x3 = 11,
47
+ DataTypeFloat3x4 = 12,
48
+ DataTypeFloat4x2 = 13,
49
+ DataTypeFloat4x3 = 14,
50
+ DataTypeFloat4x4 = 15,
51
+ DataTypeHalf = 16,
52
+ DataTypeHalf2 = 17,
53
+ DataTypeHalf3 = 18,
54
+ DataTypeHalf4 = 19,
55
+ DataTypeHalf2x2 = 20,
56
+ DataTypeHalf2x3 = 21,
57
+ DataTypeHalf2x4 = 22,
58
+ DataTypeHalf3x2 = 23,
59
+ DataTypeHalf3x3 = 24,
60
+ DataTypeHalf3x4 = 25,
61
+ DataTypeHalf4x2 = 26,
62
+ DataTypeHalf4x3 = 27,
63
+ DataTypeHalf4x4 = 28,
64
+ DataTypeInt = 29,
65
+ DataTypeInt2 = 30,
66
+ DataTypeInt3 = 31,
67
+ DataTypeInt4 = 32,
68
+ DataTypeUInt = 33,
69
+ DataTypeUInt2 = 34,
70
+ DataTypeUInt3 = 35,
71
+ DataTypeUInt4 = 36,
72
+ DataTypeShort = 37,
73
+ DataTypeShort2 = 38,
74
+ DataTypeShort3 = 39,
75
+ DataTypeShort4 = 40,
76
+ DataTypeUShort = 41,
77
+ DataTypeUShort2 = 42,
78
+ DataTypeUShort3 = 43,
79
+ DataTypeUShort4 = 44,
80
+ DataTypeChar = 45,
81
+ DataTypeChar2 = 46,
82
+ DataTypeChar3 = 47,
83
+ DataTypeChar4 = 48,
84
+ DataTypeUChar = 49,
85
+ DataTypeUChar2 = 50,
86
+ DataTypeUChar3 = 51,
87
+ DataTypeUChar4 = 52,
88
+ DataTypeBool = 53,
89
+ DataTypeBool2 = 54,
90
+ DataTypeBool3 = 55,
91
+ DataTypeBool4 = 56,
92
+ DataTypeTexture = 58,
93
+ DataTypeSampler = 59,
94
+ DataTypePointer = 60,
95
+ DataTypeR8Unorm = 62,
96
+ DataTypeR8Snorm = 63,
97
+ DataTypeR16Unorm = 64,
98
+ DataTypeR16Snorm = 65,
99
+ DataTypeRG8Unorm = 66,
100
+ DataTypeRG8Snorm = 67,
101
+ DataTypeRG16Unorm = 68,
102
+ DataTypeRG16Snorm = 69,
103
+ DataTypeRGBA8Unorm = 70,
104
+ DataTypeRGBA8Unorm_sRGB = 71,
105
+ DataTypeRGBA8Snorm = 72,
106
+ DataTypeRGBA16Unorm = 73,
107
+ DataTypeRGBA16Snorm = 74,
108
+ DataTypeRGB10A2Unorm = 75,
109
+ DataTypeRG11B10Float = 76,
110
+ DataTypeRGB9E5Float = 77,
111
+ DataTypeRenderPipeline = 78,
112
+ DataTypeComputePipeline = 79,
113
+ DataTypeIndirectCommandBuffer = 80,
114
+ DataTypeLong = 81,
115
+ DataTypeLong2 = 82,
116
+ DataTypeLong3 = 83,
117
+ DataTypeLong4 = 84,
118
+ DataTypeULong = 85,
119
+ DataTypeULong2 = 86,
120
+ DataTypeULong3 = 87,
121
+ DataTypeULong4 = 88,
122
+ DataTypeVisibleFunctionTable = 115,
123
+ DataTypeIntersectionFunctionTable = 116,
124
+ DataTypePrimitiveAccelerationStructure = 117,
125
+ DataTypeInstanceAccelerationStructure = 118,
126
+ DataTypeBFloat = 121,
127
+ DataTypeBFloat2 = 122,
128
+ DataTypeBFloat3 = 123,
129
+ DataTypeBFloat4 = 124,
130
+ };
131
+
132
+ _MTL_ENUM(NS::Integer, BindingType) {
133
+ BindingTypeBuffer = 0,
134
+ BindingTypeThreadgroupMemory = 1,
135
+ BindingTypeTexture = 2,
136
+ BindingTypeSampler = 3,
137
+ BindingTypeImageblockData = 16,
138
+ BindingTypeImageblock = 17,
139
+ BindingTypeVisibleFunctionTable = 24,
140
+ BindingTypePrimitiveAccelerationStructure = 25,
141
+ BindingTypeInstanceAccelerationStructure = 26,
142
+ BindingTypeIntersectionFunctionTable = 27,
143
+ BindingTypeObjectPayload = 34,
144
+ };
145
+
146
+ _MTL_ENUM(NS::UInteger, ArgumentType) {
147
+ ArgumentTypeBuffer = 0,
148
+ ArgumentTypeThreadgroupMemory = 1,
149
+ ArgumentTypeTexture = 2,
150
+ ArgumentTypeSampler = 3,
151
+ ArgumentTypeImageblockData = 16,
152
+ ArgumentTypeImageblock = 17,
153
+ ArgumentTypeVisibleFunctionTable = 24,
154
+ ArgumentTypePrimitiveAccelerationStructure = 25,
155
+ ArgumentTypeInstanceAccelerationStructure = 26,
156
+ ArgumentTypeIntersectionFunctionTable = 27,
157
+ };
158
+
159
+ _MTL_ENUM(NS::UInteger, BindingAccess) {
160
+ ArgumentAccessReadOnly = 0,
161
+ BindingAccessReadOnly = 0,
162
+ ArgumentAccessReadWrite = 1,
163
+ BindingAccessReadWrite = 1,
164
+ BindingAccessWriteOnly = 2,
165
+ ArgumentAccessWriteOnly = 2,
166
+ };
167
+
168
+ class Type : public NS::Referencing<Type>
169
+ {
170
+ public:
171
+ static class Type* alloc();
172
+
173
+ class Type* init();
174
+
175
+ MTL::DataType dataType() const;
176
+ };
177
+
178
+ class StructMember : public NS::Referencing<StructMember>
179
+ {
180
+ public:
181
+ static class StructMember* alloc();
182
+
183
+ class StructMember* init();
184
+
185
+ NS::String* name() const;
186
+
187
+ NS::UInteger offset() const;
188
+
189
+ MTL::DataType dataType() const;
190
+
191
+ class StructType* structType();
192
+
193
+ class ArrayType* arrayType();
194
+
195
+ class TextureReferenceType* textureReferenceType();
196
+
197
+ class PointerType* pointerType();
198
+
199
+ NS::UInteger argumentIndex() const;
200
+ };
201
+
202
+ class StructType : public NS::Referencing<StructType, Type>
203
+ {
204
+ public:
205
+ static class StructType* alloc();
206
+
207
+ class StructType* init();
208
+
209
+ NS::Array* members() const;
210
+
211
+ class StructMember* memberByName(const NS::String* name);
212
+ };
213
+
214
+ class ArrayType : public NS::Referencing<ArrayType, Type>
215
+ {
216
+ public:
217
+ static class ArrayType* alloc();
218
+
219
+ class ArrayType* init();
220
+
221
+ MTL::DataType elementType() const;
222
+
223
+ NS::UInteger arrayLength() const;
224
+
225
+ NS::UInteger stride() const;
226
+
227
+ NS::UInteger argumentIndexStride() const;
228
+
229
+ class StructType* elementStructType();
230
+
231
+ class ArrayType* elementArrayType();
232
+
233
+ class TextureReferenceType* elementTextureReferenceType();
234
+
235
+ class PointerType* elementPointerType();
236
+ };
237
+
238
+ class PointerType : public NS::Referencing<PointerType, Type>
239
+ {
240
+ public:
241
+ static class PointerType* alloc();
242
+
243
+ class PointerType* init();
244
+
245
+ MTL::DataType elementType() const;
246
+
247
+ MTL::BindingAccess access() const;
248
+
249
+ NS::UInteger alignment() const;
250
+
251
+ NS::UInteger dataSize() const;
252
+
253
+ bool elementIsArgumentBuffer() const;
254
+
255
+ class StructType* elementStructType();
256
+
257
+ class ArrayType* elementArrayType();
258
+ };
259
+
260
+ class TextureReferenceType : public NS::Referencing<TextureReferenceType, Type>
261
+ {
262
+ public:
263
+ static class TextureReferenceType* alloc();
264
+
265
+ class TextureReferenceType* init();
266
+
267
+ MTL::DataType textureDataType() const;
268
+
269
+ MTL::TextureType textureType() const;
270
+
271
+ MTL::BindingAccess access() const;
272
+
273
+ bool isDepthTexture() const;
274
+ };
275
+
276
+ class Argument : public NS::Referencing<Argument>
277
+ {
278
+ public:
279
+ static class Argument* alloc();
280
+
281
+ class Argument* init();
282
+
283
+ NS::String* name() const;
284
+
285
+ MTL::ArgumentType type() const;
286
+
287
+ MTL::BindingAccess access() const;
288
+
289
+ NS::UInteger index() const;
290
+
291
+ bool active() const;
292
+
293
+ NS::UInteger bufferAlignment() const;
294
+
295
+ NS::UInteger bufferDataSize() const;
296
+
297
+ MTL::DataType bufferDataType() const;
298
+
299
+ class StructType* bufferStructType() const;
300
+
301
+ class PointerType* bufferPointerType() const;
302
+
303
+ NS::UInteger threadgroupMemoryAlignment() const;
304
+
305
+ NS::UInteger threadgroupMemoryDataSize() const;
306
+
307
+ MTL::TextureType textureType() const;
308
+
309
+ MTL::DataType textureDataType() const;
310
+
311
+ bool isDepthTexture() const;
312
+
313
+ NS::UInteger arrayLength() const;
314
+ };
315
+
316
+ class Binding : public NS::Referencing<Binding>
317
+ {
318
+ public:
319
+ NS::String* name() const;
320
+
321
+ MTL::BindingType type() const;
322
+
323
+ MTL::BindingAccess access() const;
324
+
325
+ NS::UInteger index() const;
326
+
327
+ bool used() const;
328
+
329
+ bool argument() const;
330
+ };
331
+
332
+ class BufferBinding : public NS::Referencing<BufferBinding, Binding>
333
+ {
334
+ public:
335
+ NS::UInteger bufferAlignment() const;
336
+
337
+ NS::UInteger bufferDataSize() const;
338
+
339
+ MTL::DataType bufferDataType() const;
340
+
341
+ class StructType* bufferStructType() const;
342
+
343
+ class PointerType* bufferPointerType() const;
344
+ };
345
+
346
+ class ThreadgroupBinding : public NS::Referencing<ThreadgroupBinding, Binding>
347
+ {
348
+ public:
349
+ NS::UInteger threadgroupMemoryAlignment() const;
350
+
351
+ NS::UInteger threadgroupMemoryDataSize() const;
352
+ };
353
+
354
+ class TextureBinding : public NS::Referencing<TextureBinding, Binding>
355
+ {
356
+ public:
357
+ MTL::TextureType textureType() const;
358
+
359
+ MTL::DataType textureDataType() const;
360
+
361
+ bool depthTexture() const;
362
+
363
+ NS::UInteger arrayLength() const;
364
+ };
365
+
366
+ class ObjectPayloadBinding : public NS::Referencing<ObjectPayloadBinding, Binding>
367
+ {
368
+ public:
369
+ NS::UInteger objectPayloadAlignment() const;
370
+
371
+ NS::UInteger objectPayloadDataSize() const;
372
+ };
373
+
374
+ }
375
+
376
+ // static method: alloc
377
+ _MTL_INLINE MTL::Type* MTL::Type::alloc()
378
+ {
379
+ return NS::Object::alloc<MTL::Type>(_MTL_PRIVATE_CLS(MTLType));
380
+ }
381
+
382
+ // method: init
383
+ _MTL_INLINE MTL::Type* MTL::Type::init()
384
+ {
385
+ return NS::Object::init<MTL::Type>();
386
+ }
387
+
388
+ // property: dataType
389
+ _MTL_INLINE MTL::DataType MTL::Type::dataType() const
390
+ {
391
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));
392
+ }
393
+
394
+ // static method: alloc
395
+ _MTL_INLINE MTL::StructMember* MTL::StructMember::alloc()
396
+ {
397
+ return NS::Object::alloc<MTL::StructMember>(_MTL_PRIVATE_CLS(MTLStructMember));
398
+ }
399
+
400
+ // method: init
401
+ _MTL_INLINE MTL::StructMember* MTL::StructMember::init()
402
+ {
403
+ return NS::Object::init<MTL::StructMember>();
404
+ }
405
+
406
+ // property: name
407
+ _MTL_INLINE NS::String* MTL::StructMember::name() const
408
+ {
409
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
410
+ }
411
+
412
+ // property: offset
413
+ _MTL_INLINE NS::UInteger MTL::StructMember::offset() const
414
+ {
415
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(offset));
416
+ }
417
+
418
+ // property: dataType
419
+ _MTL_INLINE MTL::DataType MTL::StructMember::dataType() const
420
+ {
421
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));
422
+ }
423
+
424
+ // method: structType
425
+ _MTL_INLINE MTL::StructType* MTL::StructMember::structType()
426
+ {
427
+ return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(structType));
428
+ }
429
+
430
+ // method: arrayType
431
+ _MTL_INLINE MTL::ArrayType* MTL::StructMember::arrayType()
432
+ {
433
+ return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(arrayType));
434
+ }
435
+
436
+ // method: textureReferenceType
437
+ _MTL_INLINE MTL::TextureReferenceType* MTL::StructMember::textureReferenceType()
438
+ {
439
+ return Object::sendMessage<MTL::TextureReferenceType*>(this, _MTL_PRIVATE_SEL(textureReferenceType));
440
+ }
441
+
442
+ // method: pointerType
443
+ _MTL_INLINE MTL::PointerType* MTL::StructMember::pointerType()
444
+ {
445
+ return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(pointerType));
446
+ }
447
+
448
+ // property: argumentIndex
449
+ _MTL_INLINE NS::UInteger MTL::StructMember::argumentIndex() const
450
+ {
451
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndex));
452
+ }
453
+
454
+ // static method: alloc
455
+ _MTL_INLINE MTL::StructType* MTL::StructType::alloc()
456
+ {
457
+ return NS::Object::alloc<MTL::StructType>(_MTL_PRIVATE_CLS(MTLStructType));
458
+ }
459
+
460
+ // method: init
461
+ _MTL_INLINE MTL::StructType* MTL::StructType::init()
462
+ {
463
+ return NS::Object::init<MTL::StructType>();
464
+ }
465
+
466
+ // property: members
467
+ _MTL_INLINE NS::Array* MTL::StructType::members() const
468
+ {
469
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(members));
470
+ }
471
+
472
+ // method: memberByName:
473
+ _MTL_INLINE MTL::StructMember* MTL::StructType::memberByName(const NS::String* name)
474
+ {
475
+ return Object::sendMessage<MTL::StructMember*>(this, _MTL_PRIVATE_SEL(memberByName_), name);
476
+ }
477
+
478
+ // static method: alloc
479
+ _MTL_INLINE MTL::ArrayType* MTL::ArrayType::alloc()
480
+ {
481
+ return NS::Object::alloc<MTL::ArrayType>(_MTL_PRIVATE_CLS(MTLArrayType));
482
+ }
483
+
484
+ // method: init
485
+ _MTL_INLINE MTL::ArrayType* MTL::ArrayType::init()
486
+ {
487
+ return NS::Object::init<MTL::ArrayType>();
488
+ }
489
+
490
+ // property: elementType
491
+ _MTL_INLINE MTL::DataType MTL::ArrayType::elementType() const
492
+ {
493
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(elementType));
494
+ }
495
+
496
+ // property: arrayLength
497
+ _MTL_INLINE NS::UInteger MTL::ArrayType::arrayLength() const
498
+ {
499
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
500
+ }
501
+
502
+ // property: stride
503
+ _MTL_INLINE NS::UInteger MTL::ArrayType::stride() const
504
+ {
505
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(stride));
506
+ }
507
+
508
+ // property: argumentIndexStride
509
+ _MTL_INLINE NS::UInteger MTL::ArrayType::argumentIndexStride() const
510
+ {
511
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndexStride));
512
+ }
513
+
514
+ // method: elementStructType
515
+ _MTL_INLINE MTL::StructType* MTL::ArrayType::elementStructType()
516
+ {
517
+ return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(elementStructType));
518
+ }
519
+
520
+ // method: elementArrayType
521
+ _MTL_INLINE MTL::ArrayType* MTL::ArrayType::elementArrayType()
522
+ {
523
+ return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(elementArrayType));
524
+ }
525
+
526
+ // method: elementTextureReferenceType
527
+ _MTL_INLINE MTL::TextureReferenceType* MTL::ArrayType::elementTextureReferenceType()
528
+ {
529
+ return Object::sendMessage<MTL::TextureReferenceType*>(this, _MTL_PRIVATE_SEL(elementTextureReferenceType));
530
+ }
531
+
532
+ // method: elementPointerType
533
+ _MTL_INLINE MTL::PointerType* MTL::ArrayType::elementPointerType()
534
+ {
535
+ return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(elementPointerType));
536
+ }
537
+
538
+ // static method: alloc
539
+ _MTL_INLINE MTL::PointerType* MTL::PointerType::alloc()
540
+ {
541
+ return NS::Object::alloc<MTL::PointerType>(_MTL_PRIVATE_CLS(MTLPointerType));
542
+ }
543
+
544
+ // method: init
545
+ _MTL_INLINE MTL::PointerType* MTL::PointerType::init()
546
+ {
547
+ return NS::Object::init<MTL::PointerType>();
548
+ }
549
+
550
+ // property: elementType
551
+ _MTL_INLINE MTL::DataType MTL::PointerType::elementType() const
552
+ {
553
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(elementType));
554
+ }
555
+
556
+ // property: access
557
+ _MTL_INLINE MTL::BindingAccess MTL::PointerType::access() const
558
+ {
559
+ return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
560
+ }
561
+
562
+ // property: alignment
563
+ _MTL_INLINE NS::UInteger MTL::PointerType::alignment() const
564
+ {
565
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment));
566
+ }
567
+
568
+ // property: dataSize
569
+ _MTL_INLINE NS::UInteger MTL::PointerType::dataSize() const
570
+ {
571
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(dataSize));
572
+ }
573
+
574
+ // property: elementIsArgumentBuffer
575
+ _MTL_INLINE bool MTL::PointerType::elementIsArgumentBuffer() const
576
+ {
577
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(elementIsArgumentBuffer));
578
+ }
579
+
580
+ // method: elementStructType
581
+ _MTL_INLINE MTL::StructType* MTL::PointerType::elementStructType()
582
+ {
583
+ return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(elementStructType));
584
+ }
585
+
586
+ // method: elementArrayType
587
+ _MTL_INLINE MTL::ArrayType* MTL::PointerType::elementArrayType()
588
+ {
589
+ return Object::sendMessage<MTL::ArrayType*>(this, _MTL_PRIVATE_SEL(elementArrayType));
590
+ }
591
+
592
+ // static method: alloc
593
+ _MTL_INLINE MTL::TextureReferenceType* MTL::TextureReferenceType::alloc()
594
+ {
595
+ return NS::Object::alloc<MTL::TextureReferenceType>(_MTL_PRIVATE_CLS(MTLTextureReferenceType));
596
+ }
597
+
598
+ // method: init
599
+ _MTL_INLINE MTL::TextureReferenceType* MTL::TextureReferenceType::init()
600
+ {
601
+ return NS::Object::init<MTL::TextureReferenceType>();
602
+ }
603
+
604
+ // property: textureDataType
605
+ _MTL_INLINE MTL::DataType MTL::TextureReferenceType::textureDataType() const
606
+ {
607
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
608
+ }
609
+
610
+ // property: textureType
611
+ _MTL_INLINE MTL::TextureType MTL::TextureReferenceType::textureType() const
612
+ {
613
+ return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
614
+ }
615
+
616
+ // property: access
617
+ _MTL_INLINE MTL::BindingAccess MTL::TextureReferenceType::access() const
618
+ {
619
+ return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
620
+ }
621
+
622
+ // property: isDepthTexture
623
+ _MTL_INLINE bool MTL::TextureReferenceType::isDepthTexture() const
624
+ {
625
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
626
+ }
627
+
628
+ // static method: alloc
629
+ _MTL_INLINE MTL::Argument* MTL::Argument::alloc()
630
+ {
631
+ return NS::Object::alloc<MTL::Argument>(_MTL_PRIVATE_CLS(MTLArgument));
632
+ }
633
+
634
+ // method: init
635
+ _MTL_INLINE MTL::Argument* MTL::Argument::init()
636
+ {
637
+ return NS::Object::init<MTL::Argument>();
638
+ }
639
+
640
+ // property: name
641
+ _MTL_INLINE NS::String* MTL::Argument::name() const
642
+ {
643
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
644
+ }
645
+
646
+ // property: type
647
+ _MTL_INLINE MTL::ArgumentType MTL::Argument::type() const
648
+ {
649
+ return Object::sendMessage<MTL::ArgumentType>(this, _MTL_PRIVATE_SEL(type));
650
+ }
651
+
652
+ // property: access
653
+ _MTL_INLINE MTL::BindingAccess MTL::Argument::access() const
654
+ {
655
+ return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
656
+ }
657
+
658
+ // property: index
659
+ _MTL_INLINE NS::UInteger MTL::Argument::index() const
660
+ {
661
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
662
+ }
663
+
664
+ // property: active
665
+ _MTL_INLINE bool MTL::Argument::active() const
666
+ {
667
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
668
+ }
669
+
670
+ // property: bufferAlignment
671
+ _MTL_INLINE NS::UInteger MTL::Argument::bufferAlignment() const
672
+ {
673
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferAlignment));
674
+ }
675
+
676
+ // property: bufferDataSize
677
+ _MTL_INLINE NS::UInteger MTL::Argument::bufferDataSize() const
678
+ {
679
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferDataSize));
680
+ }
681
+
682
+ // property: bufferDataType
683
+ _MTL_INLINE MTL::DataType MTL::Argument::bufferDataType() const
684
+ {
685
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(bufferDataType));
686
+ }
687
+
688
+ // property: bufferStructType
689
+ _MTL_INLINE MTL::StructType* MTL::Argument::bufferStructType() const
690
+ {
691
+ return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(bufferStructType));
692
+ }
693
+
694
+ // property: bufferPointerType
695
+ _MTL_INLINE MTL::PointerType* MTL::Argument::bufferPointerType() const
696
+ {
697
+ return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(bufferPointerType));
698
+ }
699
+
700
+ // property: threadgroupMemoryAlignment
701
+ _MTL_INLINE NS::UInteger MTL::Argument::threadgroupMemoryAlignment() const
702
+ {
703
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryAlignment));
704
+ }
705
+
706
+ // property: threadgroupMemoryDataSize
707
+ _MTL_INLINE NS::UInteger MTL::Argument::threadgroupMemoryDataSize() const
708
+ {
709
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryDataSize));
710
+ }
711
+
712
+ // property: textureType
713
+ _MTL_INLINE MTL::TextureType MTL::Argument::textureType() const
714
+ {
715
+ return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
716
+ }
717
+
718
+ // property: textureDataType
719
+ _MTL_INLINE MTL::DataType MTL::Argument::textureDataType() const
720
+ {
721
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
722
+ }
723
+
724
+ // property: isDepthTexture
725
+ _MTL_INLINE bool MTL::Argument::isDepthTexture() const
726
+ {
727
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
728
+ }
729
+
730
+ // property: arrayLength
731
+ _MTL_INLINE NS::UInteger MTL::Argument::arrayLength() const
732
+ {
733
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
734
+ }
735
+
736
+ // property: name
737
+ _MTL_INLINE NS::String* MTL::Binding::name() const
738
+ {
739
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
740
+ }
741
+
742
+ // property: type
743
+ _MTL_INLINE MTL::BindingType MTL::Binding::type() const
744
+ {
745
+ return Object::sendMessage<MTL::BindingType>(this, _MTL_PRIVATE_SEL(type));
746
+ }
747
+
748
+ // property: access
749
+ _MTL_INLINE MTL::BindingAccess MTL::Binding::access() const
750
+ {
751
+ return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
752
+ }
753
+
754
+ // property: index
755
+ _MTL_INLINE NS::UInteger MTL::Binding::index() const
756
+ {
757
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
758
+ }
759
+
760
+ // property: used
761
+ _MTL_INLINE bool MTL::Binding::used() const
762
+ {
763
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isUsed));
764
+ }
765
+
766
+ // property: argument
767
+ _MTL_INLINE bool MTL::Binding::argument() const
768
+ {
769
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isArgument));
770
+ }
771
+
772
+ // property: bufferAlignment
773
+ _MTL_INLINE NS::UInteger MTL::BufferBinding::bufferAlignment() const
774
+ {
775
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferAlignment));
776
+ }
777
+
778
+ // property: bufferDataSize
779
+ _MTL_INLINE NS::UInteger MTL::BufferBinding::bufferDataSize() const
780
+ {
781
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(bufferDataSize));
782
+ }
783
+
784
+ // property: bufferDataType
785
+ _MTL_INLINE MTL::DataType MTL::BufferBinding::bufferDataType() const
786
+ {
787
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(bufferDataType));
788
+ }
789
+
790
+ // property: bufferStructType
791
+ _MTL_INLINE MTL::StructType* MTL::BufferBinding::bufferStructType() const
792
+ {
793
+ return Object::sendMessage<MTL::StructType*>(this, _MTL_PRIVATE_SEL(bufferStructType));
794
+ }
795
+
796
+ // property: bufferPointerType
797
+ _MTL_INLINE MTL::PointerType* MTL::BufferBinding::bufferPointerType() const
798
+ {
799
+ return Object::sendMessage<MTL::PointerType*>(this, _MTL_PRIVATE_SEL(bufferPointerType));
800
+ }
801
+
802
+ // property: threadgroupMemoryAlignment
803
+ _MTL_INLINE NS::UInteger MTL::ThreadgroupBinding::threadgroupMemoryAlignment() const
804
+ {
805
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryAlignment));
806
+ }
807
+
808
+ // property: threadgroupMemoryDataSize
809
+ _MTL_INLINE NS::UInteger MTL::ThreadgroupBinding::threadgroupMemoryDataSize() const
810
+ {
811
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadgroupMemoryDataSize));
812
+ }
813
+
814
+ // property: textureType
815
+ _MTL_INLINE MTL::TextureType MTL::TextureBinding::textureType() const
816
+ {
817
+ return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
818
+ }
819
+
820
+ // property: textureDataType
821
+ _MTL_INLINE MTL::DataType MTL::TextureBinding::textureDataType() const
822
+ {
823
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(textureDataType));
824
+ }
825
+
826
+ // property: depthTexture
827
+ _MTL_INLINE bool MTL::TextureBinding::depthTexture() const
828
+ {
829
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthTexture));
830
+ }
831
+
832
+ // property: arrayLength
833
+ _MTL_INLINE NS::UInteger MTL::TextureBinding::arrayLength() const
834
+ {
835
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
836
+ }
837
+
838
+ // property: objectPayloadAlignment
839
+ _MTL_INLINE NS::UInteger MTL::ObjectPayloadBinding::objectPayloadAlignment() const
840
+ {
841
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(objectPayloadAlignment));
842
+ }
843
+
844
+ // property: objectPayloadDataSize
845
+ _MTL_INLINE NS::UInteger MTL::ObjectPayloadBinding::objectPayloadDataSize() const
846
+ {
847
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(objectPayloadDataSize));
848
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLArgumentEncoder.hpp ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLArgumentEncoder.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+
32
+ static const NS::UInteger AttributeStrideStatic = NS::UIntegerMax;
33
+
34
+ class ArgumentEncoder : public NS::Referencing<ArgumentEncoder>
35
+ {
36
+ public:
37
+ class Device* device() const;
38
+
39
+ NS::String* label() const;
40
+ void setLabel(const NS::String* label);
41
+
42
+ NS::UInteger encodedLength() const;
43
+
44
+ NS::UInteger alignment() const;
45
+
46
+ void setArgumentBuffer(const class Buffer* argumentBuffer, NS::UInteger offset);
47
+
48
+ void setArgumentBuffer(const class Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement);
49
+
50
+ void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
51
+
52
+ void setBuffers(const class Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
53
+
54
+ void setTexture(const class Texture* texture, NS::UInteger index);
55
+
56
+ void setTextures(const class Texture* const textures[], NS::Range range);
57
+
58
+ void setSamplerState(const class SamplerState* sampler, NS::UInteger index);
59
+
60
+ void setSamplerStates(const class SamplerState* const samplers[], NS::Range range);
61
+
62
+ void* constantData(NS::UInteger index);
63
+
64
+ void setRenderPipelineState(const class RenderPipelineState* pipeline, NS::UInteger index);
65
+
66
+ void setRenderPipelineStates(const class RenderPipelineState* const pipelines[], NS::Range range);
67
+
68
+ void setComputePipelineState(const class ComputePipelineState* pipeline, NS::UInteger index);
69
+
70
+ void setComputePipelineStates(const class ComputePipelineState* const pipelines[], NS::Range range);
71
+
72
+ void setIndirectCommandBuffer(const class IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index);
73
+
74
+ void setIndirectCommandBuffers(const class IndirectCommandBuffer* const buffers[], NS::Range range);
75
+
76
+ void setAccelerationStructure(const class AccelerationStructure* accelerationStructure, NS::UInteger index);
77
+
78
+ class ArgumentEncoder* newArgumentEncoder(NS::UInteger index);
79
+
80
+ void setVisibleFunctionTable(const class VisibleFunctionTable* visibleFunctionTable, NS::UInteger index);
81
+
82
+ void setVisibleFunctionTables(const class VisibleFunctionTable* const visibleFunctionTables[], NS::Range range);
83
+
84
+ void setIntersectionFunctionTable(const class IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index);
85
+
86
+ void setIntersectionFunctionTables(const class IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range);
87
+ };
88
+
89
+ }
90
+
91
+ // property: device
92
+ _MTL_INLINE MTL::Device* MTL::ArgumentEncoder::device() const
93
+ {
94
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
95
+ }
96
+
97
+ // property: label
98
+ _MTL_INLINE NS::String* MTL::ArgumentEncoder::label() const
99
+ {
100
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
101
+ }
102
+
103
+ _MTL_INLINE void MTL::ArgumentEncoder::setLabel(const NS::String* label)
104
+ {
105
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
106
+ }
107
+
108
+ // property: encodedLength
109
+ _MTL_INLINE NS::UInteger MTL::ArgumentEncoder::encodedLength() const
110
+ {
111
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(encodedLength));
112
+ }
113
+
114
+ // property: alignment
115
+ _MTL_INLINE NS::UInteger MTL::ArgumentEncoder::alignment() const
116
+ {
117
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(alignment));
118
+ }
119
+
120
+ // method: setArgumentBuffer:offset:
121
+ _MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset)
122
+ {
123
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_offset_), argumentBuffer, offset);
124
+ }
125
+
126
+ // method: setArgumentBuffer:startOffset:arrayElement:
127
+ _MTL_INLINE void MTL::ArgumentEncoder::setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement)
128
+ {
129
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentBuffer_startOffset_arrayElement_), argumentBuffer, startOffset, arrayElement);
130
+ }
131
+
132
+ // method: setBuffer:offset:atIndex:
133
+ _MTL_INLINE void MTL::ArgumentEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
134
+ {
135
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index);
136
+ }
137
+
138
+ // method: setBuffers:offsets:withRange:
139
+ _MTL_INLINE void MTL::ArgumentEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range)
140
+ {
141
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_withRange_), buffers, offsets, range);
142
+ }
143
+
144
+ // method: setTexture:atIndex:
145
+ _MTL_INLINE void MTL::ArgumentEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index)
146
+ {
147
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index);
148
+ }
149
+
150
+ // method: setTextures:withRange:
151
+ _MTL_INLINE void MTL::ArgumentEncoder::setTextures(const MTL::Texture* const textures[], NS::Range range)
152
+ {
153
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextures_withRange_), textures, range);
154
+ }
155
+
156
+ // method: setSamplerState:atIndex:
157
+ _MTL_INLINE void MTL::ArgumentEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index)
158
+ {
159
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index);
160
+ }
161
+
162
+ // method: setSamplerStates:withRange:
163
+ _MTL_INLINE void MTL::ArgumentEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range)
164
+ {
165
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_withRange_), samplers, range);
166
+ }
167
+
168
+ // method: constantDataAtIndex:
169
+ _MTL_INLINE void* MTL::ArgumentEncoder::constantData(NS::UInteger index)
170
+ {
171
+ return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(constantDataAtIndex_), index);
172
+ }
173
+
174
+ // method: setRenderPipelineState:atIndex:
175
+ _MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineState(const MTL::RenderPipelineState* pipeline, NS::UInteger index)
176
+ {
177
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_atIndex_), pipeline, index);
178
+ }
179
+
180
+ // method: setRenderPipelineStates:withRange:
181
+ _MTL_INLINE void MTL::ArgumentEncoder::setRenderPipelineStates(const MTL::RenderPipelineState* const pipelines[], NS::Range range)
182
+ {
183
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineStates_withRange_), pipelines, range);
184
+ }
185
+
186
+ // method: setComputePipelineState:atIndex:
187
+ _MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineState(const MTL::ComputePipelineState* pipeline, NS::UInteger index)
188
+ {
189
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_atIndex_), pipeline, index);
190
+ }
191
+
192
+ // method: setComputePipelineStates:withRange:
193
+ _MTL_INLINE void MTL::ArgumentEncoder::setComputePipelineStates(const MTL::ComputePipelineState* const pipelines[], NS::Range range)
194
+ {
195
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineStates_withRange_), pipelines, range);
196
+ }
197
+
198
+ // method: setIndirectCommandBuffer:atIndex:
199
+ _MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::UInteger index)
200
+ {
201
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffer_atIndex_), indirectCommandBuffer, index);
202
+ }
203
+
204
+ // method: setIndirectCommandBuffers:withRange:
205
+ _MTL_INLINE void MTL::ArgumentEncoder::setIndirectCommandBuffers(const MTL::IndirectCommandBuffer* const buffers[], NS::Range range)
206
+ {
207
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndirectCommandBuffers_withRange_), buffers, range);
208
+ }
209
+
210
+ // method: setAccelerationStructure:atIndex:
211
+ _MTL_INLINE void MTL::ArgumentEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger index)
212
+ {
213
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atIndex_), accelerationStructure, index);
214
+ }
215
+
216
+ // method: newArgumentEncoderForBufferAtIndex:
217
+ _MTL_INLINE MTL::ArgumentEncoder* MTL::ArgumentEncoder::newArgumentEncoder(NS::UInteger index)
218
+ {
219
+ return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderForBufferAtIndex_), index);
220
+ }
221
+
222
+ // method: setVisibleFunctionTable:atIndex:
223
+ _MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger index)
224
+ {
225
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atIndex_), visibleFunctionTable, index);
226
+ }
227
+
228
+ // method: setVisibleFunctionTables:withRange:
229
+ _MTL_INLINE void MTL::ArgumentEncoder::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range)
230
+ {
231
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withRange_), visibleFunctionTables, range);
232
+ }
233
+
234
+ // method: setIntersectionFunctionTable:atIndex:
235
+ _MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger index)
236
+ {
237
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atIndex_), intersectionFunctionTable, index);
238
+ }
239
+
240
+ // method: setIntersectionFunctionTables:withRange:
241
+ _MTL_INLINE void MTL::ArgumentEncoder::setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range)
242
+ {
243
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTables_withRange_), intersectionFunctionTables, range);
244
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBinaryArchive.hpp ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLBinaryArchive.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+ _MTL_ENUM(NS::UInteger, BinaryArchiveError) {
32
+ BinaryArchiveErrorNone = 0,
33
+ BinaryArchiveErrorInvalidFile = 1,
34
+ BinaryArchiveErrorUnexpectedElement = 2,
35
+ BinaryArchiveErrorCompilationFailure = 3,
36
+ BinaryArchiveErrorInternalError = 4,
37
+ };
38
+
39
+ class BinaryArchiveDescriptor : public NS::Copying<BinaryArchiveDescriptor>
40
+ {
41
+ public:
42
+ static class BinaryArchiveDescriptor* alloc();
43
+
44
+ class BinaryArchiveDescriptor* init();
45
+
46
+ NS::URL* url() const;
47
+ void setUrl(const NS::URL* url);
48
+ };
49
+
50
+ class BinaryArchive : public NS::Referencing<BinaryArchive>
51
+ {
52
+ public:
53
+ NS::String* label() const;
54
+ void setLabel(const NS::String* label);
55
+
56
+ class Device* device() const;
57
+
58
+ bool addComputePipelineFunctions(const class ComputePipelineDescriptor* descriptor, NS::Error** error);
59
+
60
+ bool addRenderPipelineFunctions(const class RenderPipelineDescriptor* descriptor, NS::Error** error);
61
+
62
+ bool addTileRenderPipelineFunctions(const class TileRenderPipelineDescriptor* descriptor, NS::Error** error);
63
+
64
+ bool serializeToURL(const NS::URL* url, NS::Error** error);
65
+
66
+ bool addFunction(const class FunctionDescriptor* descriptor, const class Library* library, NS::Error** error);
67
+ };
68
+
69
+ }
70
+
71
+ // static method: alloc
72
+ _MTL_INLINE MTL::BinaryArchiveDescriptor* MTL::BinaryArchiveDescriptor::alloc()
73
+ {
74
+ return NS::Object::alloc<MTL::BinaryArchiveDescriptor>(_MTL_PRIVATE_CLS(MTLBinaryArchiveDescriptor));
75
+ }
76
+
77
+ // method: init
78
+ _MTL_INLINE MTL::BinaryArchiveDescriptor* MTL::BinaryArchiveDescriptor::init()
79
+ {
80
+ return NS::Object::init<MTL::BinaryArchiveDescriptor>();
81
+ }
82
+
83
+ // property: url
84
+ _MTL_INLINE NS::URL* MTL::BinaryArchiveDescriptor::url() const
85
+ {
86
+ return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(url));
87
+ }
88
+
89
+ _MTL_INLINE void MTL::BinaryArchiveDescriptor::setUrl(const NS::URL* url)
90
+ {
91
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setUrl_), url);
92
+ }
93
+
94
+ // property: label
95
+ _MTL_INLINE NS::String* MTL::BinaryArchive::label() const
96
+ {
97
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
98
+ }
99
+
100
+ _MTL_INLINE void MTL::BinaryArchive::setLabel(const NS::String* label)
101
+ {
102
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
103
+ }
104
+
105
+ // property: device
106
+ _MTL_INLINE MTL::Device* MTL::BinaryArchive::device() const
107
+ {
108
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
109
+ }
110
+
111
+ // method: addComputePipelineFunctionsWithDescriptor:error:
112
+ _MTL_INLINE bool MTL::BinaryArchive::addComputePipelineFunctions(const MTL::ComputePipelineDescriptor* descriptor, NS::Error** error)
113
+ {
114
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addComputePipelineFunctionsWithDescriptor_error_), descriptor, error);
115
+ }
116
+
117
+ // method: addRenderPipelineFunctionsWithDescriptor:error:
118
+ _MTL_INLINE bool MTL::BinaryArchive::addRenderPipelineFunctions(const MTL::RenderPipelineDescriptor* descriptor, NS::Error** error)
119
+ {
120
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addRenderPipelineFunctionsWithDescriptor_error_), descriptor, error);
121
+ }
122
+
123
+ // method: addTileRenderPipelineFunctionsWithDescriptor:error:
124
+ _MTL_INLINE bool MTL::BinaryArchive::addTileRenderPipelineFunctions(const MTL::TileRenderPipelineDescriptor* descriptor, NS::Error** error)
125
+ {
126
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addTileRenderPipelineFunctionsWithDescriptor_error_), descriptor, error);
127
+ }
128
+
129
+ // method: serializeToURL:error:
130
+ _MTL_INLINE bool MTL::BinaryArchive::serializeToURL(const NS::URL* url, NS::Error** error)
131
+ {
132
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(serializeToURL_error_), url, error);
133
+ }
134
+
135
+ // method: addFunctionWithDescriptor:library:error:
136
+ _MTL_INLINE bool MTL::BinaryArchive::addFunction(const MTL::FunctionDescriptor* descriptor, const MTL::Library* library, NS::Error** error)
137
+ {
138
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(addFunctionWithDescriptor_library_error_), descriptor, library, error);
139
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBlitCommandEncoder.hpp ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLBlitCommandEncoder.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLBlitCommandEncoder.hpp"
30
+ #include "MTLCommandEncoder.hpp"
31
+ #include "MTLTypes.hpp"
32
+
33
+ namespace MTL
34
+ {
35
+ _MTL_OPTIONS(NS::UInteger, BlitOption) {
36
+ BlitOptionNone = 0,
37
+ BlitOptionDepthFromDepthStencil = 1,
38
+ BlitOptionStencilFromDepthStencil = 2,
39
+ BlitOptionRowLinearPVRTC = 4,
40
+ };
41
+
42
+ class BlitCommandEncoder : public NS::Referencing<BlitCommandEncoder, CommandEncoder>
43
+ {
44
+ public:
45
+ void synchronizeResource(const class Resource* resource);
46
+
47
+ void synchronizeTexture(const class Texture* texture, NS::UInteger slice, NS::UInteger level);
48
+
49
+ void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
50
+
51
+ void copyFromBuffer(const class Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);
52
+
53
+ void copyFromBuffer(const class Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options);
54
+
55
+ void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const class Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage);
56
+
57
+ void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const class Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options);
58
+
59
+ void generateMipmaps(const class Texture* texture);
60
+
61
+ void fillBuffer(const class Buffer* buffer, NS::Range range, uint8_t value);
62
+
63
+ void copyFromTexture(const class Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const class Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount);
64
+
65
+ void copyFromTexture(const class Texture* sourceTexture, const class Texture* destinationTexture);
66
+
67
+ void copyFromBuffer(const class Buffer* sourceBuffer, NS::UInteger sourceOffset, const class Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size);
68
+
69
+ void updateFence(const class Fence* fence);
70
+
71
+ void waitForFence(const class Fence* fence);
72
+
73
+ void getTextureAccessCounters(const class Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice, bool resetCounters, const class Buffer* countersBuffer, NS::UInteger countersBufferOffset);
74
+
75
+ void resetTextureAccessCounters(const class Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice);
76
+
77
+ void optimizeContentsForGPUAccess(const class Texture* texture);
78
+
79
+ void optimizeContentsForGPUAccess(const class Texture* texture, NS::UInteger slice, NS::UInteger level);
80
+
81
+ void optimizeContentsForCPUAccess(const class Texture* texture);
82
+
83
+ void optimizeContentsForCPUAccess(const class Texture* texture, NS::UInteger slice, NS::UInteger level);
84
+
85
+ void resetCommandsInBuffer(const class IndirectCommandBuffer* buffer, NS::Range range);
86
+
87
+ void copyIndirectCommandBuffer(const class IndirectCommandBuffer* source, NS::Range sourceRange, const class IndirectCommandBuffer* destination, NS::UInteger destinationIndex);
88
+
89
+ void optimizeIndirectCommandBuffer(const class IndirectCommandBuffer* indirectCommandBuffer, NS::Range range);
90
+
91
+ void sampleCountersInBuffer(const class CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
92
+
93
+ void resolveCounters(const class CounterSampleBuffer* sampleBuffer, NS::Range range, const class Buffer* destinationBuffer, NS::UInteger destinationOffset);
94
+ };
95
+
96
+ }
97
+
98
+ // method: synchronizeResource:
99
+ _MTL_INLINE void MTL::BlitCommandEncoder::synchronizeResource(const MTL::Resource* resource)
100
+ {
101
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(synchronizeResource_), resource);
102
+ }
103
+
104
+ // method: synchronizeTexture:slice:level:
105
+ _MTL_INLINE void MTL::BlitCommandEncoder::synchronizeTexture(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
106
+ {
107
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(synchronizeTexture_slice_level_), texture, slice, level);
108
+ }
109
+
110
+ // method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:
111
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin)
112
+ {
113
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin);
114
+ }
115
+
116
+ // method: copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:
117
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin)
118
+ {
119
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_), sourceBuffer, sourceOffset, sourceBytesPerRow, sourceBytesPerImage, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin);
120
+ }
121
+
122
+ // method: copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:
123
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options)
124
+ {
125
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options_), sourceBuffer, sourceOffset, sourceBytesPerRow, sourceBytesPerImage, sourceSize, destinationTexture, destinationSlice, destinationLevel, destinationOrigin, options);
126
+ }
127
+
128
+ // method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:
129
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage)
130
+ {
131
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationBuffer, destinationOffset, destinationBytesPerRow, destinationBytesPerImage);
132
+ }
133
+
134
+ // method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:options:
135
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options)
136
+ {
137
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options_), sourceTexture, sourceSlice, sourceLevel, sourceOrigin, sourceSize, destinationBuffer, destinationOffset, destinationBytesPerRow, destinationBytesPerImage, options);
138
+ }
139
+
140
+ // method: generateMipmapsForTexture:
141
+ _MTL_INLINE void MTL::BlitCommandEncoder::generateMipmaps(const MTL::Texture* texture)
142
+ {
143
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(generateMipmapsForTexture_), texture);
144
+ }
145
+
146
+ // method: fillBuffer:range:value:
147
+ _MTL_INLINE void MTL::BlitCommandEncoder::fillBuffer(const MTL::Buffer* buffer, NS::Range range, uint8_t value)
148
+ {
149
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(fillBuffer_range_value_), buffer, range, value);
150
+ }
151
+
152
+ // method: copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:
153
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount)
154
+ {
155
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount_), sourceTexture, sourceSlice, sourceLevel, destinationTexture, destinationSlice, destinationLevel, sliceCount, levelCount);
156
+ }
157
+
158
+ // method: copyFromTexture:toTexture:
159
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture)
160
+ {
161
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromTexture_toTexture_), sourceTexture, destinationTexture);
162
+ }
163
+
164
+ // method: copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:
165
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size)
166
+ {
167
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size_), sourceBuffer, sourceOffset, destinationBuffer, destinationOffset, size);
168
+ }
169
+
170
+ // method: updateFence:
171
+ _MTL_INLINE void MTL::BlitCommandEncoder::updateFence(const MTL::Fence* fence)
172
+ {
173
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
174
+ }
175
+
176
+ // method: waitForFence:
177
+ _MTL_INLINE void MTL::BlitCommandEncoder::waitForFence(const MTL::Fence* fence)
178
+ {
179
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
180
+ }
181
+
182
+ // method: getTextureAccessCounters:region:mipLevel:slice:resetCounters:countersBuffer:countersBufferOffset:
183
+ _MTL_INLINE void MTL::BlitCommandEncoder::getTextureAccessCounters(const MTL::Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice, bool resetCounters, const MTL::Buffer* countersBuffer, NS::UInteger countersBufferOffset)
184
+ {
185
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(getTextureAccessCounters_region_mipLevel_slice_resetCounters_countersBuffer_countersBufferOffset_), texture, region, mipLevel, slice, resetCounters, countersBuffer, countersBufferOffset);
186
+ }
187
+
188
+ // method: resetTextureAccessCounters:region:mipLevel:slice:
189
+ _MTL_INLINE void MTL::BlitCommandEncoder::resetTextureAccessCounters(const MTL::Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice)
190
+ {
191
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetTextureAccessCounters_region_mipLevel_slice_), texture, region, mipLevel, slice);
192
+ }
193
+
194
+ // method: optimizeContentsForGPUAccess:
195
+ _MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForGPUAccess(const MTL::Texture* texture)
196
+ {
197
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForGPUAccess_), texture);
198
+ }
199
+
200
+ // method: optimizeContentsForGPUAccess:slice:level:
201
+ _MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForGPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
202
+ {
203
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForGPUAccess_slice_level_), texture, slice, level);
204
+ }
205
+
206
+ // method: optimizeContentsForCPUAccess:
207
+ _MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForCPUAccess(const MTL::Texture* texture)
208
+ {
209
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForCPUAccess_), texture);
210
+ }
211
+
212
+ // method: optimizeContentsForCPUAccess:slice:level:
213
+ _MTL_INLINE void MTL::BlitCommandEncoder::optimizeContentsForCPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level)
214
+ {
215
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeContentsForCPUAccess_slice_level_), texture, slice, level);
216
+ }
217
+
218
+ // method: resetCommandsInBuffer:withRange:
219
+ _MTL_INLINE void MTL::BlitCommandEncoder::resetCommandsInBuffer(const MTL::IndirectCommandBuffer* buffer, NS::Range range)
220
+ {
221
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetCommandsInBuffer_withRange_), buffer, range);
222
+ }
223
+
224
+ // method: copyIndirectCommandBuffer:sourceRange:destination:destinationIndex:
225
+ _MTL_INLINE void MTL::BlitCommandEncoder::copyIndirectCommandBuffer(const MTL::IndirectCommandBuffer* source, NS::Range sourceRange, const MTL::IndirectCommandBuffer* destination, NS::UInteger destinationIndex)
226
+ {
227
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyIndirectCommandBuffer_sourceRange_destination_destinationIndex_), source, sourceRange, destination, destinationIndex);
228
+ }
229
+
230
+ // method: optimizeIndirectCommandBuffer:withRange:
231
+ _MTL_INLINE void MTL::BlitCommandEncoder::optimizeIndirectCommandBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range range)
232
+ {
233
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(optimizeIndirectCommandBuffer_withRange_), indirectCommandBuffer, range);
234
+ }
235
+
236
+ // method: sampleCountersInBuffer:atSampleIndex:withBarrier:
237
+ _MTL_INLINE void MTL::BlitCommandEncoder::sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier)
238
+ {
239
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleCountersInBuffer_atSampleIndex_withBarrier_), sampleBuffer, sampleIndex, barrier);
240
+ }
241
+
242
+ // method: resolveCounters:inRange:destinationBuffer:destinationOffset:
243
+ _MTL_INLINE void MTL::BlitCommandEncoder::resolveCounters(const MTL::CounterSampleBuffer* sampleBuffer, NS::Range range, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset)
244
+ {
245
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resolveCounters_inRange_destinationBuffer_destinationOffset_), sampleBuffer, range, destinationBuffer, destinationOffset);
246
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBlitPass.hpp ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLBlitPass.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+ class BlitPassSampleBufferAttachmentDescriptor : public NS::Copying<BlitPassSampleBufferAttachmentDescriptor>
32
+ {
33
+ public:
34
+ static class BlitPassSampleBufferAttachmentDescriptor* alloc();
35
+
36
+ class BlitPassSampleBufferAttachmentDescriptor* init();
37
+
38
+ class CounterSampleBuffer* sampleBuffer() const;
39
+ void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
40
+
41
+ NS::UInteger startOfEncoderSampleIndex() const;
42
+ void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
43
+
44
+ NS::UInteger endOfEncoderSampleIndex() const;
45
+ void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
46
+ };
47
+
48
+ class BlitPassSampleBufferAttachmentDescriptorArray : public NS::Referencing<BlitPassSampleBufferAttachmentDescriptorArray>
49
+ {
50
+ public:
51
+ static class BlitPassSampleBufferAttachmentDescriptorArray* alloc();
52
+
53
+ class BlitPassSampleBufferAttachmentDescriptorArray* init();
54
+
55
+ class BlitPassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
56
+
57
+ void setObject(const class BlitPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
58
+ };
59
+
60
+ class BlitPassDescriptor : public NS::Copying<BlitPassDescriptor>
61
+ {
62
+ public:
63
+ static class BlitPassDescriptor* alloc();
64
+
65
+ class BlitPassDescriptor* init();
66
+
67
+ static class BlitPassDescriptor* blitPassDescriptor();
68
+
69
+ class BlitPassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
70
+ };
71
+
72
+ }
73
+
74
+ // static method: alloc
75
+ _MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptor::alloc()
76
+ {
77
+ return NS::Object::alloc<MTL::BlitPassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLBlitPassSampleBufferAttachmentDescriptor));
78
+ }
79
+
80
+ // method: init
81
+ _MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptor::init()
82
+ {
83
+ return NS::Object::init<MTL::BlitPassSampleBufferAttachmentDescriptor>();
84
+ }
85
+
86
+ // property: sampleBuffer
87
+ _MTL_INLINE MTL::CounterSampleBuffer* MTL::BlitPassSampleBufferAttachmentDescriptor::sampleBuffer() const
88
+ {
89
+ return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
90
+ }
91
+
92
+ _MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
93
+ {
94
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
95
+ }
96
+
97
+ // property: startOfEncoderSampleIndex
98
+ _MTL_INLINE NS::UInteger MTL::BlitPassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
99
+ {
100
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
101
+ }
102
+
103
+ _MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
104
+ {
105
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
106
+ }
107
+
108
+ // property: endOfEncoderSampleIndex
109
+ _MTL_INLINE NS::UInteger MTL::BlitPassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
110
+ {
111
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
112
+ }
113
+
114
+ _MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
115
+ {
116
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
117
+ }
118
+
119
+ // static method: alloc
120
+ _MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassSampleBufferAttachmentDescriptorArray::alloc()
121
+ {
122
+ return NS::Object::alloc<MTL::BlitPassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLBlitPassSampleBufferAttachmentDescriptorArray));
123
+ }
124
+
125
+ // method: init
126
+ _MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassSampleBufferAttachmentDescriptorArray::init()
127
+ {
128
+ return NS::Object::init<MTL::BlitPassSampleBufferAttachmentDescriptorArray>();
129
+ }
130
+
131
+ // method: objectAtIndexedSubscript:
132
+ _MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptor* MTL::BlitPassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
133
+ {
134
+ return Object::sendMessage<MTL::BlitPassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
135
+ }
136
+
137
+ // method: setObject:atIndexedSubscript:
138
+ _MTL_INLINE void MTL::BlitPassSampleBufferAttachmentDescriptorArray::setObject(const MTL::BlitPassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
139
+ {
140
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
141
+ }
142
+
143
+ // static method: alloc
144
+ _MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::alloc()
145
+ {
146
+ return NS::Object::alloc<MTL::BlitPassDescriptor>(_MTL_PRIVATE_CLS(MTLBlitPassDescriptor));
147
+ }
148
+
149
+ // method: init
150
+ _MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::init()
151
+ {
152
+ return NS::Object::init<MTL::BlitPassDescriptor>();
153
+ }
154
+
155
+ // static method: blitPassDescriptor
156
+ _MTL_INLINE MTL::BlitPassDescriptor* MTL::BlitPassDescriptor::blitPassDescriptor()
157
+ {
158
+ return Object::sendMessage<MTL::BlitPassDescriptor*>(_MTL_PRIVATE_CLS(MTLBlitPassDescriptor), _MTL_PRIVATE_SEL(blitPassDescriptor));
159
+ }
160
+
161
+ // property: sampleBufferAttachments
162
+ _MTL_INLINE MTL::BlitPassSampleBufferAttachmentDescriptorArray* MTL::BlitPassDescriptor::sampleBufferAttachments() const
163
+ {
164
+ return Object::sendMessage<MTL::BlitPassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
165
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLBuffer.hpp ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLBuffer.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLResource.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ class Buffer : public NS::Referencing<Buffer, Resource>
34
+ {
35
+ public:
36
+ NS::UInteger length() const;
37
+
38
+ void* contents();
39
+
40
+ void didModifyRange(NS::Range range);
41
+
42
+ class Texture* newTexture(const class TextureDescriptor* descriptor, NS::UInteger offset, NS::UInteger bytesPerRow);
43
+
44
+ void addDebugMarker(const NS::String* marker, NS::Range range);
45
+
46
+ void removeAllDebugMarkers();
47
+
48
+ class Buffer* remoteStorageBuffer() const;
49
+
50
+ class Buffer* newRemoteBufferViewForDevice(const class Device* device);
51
+
52
+ uint64_t gpuAddress() const;
53
+ };
54
+
55
+ }
56
+
57
+ // property: length
58
+ _MTL_INLINE NS::UInteger MTL::Buffer::length() const
59
+ {
60
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(length));
61
+ }
62
+
63
+ // method: contents
64
+ _MTL_INLINE void* MTL::Buffer::contents()
65
+ {
66
+ return Object::sendMessage<void*>(this, _MTL_PRIVATE_SEL(contents));
67
+ }
68
+
69
+ // method: didModifyRange:
70
+ _MTL_INLINE void MTL::Buffer::didModifyRange(NS::Range range)
71
+ {
72
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(didModifyRange_), range);
73
+ }
74
+
75
+ // method: newTextureWithDescriptor:offset:bytesPerRow:
76
+ _MTL_INLINE MTL::Texture* MTL::Buffer::newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset, NS::UInteger bytesPerRow)
77
+ {
78
+ return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_offset_bytesPerRow_), descriptor, offset, bytesPerRow);
79
+ }
80
+
81
+ // method: addDebugMarker:range:
82
+ _MTL_INLINE void MTL::Buffer::addDebugMarker(const NS::String* marker, NS::Range range)
83
+ {
84
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addDebugMarker_range_), marker, range);
85
+ }
86
+
87
+ // method: removeAllDebugMarkers
88
+ _MTL_INLINE void MTL::Buffer::removeAllDebugMarkers()
89
+ {
90
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeAllDebugMarkers));
91
+ }
92
+
93
+ // property: remoteStorageBuffer
94
+ _MTL_INLINE MTL::Buffer* MTL::Buffer::remoteStorageBuffer() const
95
+ {
96
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(remoteStorageBuffer));
97
+ }
98
+
99
+ // method: newRemoteBufferViewForDevice:
100
+ _MTL_INLINE MTL::Buffer* MTL::Buffer::newRemoteBufferViewForDevice(const MTL::Device* device)
101
+ {
102
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newRemoteBufferViewForDevice_), device);
103
+ }
104
+
105
+ // property: gpuAddress
106
+ _MTL_INLINE uint64_t MTL::Buffer::gpuAddress() const
107
+ {
108
+ return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(gpuAddress));
109
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCaptureManager.hpp ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLCaptureManager.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLCaptureManager.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ _MTL_ENUM(NS::Integer, CaptureError) {
34
+ CaptureErrorNotSupported = 1,
35
+ CaptureErrorAlreadyCapturing = 2,
36
+ CaptureErrorInvalidDescriptor = 3,
37
+ };
38
+
39
+ _MTL_ENUM(NS::Integer, CaptureDestination) {
40
+ CaptureDestinationDeveloperTools = 1,
41
+ CaptureDestinationGPUTraceDocument = 2,
42
+ };
43
+
44
+ class CaptureDescriptor : public NS::Copying<CaptureDescriptor>
45
+ {
46
+ public:
47
+ static class CaptureDescriptor* alloc();
48
+
49
+ class CaptureDescriptor* init();
50
+
51
+ id captureObject() const;
52
+ void setCaptureObject(id captureObject);
53
+
54
+ MTL::CaptureDestination destination() const;
55
+ void setDestination(MTL::CaptureDestination destination);
56
+
57
+ NS::URL* outputURL() const;
58
+ void setOutputURL(const NS::URL* outputURL);
59
+ };
60
+
61
+ class CaptureManager : public NS::Referencing<CaptureManager>
62
+ {
63
+ public:
64
+ static class CaptureManager* alloc();
65
+
66
+ static class CaptureManager* sharedCaptureManager();
67
+
68
+ MTL::CaptureManager* init();
69
+
70
+ class CaptureScope* newCaptureScope(const class Device* device);
71
+
72
+ class CaptureScope* newCaptureScope(const class CommandQueue* commandQueue);
73
+
74
+ bool supportsDestination(MTL::CaptureDestination destination);
75
+
76
+ bool startCapture(const class CaptureDescriptor* descriptor, NS::Error** error);
77
+
78
+ void startCapture(const class Device* device);
79
+
80
+ void startCapture(const class CommandQueue* commandQueue);
81
+
82
+ void startCapture(const class CaptureScope* captureScope);
83
+
84
+ void stopCapture();
85
+
86
+ class CaptureScope* defaultCaptureScope() const;
87
+ void setDefaultCaptureScope(const class CaptureScope* defaultCaptureScope);
88
+
89
+ bool isCapturing() const;
90
+ };
91
+
92
+ }
93
+
94
+ // static method: alloc
95
+ _MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::alloc()
96
+ {
97
+ return NS::Object::alloc<MTL::CaptureDescriptor>(_MTL_PRIVATE_CLS(MTLCaptureDescriptor));
98
+ }
99
+
100
+ // method: init
101
+ _MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::init()
102
+ {
103
+ return NS::Object::init<MTL::CaptureDescriptor>();
104
+ }
105
+
106
+ // property: captureObject
107
+ _MTL_INLINE id MTL::CaptureDescriptor::captureObject() const
108
+ {
109
+ return Object::sendMessage<id>(this, _MTL_PRIVATE_SEL(captureObject));
110
+ }
111
+
112
+ _MTL_INLINE void MTL::CaptureDescriptor::setCaptureObject(id captureObject)
113
+ {
114
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCaptureObject_), captureObject);
115
+ }
116
+
117
+ // property: destination
118
+ _MTL_INLINE MTL::CaptureDestination MTL::CaptureDescriptor::destination() const
119
+ {
120
+ return Object::sendMessage<MTL::CaptureDestination>(this, _MTL_PRIVATE_SEL(destination));
121
+ }
122
+
123
+ _MTL_INLINE void MTL::CaptureDescriptor::setDestination(MTL::CaptureDestination destination)
124
+ {
125
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDestination_), destination);
126
+ }
127
+
128
+ // property: outputURL
129
+ _MTL_INLINE NS::URL* MTL::CaptureDescriptor::outputURL() const
130
+ {
131
+ return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(outputURL));
132
+ }
133
+
134
+ _MTL_INLINE void MTL::CaptureDescriptor::setOutputURL(const NS::URL* outputURL)
135
+ {
136
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOutputURL_), outputURL);
137
+ }
138
+
139
+ // static method: alloc
140
+ _MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::alloc()
141
+ {
142
+ return NS::Object::alloc<MTL::CaptureManager>(_MTL_PRIVATE_CLS(MTLCaptureManager));
143
+ }
144
+
145
+ // static method: sharedCaptureManager
146
+ _MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::sharedCaptureManager()
147
+ {
148
+ return Object::sendMessage<MTL::CaptureManager*>(_MTL_PRIVATE_CLS(MTLCaptureManager), _MTL_PRIVATE_SEL(sharedCaptureManager));
149
+ }
150
+
151
+ // method: init
152
+ _MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::init()
153
+ {
154
+ return NS::Object::init<MTL::CaptureManager>();
155
+ }
156
+
157
+ // method: newCaptureScopeWithDevice:
158
+ _MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::Device* device)
159
+ {
160
+ return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithDevice_), device);
161
+ }
162
+
163
+ // method: newCaptureScopeWithCommandQueue:
164
+ _MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::CommandQueue* commandQueue)
165
+ {
166
+ return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithCommandQueue_), commandQueue);
167
+ }
168
+
169
+ // method: supportsDestination:
170
+ _MTL_INLINE bool MTL::CaptureManager::supportsDestination(MTL::CaptureDestination destination)
171
+ {
172
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsDestination_), destination);
173
+ }
174
+
175
+ // method: startCaptureWithDescriptor:error:
176
+ _MTL_INLINE bool MTL::CaptureManager::startCapture(const MTL::CaptureDescriptor* descriptor, NS::Error** error)
177
+ {
178
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(startCaptureWithDescriptor_error_), descriptor, error);
179
+ }
180
+
181
+ // method: startCaptureWithDevice:
182
+ _MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::Device* device)
183
+ {
184
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithDevice_), device);
185
+ }
186
+
187
+ // method: startCaptureWithCommandQueue:
188
+ _MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CommandQueue* commandQueue)
189
+ {
190
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithCommandQueue_), commandQueue);
191
+ }
192
+
193
+ // method: startCaptureWithScope:
194
+ _MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CaptureScope* captureScope)
195
+ {
196
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithScope_), captureScope);
197
+ }
198
+
199
+ // method: stopCapture
200
+ _MTL_INLINE void MTL::CaptureManager::stopCapture()
201
+ {
202
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(stopCapture));
203
+ }
204
+
205
+ // property: defaultCaptureScope
206
+ _MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::defaultCaptureScope() const
207
+ {
208
+ return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(defaultCaptureScope));
209
+ }
210
+
211
+ _MTL_INLINE void MTL::CaptureManager::setDefaultCaptureScope(const MTL::CaptureScope* defaultCaptureScope)
212
+ {
213
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDefaultCaptureScope_), defaultCaptureScope);
214
+ }
215
+
216
+ // property: isCapturing
217
+ _MTL_INLINE bool MTL::CaptureManager::isCapturing() const
218
+ {
219
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isCapturing));
220
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCaptureScope.hpp ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLCaptureScope.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "MTLDefines.hpp"
26
+ #include "MTLPrivate.hpp"
27
+
28
+ #include "../Foundation/NSObject.hpp"
29
+ #include "../Foundation/NSString.hpp"
30
+
31
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
32
+
33
+ namespace MTL
34
+ {
35
+ class CaptureScope : public NS::Referencing<CaptureScope>
36
+ {
37
+ public:
38
+ class Device* device() const;
39
+
40
+ NS::String* label() const;
41
+ void setLabel(const NS::String* pLabel);
42
+
43
+ class CommandQueue* commandQueue() const;
44
+
45
+ void beginScope();
46
+ void endScope();
47
+ };
48
+ }
49
+
50
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
51
+
52
+ _MTL_INLINE MTL::Device* MTL::CaptureScope::device() const
53
+ {
54
+ return Object::sendMessage<Device*>(this, _MTL_PRIVATE_SEL(device));
55
+ }
56
+
57
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
58
+
59
+ _MTL_INLINE NS::String* MTL::CaptureScope::label() const
60
+ {
61
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
62
+ }
63
+
64
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
65
+
66
+ _MTL_INLINE void MTL::CaptureScope::setLabel(const NS::String* pLabel)
67
+ {
68
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), pLabel);
69
+ }
70
+
71
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
72
+
73
+ _MTL_INLINE MTL::CommandQueue* MTL::CaptureScope::commandQueue() const
74
+ {
75
+ return Object::sendMessage<CommandQueue*>(this, _MTL_PRIVATE_SEL(commandQueue));
76
+ }
77
+
78
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
79
+
80
+ _MTL_INLINE void MTL::CaptureScope::beginScope()
81
+ {
82
+ return Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(beginScope));
83
+ }
84
+
85
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
86
+
87
+ _MTL_INLINE void MTL::CaptureScope::endScope()
88
+ {
89
+ return Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endScope));
90
+ }
91
+
92
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCommandBuffer.hpp ADDED
@@ -0,0 +1,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLCommandBuffer.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLCommandBuffer.hpp"
30
+ #include <functional>
31
+
32
+ namespace MTL
33
+ {
34
+ _MTL_ENUM(NS::UInteger, CommandBufferStatus) {
35
+ CommandBufferStatusNotEnqueued = 0,
36
+ CommandBufferStatusEnqueued = 1,
37
+ CommandBufferStatusCommitted = 2,
38
+ CommandBufferStatusScheduled = 3,
39
+ CommandBufferStatusCompleted = 4,
40
+ CommandBufferStatusError = 5,
41
+ };
42
+
43
+ _MTL_ENUM(NS::UInteger, CommandBufferError) {
44
+ CommandBufferErrorNone = 0,
45
+ CommandBufferErrorInternal = 1,
46
+ CommandBufferErrorTimeout = 2,
47
+ CommandBufferErrorPageFault = 3,
48
+ CommandBufferErrorAccessRevoked = 4,
49
+ CommandBufferErrorBlacklisted = 4,
50
+ CommandBufferErrorNotPermitted = 7,
51
+ CommandBufferErrorOutOfMemory = 8,
52
+ CommandBufferErrorInvalidResource = 9,
53
+ CommandBufferErrorMemoryless = 10,
54
+ CommandBufferErrorDeviceRemoved = 11,
55
+ CommandBufferErrorStackOverflow = 12,
56
+ };
57
+
58
+ _MTL_OPTIONS(NS::UInteger, CommandBufferErrorOption) {
59
+ CommandBufferErrorOptionNone = 0,
60
+ CommandBufferErrorOptionEncoderExecutionStatus = 1,
61
+ };
62
+
63
+ _MTL_ENUM(NS::Integer, CommandEncoderErrorState) {
64
+ CommandEncoderErrorStateUnknown = 0,
65
+ CommandEncoderErrorStateCompleted = 1,
66
+ CommandEncoderErrorStateAffected = 2,
67
+ CommandEncoderErrorStatePending = 3,
68
+ CommandEncoderErrorStateFaulted = 4,
69
+ };
70
+
71
+ class CommandBufferDescriptor : public NS::Copying<CommandBufferDescriptor>
72
+ {
73
+ public:
74
+ static class CommandBufferDescriptor* alloc();
75
+
76
+ class CommandBufferDescriptor* init();
77
+
78
+ bool retainedReferences() const;
79
+ void setRetainedReferences(bool retainedReferences);
80
+
81
+ MTL::CommandBufferErrorOption errorOptions() const;
82
+ void setErrorOptions(MTL::CommandBufferErrorOption errorOptions);
83
+ };
84
+
85
+ class CommandBufferEncoderInfo : public NS::Referencing<CommandBufferEncoderInfo>
86
+ {
87
+ public:
88
+ NS::String* label() const;
89
+
90
+ NS::Array* debugSignposts() const;
91
+
92
+ MTL::CommandEncoderErrorState errorState() const;
93
+ };
94
+
95
+ _MTL_ENUM(NS::UInteger, DispatchType) {
96
+ DispatchTypeSerial = 0,
97
+ DispatchTypeConcurrent = 1,
98
+ };
99
+
100
+ class CommandBuffer;
101
+
102
+ using CommandBufferHandler = void (^)(CommandBuffer*);
103
+
104
+ using HandlerFunction = std::function<void(CommandBuffer*)>;
105
+
106
+ class CommandBuffer : public NS::Referencing<CommandBuffer>
107
+ {
108
+ public:
109
+ void addScheduledHandler(const HandlerFunction& function);
110
+
111
+ void addCompletedHandler(const HandlerFunction& function);
112
+
113
+ class Device* device() const;
114
+
115
+ class CommandQueue* commandQueue() const;
116
+
117
+ bool retainedReferences() const;
118
+
119
+ MTL::CommandBufferErrorOption errorOptions() const;
120
+
121
+ NS::String* label() const;
122
+ void setLabel(const NS::String* label);
123
+
124
+ CFTimeInterval kernelStartTime() const;
125
+
126
+ CFTimeInterval kernelEndTime() const;
127
+
128
+ class LogContainer* logs() const;
129
+
130
+ CFTimeInterval GPUStartTime() const;
131
+
132
+ CFTimeInterval GPUEndTime() const;
133
+
134
+ void enqueue();
135
+
136
+ void commit();
137
+
138
+ void addScheduledHandler(const MTL::CommandBufferHandler block);
139
+
140
+ void presentDrawable(const class Drawable* drawable);
141
+
142
+ void presentDrawableAtTime(const class Drawable* drawable, CFTimeInterval presentationTime);
143
+
144
+ void presentDrawableAfterMinimumDuration(const class Drawable* drawable, CFTimeInterval duration);
145
+
146
+ void waitUntilScheduled();
147
+
148
+ void addCompletedHandler(const MTL::CommandBufferHandler block);
149
+
150
+ void waitUntilCompleted();
151
+
152
+ MTL::CommandBufferStatus status() const;
153
+
154
+ NS::Error* error() const;
155
+
156
+ class BlitCommandEncoder* blitCommandEncoder();
157
+
158
+ class RenderCommandEncoder* renderCommandEncoder(const class RenderPassDescriptor* renderPassDescriptor);
159
+
160
+ class ComputeCommandEncoder* computeCommandEncoder(const class ComputePassDescriptor* computePassDescriptor);
161
+
162
+ class BlitCommandEncoder* blitCommandEncoder(const class BlitPassDescriptor* blitPassDescriptor);
163
+
164
+ class ComputeCommandEncoder* computeCommandEncoder();
165
+
166
+ class ComputeCommandEncoder* computeCommandEncoder(MTL::DispatchType dispatchType);
167
+
168
+ void encodeWait(const class Event* event, uint64_t value);
169
+
170
+ void encodeSignalEvent(const class Event* event, uint64_t value);
171
+
172
+ class ParallelRenderCommandEncoder* parallelRenderCommandEncoder(const class RenderPassDescriptor* renderPassDescriptor);
173
+
174
+ class ResourceStateCommandEncoder* resourceStateCommandEncoder();
175
+
176
+ class ResourceStateCommandEncoder* resourceStateCommandEncoder(const class ResourceStatePassDescriptor* resourceStatePassDescriptor);
177
+
178
+ class AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder();
179
+
180
+ class AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder(const class AccelerationStructurePassDescriptor* descriptor);
181
+
182
+ void pushDebugGroup(const NS::String* string);
183
+
184
+ void popDebugGroup();
185
+ };
186
+
187
+ }
188
+
189
+ // static method: alloc
190
+ _MTL_INLINE MTL::CommandBufferDescriptor* MTL::CommandBufferDescriptor::alloc()
191
+ {
192
+ return NS::Object::alloc<MTL::CommandBufferDescriptor>(_MTL_PRIVATE_CLS(MTLCommandBufferDescriptor));
193
+ }
194
+
195
+ // method: init
196
+ _MTL_INLINE MTL::CommandBufferDescriptor* MTL::CommandBufferDescriptor::init()
197
+ {
198
+ return NS::Object::init<MTL::CommandBufferDescriptor>();
199
+ }
200
+
201
+ // property: retainedReferences
202
+ _MTL_INLINE bool MTL::CommandBufferDescriptor::retainedReferences() const
203
+ {
204
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(retainedReferences));
205
+ }
206
+
207
+ _MTL_INLINE void MTL::CommandBufferDescriptor::setRetainedReferences(bool retainedReferences)
208
+ {
209
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRetainedReferences_), retainedReferences);
210
+ }
211
+
212
+ // property: errorOptions
213
+ _MTL_INLINE MTL::CommandBufferErrorOption MTL::CommandBufferDescriptor::errorOptions() const
214
+ {
215
+ return Object::sendMessage<MTL::CommandBufferErrorOption>(this, _MTL_PRIVATE_SEL(errorOptions));
216
+ }
217
+
218
+ _MTL_INLINE void MTL::CommandBufferDescriptor::setErrorOptions(MTL::CommandBufferErrorOption errorOptions)
219
+ {
220
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setErrorOptions_), errorOptions);
221
+ }
222
+
223
+ // property: label
224
+ _MTL_INLINE NS::String* MTL::CommandBufferEncoderInfo::label() const
225
+ {
226
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
227
+ }
228
+
229
+ // property: debugSignposts
230
+ _MTL_INLINE NS::Array* MTL::CommandBufferEncoderInfo::debugSignposts() const
231
+ {
232
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(debugSignposts));
233
+ }
234
+
235
+ // property: errorState
236
+ _MTL_INLINE MTL::CommandEncoderErrorState MTL::CommandBufferEncoderInfo::errorState() const
237
+ {
238
+ return Object::sendMessage<MTL::CommandEncoderErrorState>(this, _MTL_PRIVATE_SEL(errorState));
239
+ }
240
+
241
+ _MTL_INLINE void MTL::CommandBuffer::addScheduledHandler(const HandlerFunction& function)
242
+ {
243
+ __block HandlerFunction blockFunction = function;
244
+
245
+ addScheduledHandler(^(MTL::CommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
246
+ }
247
+
248
+ _MTL_INLINE void MTL::CommandBuffer::addCompletedHandler(const HandlerFunction& function)
249
+ {
250
+ __block HandlerFunction blockFunction = function;
251
+
252
+ addCompletedHandler(^(MTL::CommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
253
+ }
254
+
255
+ // property: device
256
+ _MTL_INLINE MTL::Device* MTL::CommandBuffer::device() const
257
+ {
258
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
259
+ }
260
+
261
+ // property: commandQueue
262
+ _MTL_INLINE MTL::CommandQueue* MTL::CommandBuffer::commandQueue() const
263
+ {
264
+ return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(commandQueue));
265
+ }
266
+
267
+ // property: retainedReferences
268
+ _MTL_INLINE bool MTL::CommandBuffer::retainedReferences() const
269
+ {
270
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(retainedReferences));
271
+ }
272
+
273
+ // property: errorOptions
274
+ _MTL_INLINE MTL::CommandBufferErrorOption MTL::CommandBuffer::errorOptions() const
275
+ {
276
+ return Object::sendMessage<MTL::CommandBufferErrorOption>(this, _MTL_PRIVATE_SEL(errorOptions));
277
+ }
278
+
279
+ // property: label
280
+ _MTL_INLINE NS::String* MTL::CommandBuffer::label() const
281
+ {
282
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
283
+ }
284
+
285
+ _MTL_INLINE void MTL::CommandBuffer::setLabel(const NS::String* label)
286
+ {
287
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
288
+ }
289
+
290
+ // property: kernelStartTime
291
+ _MTL_INLINE CFTimeInterval MTL::CommandBuffer::kernelStartTime() const
292
+ {
293
+ return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(kernelStartTime));
294
+ }
295
+
296
+ // property: kernelEndTime
297
+ _MTL_INLINE CFTimeInterval MTL::CommandBuffer::kernelEndTime() const
298
+ {
299
+ return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(kernelEndTime));
300
+ }
301
+
302
+ // property: logs
303
+ _MTL_INLINE MTL::LogContainer* MTL::CommandBuffer::logs() const
304
+ {
305
+ return Object::sendMessage<MTL::LogContainer*>(this, _MTL_PRIVATE_SEL(logs));
306
+ }
307
+
308
+ // property: GPUStartTime
309
+ _MTL_INLINE CFTimeInterval MTL::CommandBuffer::GPUStartTime() const
310
+ {
311
+ return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUStartTime));
312
+ }
313
+
314
+ // property: GPUEndTime
315
+ _MTL_INLINE CFTimeInterval MTL::CommandBuffer::GPUEndTime() const
316
+ {
317
+ return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(GPUEndTime));
318
+ }
319
+
320
+ // method: enqueue
321
+ _MTL_INLINE void MTL::CommandBuffer::enqueue()
322
+ {
323
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(enqueue));
324
+ }
325
+
326
+ // method: commit
327
+ _MTL_INLINE void MTL::CommandBuffer::commit()
328
+ {
329
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit));
330
+ }
331
+
332
+ // method: addScheduledHandler:
333
+ _MTL_INLINE void MTL::CommandBuffer::addScheduledHandler(const MTL::CommandBufferHandler block)
334
+ {
335
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addScheduledHandler_), block);
336
+ }
337
+
338
+ // method: presentDrawable:
339
+ _MTL_INLINE void MTL::CommandBuffer::presentDrawable(const MTL::Drawable* drawable)
340
+ {
341
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_), drawable);
342
+ }
343
+
344
+ // method: presentDrawable:atTime:
345
+ _MTL_INLINE void MTL::CommandBuffer::presentDrawableAtTime(const MTL::Drawable* drawable, CFTimeInterval presentationTime)
346
+ {
347
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_atTime_), drawable, presentationTime);
348
+ }
349
+
350
+ // method: presentDrawable:afterMinimumDuration:
351
+ _MTL_INLINE void MTL::CommandBuffer::presentDrawableAfterMinimumDuration(const MTL::Drawable* drawable, CFTimeInterval duration)
352
+ {
353
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentDrawable_afterMinimumDuration_), drawable, duration);
354
+ }
355
+
356
+ // method: waitUntilScheduled
357
+ _MTL_INLINE void MTL::CommandBuffer::waitUntilScheduled()
358
+ {
359
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilScheduled));
360
+ }
361
+
362
+ // method: addCompletedHandler:
363
+ _MTL_INLINE void MTL::CommandBuffer::addCompletedHandler(const MTL::CommandBufferHandler block)
364
+ {
365
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addCompletedHandler_), block);
366
+ }
367
+
368
+ // method: waitUntilCompleted
369
+ _MTL_INLINE void MTL::CommandBuffer::waitUntilCompleted()
370
+ {
371
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilCompleted));
372
+ }
373
+
374
+ // property: status
375
+ _MTL_INLINE MTL::CommandBufferStatus MTL::CommandBuffer::status() const
376
+ {
377
+ return Object::sendMessage<MTL::CommandBufferStatus>(this, _MTL_PRIVATE_SEL(status));
378
+ }
379
+
380
+ // property: error
381
+ _MTL_INLINE NS::Error* MTL::CommandBuffer::error() const
382
+ {
383
+ return Object::sendMessage<NS::Error*>(this, _MTL_PRIVATE_SEL(error));
384
+ }
385
+
386
+ // method: blitCommandEncoder
387
+ _MTL_INLINE MTL::BlitCommandEncoder* MTL::CommandBuffer::blitCommandEncoder()
388
+ {
389
+ return Object::sendMessage<MTL::BlitCommandEncoder*>(this, _MTL_PRIVATE_SEL(blitCommandEncoder));
390
+ }
391
+
392
+ // method: renderCommandEncoderWithDescriptor:
393
+ _MTL_INLINE MTL::RenderCommandEncoder* MTL::CommandBuffer::renderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor)
394
+ {
395
+ return Object::sendMessage<MTL::RenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(renderCommandEncoderWithDescriptor_), renderPassDescriptor);
396
+ }
397
+
398
+ // method: computeCommandEncoderWithDescriptor:
399
+ _MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder(const MTL::ComputePassDescriptor* computePassDescriptor)
400
+ {
401
+ return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoderWithDescriptor_), computePassDescriptor);
402
+ }
403
+
404
+ // method: blitCommandEncoderWithDescriptor:
405
+ _MTL_INLINE MTL::BlitCommandEncoder* MTL::CommandBuffer::blitCommandEncoder(const MTL::BlitPassDescriptor* blitPassDescriptor)
406
+ {
407
+ return Object::sendMessage<MTL::BlitCommandEncoder*>(this, _MTL_PRIVATE_SEL(blitCommandEncoderWithDescriptor_), blitPassDescriptor);
408
+ }
409
+
410
+ // method: computeCommandEncoder
411
+ _MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder()
412
+ {
413
+ return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoder));
414
+ }
415
+
416
+ // method: computeCommandEncoderWithDispatchType:
417
+ _MTL_INLINE MTL::ComputeCommandEncoder* MTL::CommandBuffer::computeCommandEncoder(MTL::DispatchType dispatchType)
418
+ {
419
+ return Object::sendMessage<MTL::ComputeCommandEncoder*>(this, _MTL_PRIVATE_SEL(computeCommandEncoderWithDispatchType_), dispatchType);
420
+ }
421
+
422
+ // method: encodeWaitForEvent:value:
423
+ _MTL_INLINE void MTL::CommandBuffer::encodeWait(const MTL::Event* event, uint64_t value)
424
+ {
425
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(encodeWaitForEvent_value_), event, value);
426
+ }
427
+
428
+ // method: encodeSignalEvent:value:
429
+ _MTL_INLINE void MTL::CommandBuffer::encodeSignalEvent(const MTL::Event* event, uint64_t value)
430
+ {
431
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(encodeSignalEvent_value_), event, value);
432
+ }
433
+
434
+ // method: parallelRenderCommandEncoderWithDescriptor:
435
+ _MTL_INLINE MTL::ParallelRenderCommandEncoder* MTL::CommandBuffer::parallelRenderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor)
436
+ {
437
+ return Object::sendMessage<MTL::ParallelRenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(parallelRenderCommandEncoderWithDescriptor_), renderPassDescriptor);
438
+ }
439
+
440
+ // method: resourceStateCommandEncoder
441
+ _MTL_INLINE MTL::ResourceStateCommandEncoder* MTL::CommandBuffer::resourceStateCommandEncoder()
442
+ {
443
+ return Object::sendMessage<MTL::ResourceStateCommandEncoder*>(this, _MTL_PRIVATE_SEL(resourceStateCommandEncoder));
444
+ }
445
+
446
+ // method: resourceStateCommandEncoderWithDescriptor:
447
+ _MTL_INLINE MTL::ResourceStateCommandEncoder* MTL::CommandBuffer::resourceStateCommandEncoder(const MTL::ResourceStatePassDescriptor* resourceStatePassDescriptor)
448
+ {
449
+ return Object::sendMessage<MTL::ResourceStateCommandEncoder*>(this, _MTL_PRIVATE_SEL(resourceStateCommandEncoderWithDescriptor_), resourceStatePassDescriptor);
450
+ }
451
+
452
+ // method: accelerationStructureCommandEncoder
453
+ _MTL_INLINE MTL::AccelerationStructureCommandEncoder* MTL::CommandBuffer::accelerationStructureCommandEncoder()
454
+ {
455
+ return Object::sendMessage<MTL::AccelerationStructureCommandEncoder*>(this, _MTL_PRIVATE_SEL(accelerationStructureCommandEncoder));
456
+ }
457
+
458
+ // method: accelerationStructureCommandEncoderWithDescriptor:
459
+ _MTL_INLINE MTL::AccelerationStructureCommandEncoder* MTL::CommandBuffer::accelerationStructureCommandEncoder(const MTL::AccelerationStructurePassDescriptor* descriptor)
460
+ {
461
+ return Object::sendMessage<MTL::AccelerationStructureCommandEncoder*>(this, _MTL_PRIVATE_SEL(accelerationStructureCommandEncoderWithDescriptor_), descriptor);
462
+ }
463
+
464
+ // method: pushDebugGroup:
465
+ _MTL_INLINE void MTL::CommandBuffer::pushDebugGroup(const NS::String* string)
466
+ {
467
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
468
+ }
469
+
470
+ // method: popDebugGroup
471
+ _MTL_INLINE void MTL::CommandBuffer::popDebugGroup()
472
+ {
473
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
474
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCommandEncoder.hpp ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLCommandEncoder.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+ _MTL_OPTIONS(NS::UInteger, ResourceUsage) {
32
+ ResourceUsageRead = 1,
33
+ ResourceUsageWrite = 2,
34
+ ResourceUsageSample = 4,
35
+ };
36
+
37
+ _MTL_OPTIONS(NS::UInteger, BarrierScope) {
38
+ BarrierScopeBuffers = 1,
39
+ BarrierScopeTextures = 2,
40
+ BarrierScopeRenderTargets = 4,
41
+ };
42
+
43
+ class CommandEncoder : public NS::Referencing<CommandEncoder>
44
+ {
45
+ public:
46
+ class Device* device() const;
47
+
48
+ NS::String* label() const;
49
+ void setLabel(const NS::String* label);
50
+
51
+ void endEncoding();
52
+
53
+ void insertDebugSignpost(const NS::String* string);
54
+
55
+ void pushDebugGroup(const NS::String* string);
56
+
57
+ void popDebugGroup();
58
+ };
59
+
60
+ }
61
+
62
+ // property: device
63
+ _MTL_INLINE MTL::Device* MTL::CommandEncoder::device() const
64
+ {
65
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
66
+ }
67
+
68
+ // property: label
69
+ _MTL_INLINE NS::String* MTL::CommandEncoder::label() const
70
+ {
71
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
72
+ }
73
+
74
+ _MTL_INLINE void MTL::CommandEncoder::setLabel(const NS::String* label)
75
+ {
76
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
77
+ }
78
+
79
+ // method: endEncoding
80
+ _MTL_INLINE void MTL::CommandEncoder::endEncoding()
81
+ {
82
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));
83
+ }
84
+
85
+ // method: insertDebugSignpost:
86
+ _MTL_INLINE void MTL::CommandEncoder::insertDebugSignpost(const NS::String* string)
87
+ {
88
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);
89
+ }
90
+
91
+ // method: pushDebugGroup:
92
+ _MTL_INLINE void MTL::CommandEncoder::pushDebugGroup(const NS::String* string)
93
+ {
94
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
95
+ }
96
+
97
+ // method: popDebugGroup
98
+ _MTL_INLINE void MTL::CommandEncoder::popDebugGroup()
99
+ {
100
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
101
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCommandQueue.hpp ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLCommandQueue.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+ class CommandQueue : public NS::Referencing<CommandQueue>
32
+ {
33
+ public:
34
+ NS::String* label() const;
35
+ void setLabel(const NS::String* label);
36
+
37
+ class Device* device() const;
38
+
39
+ class CommandBuffer* commandBuffer();
40
+
41
+ class CommandBuffer* commandBuffer(const class CommandBufferDescriptor* descriptor);
42
+
43
+ class CommandBuffer* commandBufferWithUnretainedReferences();
44
+
45
+ void insertDebugCaptureBoundary();
46
+ };
47
+
48
+ }
49
+
50
+ // property: label
51
+ _MTL_INLINE NS::String* MTL::CommandQueue::label() const
52
+ {
53
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
54
+ }
55
+
56
+ _MTL_INLINE void MTL::CommandQueue::setLabel(const NS::String* label)
57
+ {
58
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
59
+ }
60
+
61
+ // property: device
62
+ _MTL_INLINE MTL::Device* MTL::CommandQueue::device() const
63
+ {
64
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
65
+ }
66
+
67
+ // method: commandBuffer
68
+ _MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer()
69
+ {
70
+ return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
71
+ }
72
+
73
+ // method: commandBufferWithDescriptor:
74
+ _MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer(const MTL::CommandBufferDescriptor* descriptor)
75
+ {
76
+ return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithDescriptor_), descriptor);
77
+ }
78
+
79
+ // method: commandBufferWithUnretainedReferences
80
+ _MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBufferWithUnretainedReferences()
81
+ {
82
+ return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences));
83
+ }
84
+
85
+ // method: insertDebugCaptureBoundary
86
+ _MTL_INLINE void MTL::CommandQueue::insertDebugCaptureBoundary()
87
+ {
88
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugCaptureBoundary));
89
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLComputeCommandEncoder.hpp ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLComputeCommandEncoder.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLCommandBuffer.hpp"
30
+ #include "MTLCommandEncoder.hpp"
31
+ #include "MTLTypes.hpp"
32
+
33
+ namespace MTL
34
+ {
35
+ struct DispatchThreadgroupsIndirectArguments
36
+ {
37
+ uint32_t threadgroupsPerGrid[3];
38
+ } _MTL_PACKED;
39
+
40
+ struct StageInRegionIndirectArguments
41
+ {
42
+ uint32_t stageInOrigin[3];
43
+ uint32_t stageInSize[3];
44
+ } _MTL_PACKED;
45
+
46
+ class ComputeCommandEncoder : public NS::Referencing<ComputeCommandEncoder, CommandEncoder>
47
+ {
48
+ public:
49
+ MTL::DispatchType dispatchType() const;
50
+
51
+ void setComputePipelineState(const class ComputePipelineState* state);
52
+
53
+ void setBytes(const void* bytes, NS::UInteger length, NS::UInteger index);
54
+
55
+ void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
56
+
57
+ void setBufferOffset(NS::UInteger offset, NS::UInteger index);
58
+
59
+ void setBuffers(const class Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
60
+
61
+ void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
62
+
63
+ void setBuffers(const class Buffer* const buffers[], const NS::UInteger* offsets, const NS::UInteger* strides, NS::Range range);
64
+
65
+ void setBufferOffset(NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
66
+
67
+ void setBytes(const void* bytes, NS::UInteger length, NS::UInteger stride, NS::UInteger index);
68
+
69
+ void setVisibleFunctionTable(const class VisibleFunctionTable* visibleFunctionTable, NS::UInteger bufferIndex);
70
+
71
+ void setVisibleFunctionTables(const class VisibleFunctionTable* const visibleFunctionTables[], NS::Range range);
72
+
73
+ void setIntersectionFunctionTable(const class IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger bufferIndex);
74
+
75
+ void setIntersectionFunctionTables(const class IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range);
76
+
77
+ void setAccelerationStructure(const class AccelerationStructure* accelerationStructure, NS::UInteger bufferIndex);
78
+
79
+ void setTexture(const class Texture* texture, NS::UInteger index);
80
+
81
+ void setTextures(const class Texture* const textures[], NS::Range range);
82
+
83
+ void setSamplerState(const class SamplerState* sampler, NS::UInteger index);
84
+
85
+ void setSamplerStates(const class SamplerState* const samplers[], NS::Range range);
86
+
87
+ void setSamplerState(const class SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);
88
+
89
+ void setSamplerStates(const class SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range);
90
+
91
+ void setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
92
+
93
+ void setImageblockWidth(NS::UInteger width, NS::UInteger height);
94
+
95
+ void setStageInRegion(MTL::Region region);
96
+
97
+ void setStageInRegion(const class Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);
98
+
99
+ void dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);
100
+
101
+ void dispatchThreadgroups(const class Buffer* indirectBuffer, NS::UInteger indirectBufferOffset, MTL::Size threadsPerThreadgroup);
102
+
103
+ void dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup);
104
+
105
+ void updateFence(const class Fence* fence);
106
+
107
+ void waitForFence(const class Fence* fence);
108
+
109
+ void useResource(const class Resource* resource, MTL::ResourceUsage usage);
110
+
111
+ void useResources(const class Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);
112
+
113
+ void useHeap(const class Heap* heap);
114
+
115
+ void useHeaps(const class Heap* const heaps[], NS::UInteger count);
116
+
117
+ void executeCommandsInBuffer(const class IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);
118
+
119
+ void executeCommandsInBuffer(const class IndirectCommandBuffer* indirectCommandbuffer, const class Buffer* indirectRangeBuffer, NS::UInteger indirectBufferOffset);
120
+
121
+ void memoryBarrier(MTL::BarrierScope scope);
122
+
123
+ void memoryBarrier(const class Resource* const resources[], NS::UInteger count);
124
+
125
+ void sampleCountersInBuffer(const class CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier);
126
+ };
127
+
128
+ }
129
+
130
+ // property: dispatchType
131
+ _MTL_INLINE MTL::DispatchType MTL::ComputeCommandEncoder::dispatchType() const
132
+ {
133
+ return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType));
134
+ }
135
+
136
+ // method: setComputePipelineState:
137
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setComputePipelineState(const MTL::ComputePipelineState* state)
138
+ {
139
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_), state);
140
+ }
141
+
142
+ // method: setBytes:length:atIndex:
143
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBytes(const void* bytes, NS::UInteger length, NS::UInteger index)
144
+ {
145
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBytes_length_atIndex_), bytes, length, index);
146
+ }
147
+
148
+ // method: setBuffer:offset:atIndex:
149
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
150
+ {
151
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index);
152
+ }
153
+
154
+ // method: setBufferOffset:atIndex:
155
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBufferOffset(NS::UInteger offset, NS::UInteger index)
156
+ {
157
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBufferOffset_atIndex_), offset, index);
158
+ }
159
+
160
+ // method: setBuffers:offsets:withRange:
161
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range)
162
+ {
163
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_withRange_), buffers, offsets, range);
164
+ }
165
+
166
+ // method: setBuffer:offset:attributeStride:atIndex:
167
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
168
+ {
169
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_attributeStride_atIndex_), buffer, offset, stride, index);
170
+ }
171
+
172
+ // method: setBuffers:offsets:attributeStrides:withRange:
173
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger* offsets, const NS::UInteger* strides, NS::Range range)
174
+ {
175
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_attributeStrides_withRange_), buffers, offsets, strides, range);
176
+ }
177
+
178
+ // method: setBufferOffset:attributeStride:atIndex:
179
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBufferOffset(NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
180
+ {
181
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBufferOffset_attributeStride_atIndex_), offset, stride, index);
182
+ }
183
+
184
+ // method: setBytes:length:attributeStride:atIndex:
185
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setBytes(const void* bytes, NS::UInteger length, NS::UInteger stride, NS::UInteger index)
186
+ {
187
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBytes_length_attributeStride_atIndex_), bytes, length, stride, index);
188
+ }
189
+
190
+ // method: setVisibleFunctionTable:atBufferIndex:
191
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setVisibleFunctionTable(const MTL::VisibleFunctionTable* visibleFunctionTable, NS::UInteger bufferIndex)
192
+ {
193
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atBufferIndex_), visibleFunctionTable, bufferIndex);
194
+ }
195
+
196
+ // method: setVisibleFunctionTables:withBufferRange:
197
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const visibleFunctionTables[], NS::Range range)
198
+ {
199
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withBufferRange_), visibleFunctionTables, range);
200
+ }
201
+
202
+ // method: setIntersectionFunctionTable:atBufferIndex:
203
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setIntersectionFunctionTable(const MTL::IntersectionFunctionTable* intersectionFunctionTable, NS::UInteger bufferIndex)
204
+ {
205
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTable_atBufferIndex_), intersectionFunctionTable, bufferIndex);
206
+ }
207
+
208
+ // method: setIntersectionFunctionTables:withBufferRange:
209
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setIntersectionFunctionTables(const MTL::IntersectionFunctionTable* const intersectionFunctionTables[], NS::Range range)
210
+ {
211
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIntersectionFunctionTables_withBufferRange_), intersectionFunctionTables, range);
212
+ }
213
+
214
+ // method: setAccelerationStructure:atBufferIndex:
215
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, NS::UInteger bufferIndex)
216
+ {
217
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccelerationStructure_atBufferIndex_), accelerationStructure, bufferIndex);
218
+ }
219
+
220
+ // method: setTexture:atIndex:
221
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setTexture(const MTL::Texture* texture, NS::UInteger index)
222
+ {
223
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), texture, index);
224
+ }
225
+
226
+ // method: setTextures:withRange:
227
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setTextures(const MTL::Texture* const textures[], NS::Range range)
228
+ {
229
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextures_withRange_), textures, range);
230
+ }
231
+
232
+ // method: setSamplerState:atIndex:
233
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index)
234
+ {
235
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), sampler, index);
236
+ }
237
+
238
+ // method: setSamplerStates:withRange:
239
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range)
240
+ {
241
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_withRange_), samplers, range);
242
+ }
243
+
244
+ // method: setSamplerState:lodMinClamp:lodMaxClamp:atIndex:
245
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index)
246
+ {
247
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_lodMinClamp_lodMaxClamp_atIndex_), sampler, lodMinClamp, lodMaxClamp, index);
248
+ }
249
+
250
+ // method: setSamplerStates:lodMinClamps:lodMaxClamps:withRange:
251
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setSamplerStates(const MTL::SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range)
252
+ {
253
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerStates_lodMinClamps_lodMaxClamps_withRange_), samplers, lodMinClamps, lodMaxClamps, range);
254
+ }
255
+
256
+ // method: setThreadgroupMemoryLength:atIndex:
257
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
258
+ {
259
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_atIndex_), length, index);
260
+ }
261
+
262
+ // method: setImageblockWidth:height:
263
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setImageblockWidth(NS::UInteger width, NS::UInteger height)
264
+ {
265
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockWidth_height_), width, height);
266
+ }
267
+
268
+ // method: setStageInRegion:
269
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setStageInRegion(MTL::Region region)
270
+ {
271
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegion_), region);
272
+ }
273
+
274
+ // method: setStageInRegionWithIndirectBuffer:indirectBufferOffset:
275
+ _MTL_INLINE void MTL::ComputeCommandEncoder::setStageInRegion(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset)
276
+ {
277
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegionWithIndirectBuffer_indirectBufferOffset_), indirectBuffer, indirectBufferOffset);
278
+ }
279
+
280
+ // method: dispatchThreadgroups:threadsPerThreadgroup:
281
+ _MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup)
282
+ {
283
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadgroups_threadsPerThreadgroup_), threadgroupsPerGrid, threadsPerThreadgroup);
284
+ }
285
+
286
+ // method: dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:
287
+ _MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreadgroups(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset, MTL::Size threadsPerThreadgroup)
288
+ {
289
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreadgroupsWithIndirectBuffer_indirectBufferOffset_threadsPerThreadgroup_), indirectBuffer, indirectBufferOffset, threadsPerThreadgroup);
290
+ }
291
+
292
+ // method: dispatchThreads:threadsPerThreadgroup:
293
+ _MTL_INLINE void MTL::ComputeCommandEncoder::dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup)
294
+ {
295
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(dispatchThreads_threadsPerThreadgroup_), threadsPerGrid, threadsPerThreadgroup);
296
+ }
297
+
298
+ // method: updateFence:
299
+ _MTL_INLINE void MTL::ComputeCommandEncoder::updateFence(const MTL::Fence* fence)
300
+ {
301
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_), fence);
302
+ }
303
+
304
+ // method: waitForFence:
305
+ _MTL_INLINE void MTL::ComputeCommandEncoder::waitForFence(const MTL::Fence* fence)
306
+ {
307
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_), fence);
308
+ }
309
+
310
+ // method: useResource:usage:
311
+ _MTL_INLINE void MTL::ComputeCommandEncoder::useResource(const MTL::Resource* resource, MTL::ResourceUsage usage)
312
+ {
313
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResource_usage_), resource, usage);
314
+ }
315
+
316
+ // method: useResources:count:usage:
317
+ _MTL_INLINE void MTL::ComputeCommandEncoder::useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage)
318
+ {
319
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useResources_count_usage_), resources, count, usage);
320
+ }
321
+
322
+ // method: useHeap:
323
+ _MTL_INLINE void MTL::ComputeCommandEncoder::useHeap(const MTL::Heap* heap)
324
+ {
325
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeap_), heap);
326
+ }
327
+
328
+ // method: useHeaps:count:
329
+ _MTL_INLINE void MTL::ComputeCommandEncoder::useHeaps(const MTL::Heap* const heaps[], NS::UInteger count)
330
+ {
331
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(useHeaps_count_), heaps, count);
332
+ }
333
+
334
+ // method: executeCommandsInBuffer:withRange:
335
+ _MTL_INLINE void MTL::ComputeCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange)
336
+ {
337
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_withRange_), indirectCommandBuffer, executionRange);
338
+ }
339
+
340
+ // method: executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:
341
+ _MTL_INLINE void MTL::ComputeCommandEncoder::executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, const MTL::Buffer* indirectRangeBuffer, NS::UInteger indirectBufferOffset)
342
+ {
343
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(executeCommandsInBuffer_indirectBuffer_indirectBufferOffset_), indirectCommandbuffer, indirectRangeBuffer, indirectBufferOffset);
344
+ }
345
+
346
+ // method: memoryBarrierWithScope:
347
+ _MTL_INLINE void MTL::ComputeCommandEncoder::memoryBarrier(MTL::BarrierScope scope)
348
+ {
349
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(memoryBarrierWithScope_), scope);
350
+ }
351
+
352
+ // method: memoryBarrierWithResources:count:
353
+ _MTL_INLINE void MTL::ComputeCommandEncoder::memoryBarrier(const MTL::Resource* const resources[], NS::UInteger count)
354
+ {
355
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(memoryBarrierWithResources_count_), resources, count);
356
+ }
357
+
358
+ // method: sampleCountersInBuffer:atSampleIndex:withBarrier:
359
+ _MTL_INLINE void MTL::ComputeCommandEncoder::sampleCountersInBuffer(const MTL::CounterSampleBuffer* sampleBuffer, NS::UInteger sampleIndex, bool barrier)
360
+ {
361
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleCountersInBuffer_atSampleIndex_withBarrier_), sampleBuffer, sampleIndex, barrier);
362
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLComputePass.hpp ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLComputePass.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLCommandBuffer.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ class ComputePassSampleBufferAttachmentDescriptor : public NS::Copying<ComputePassSampleBufferAttachmentDescriptor>
34
+ {
35
+ public:
36
+ static class ComputePassSampleBufferAttachmentDescriptor* alloc();
37
+
38
+ class ComputePassSampleBufferAttachmentDescriptor* init();
39
+
40
+ class CounterSampleBuffer* sampleBuffer() const;
41
+ void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer);
42
+
43
+ NS::UInteger startOfEncoderSampleIndex() const;
44
+ void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex);
45
+
46
+ NS::UInteger endOfEncoderSampleIndex() const;
47
+ void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex);
48
+ };
49
+
50
+ class ComputePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<ComputePassSampleBufferAttachmentDescriptorArray>
51
+ {
52
+ public:
53
+ static class ComputePassSampleBufferAttachmentDescriptorArray* alloc();
54
+
55
+ class ComputePassSampleBufferAttachmentDescriptorArray* init();
56
+
57
+ class ComputePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex);
58
+
59
+ void setObject(const class ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex);
60
+ };
61
+
62
+ class ComputePassDescriptor : public NS::Copying<ComputePassDescriptor>
63
+ {
64
+ public:
65
+ static class ComputePassDescriptor* alloc();
66
+
67
+ class ComputePassDescriptor* init();
68
+
69
+ static class ComputePassDescriptor* computePassDescriptor();
70
+
71
+ MTL::DispatchType dispatchType() const;
72
+ void setDispatchType(MTL::DispatchType dispatchType);
73
+
74
+ class ComputePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const;
75
+ };
76
+
77
+ }
78
+
79
+ // static method: alloc
80
+ _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::alloc()
81
+ {
82
+ return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptor));
83
+ }
84
+
85
+ // method: init
86
+ _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::init()
87
+ {
88
+ return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptor>();
89
+ }
90
+
91
+ // property: sampleBuffer
92
+ _MTL_INLINE MTL::CounterSampleBuffer* MTL::ComputePassSampleBufferAttachmentDescriptor::sampleBuffer() const
93
+ {
94
+ return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer));
95
+ }
96
+
97
+ _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer)
98
+ {
99
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer);
100
+ }
101
+
102
+ // property: startOfEncoderSampleIndex
103
+ _MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const
104
+ {
105
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex));
106
+ }
107
+
108
+ _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex)
109
+ {
110
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex);
111
+ }
112
+
113
+ // property: endOfEncoderSampleIndex
114
+ _MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const
115
+ {
116
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex));
117
+ }
118
+
119
+ _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex)
120
+ {
121
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex);
122
+ }
123
+
124
+ // static method: alloc
125
+ _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::alloc()
126
+ {
127
+ return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptorArray));
128
+ }
129
+
130
+ // method: init
131
+ _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::init()
132
+ {
133
+ return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptorArray>();
134
+ }
135
+
136
+ // method: objectAtIndexedSubscript:
137
+ _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex)
138
+ {
139
+ return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex);
140
+ }
141
+
142
+ // method: setObject:atIndexedSubscript:
143
+ _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex)
144
+ {
145
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex);
146
+ }
147
+
148
+ // static method: alloc
149
+ _MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::alloc()
150
+ {
151
+ return NS::Object::alloc<MTL::ComputePassDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor));
152
+ }
153
+
154
+ // method: init
155
+ _MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::init()
156
+ {
157
+ return NS::Object::init<MTL::ComputePassDescriptor>();
158
+ }
159
+
160
+ // static method: computePassDescriptor
161
+ _MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::computePassDescriptor()
162
+ {
163
+ return Object::sendMessage<MTL::ComputePassDescriptor*>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor), _MTL_PRIVATE_SEL(computePassDescriptor));
164
+ }
165
+
166
+ // property: dispatchType
167
+ _MTL_INLINE MTL::DispatchType MTL::ComputePassDescriptor::dispatchType() const
168
+ {
169
+ return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType));
170
+ }
171
+
172
+ _MTL_INLINE void MTL::ComputePassDescriptor::setDispatchType(MTL::DispatchType dispatchType)
173
+ {
174
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDispatchType_), dispatchType);
175
+ }
176
+
177
+ // property: sampleBufferAttachments
178
+ _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassDescriptor::sampleBufferAttachments() const
179
+ {
180
+ return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments));
181
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLComputePipeline.hpp ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLComputePipeline.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLTypes.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ class ComputePipelineReflection : public NS::Referencing<ComputePipelineReflection>
34
+ {
35
+ public:
36
+ static class ComputePipelineReflection* alloc();
37
+
38
+ class ComputePipelineReflection* init();
39
+
40
+ NS::Array* bindings() const;
41
+
42
+ NS::Array* arguments() const;
43
+ };
44
+
45
+ class ComputePipelineDescriptor : public NS::Copying<ComputePipelineDescriptor>
46
+ {
47
+ public:
48
+ static class ComputePipelineDescriptor* alloc();
49
+
50
+ class ComputePipelineDescriptor* init();
51
+
52
+ NS::String* label() const;
53
+ void setLabel(const NS::String* label);
54
+
55
+ class Function* computeFunction() const;
56
+ void setComputeFunction(const class Function* computeFunction);
57
+
58
+ bool threadGroupSizeIsMultipleOfThreadExecutionWidth() const;
59
+ void setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth);
60
+
61
+ NS::UInteger maxTotalThreadsPerThreadgroup() const;
62
+ void setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
63
+
64
+ class StageInputOutputDescriptor* stageInputDescriptor() const;
65
+ void setStageInputDescriptor(const class StageInputOutputDescriptor* stageInputDescriptor);
66
+
67
+ class PipelineBufferDescriptorArray* buffers() const;
68
+
69
+ bool supportIndirectCommandBuffers() const;
70
+ void setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers);
71
+
72
+ NS::Array* insertLibraries() const;
73
+ void setInsertLibraries(const NS::Array* insertLibraries);
74
+
75
+ NS::Array* preloadedLibraries() const;
76
+ void setPreloadedLibraries(const NS::Array* preloadedLibraries);
77
+
78
+ NS::Array* binaryArchives() const;
79
+ void setBinaryArchives(const NS::Array* binaryArchives);
80
+
81
+ void reset();
82
+
83
+ class LinkedFunctions* linkedFunctions() const;
84
+ void setLinkedFunctions(const class LinkedFunctions* linkedFunctions);
85
+
86
+ bool supportAddingBinaryFunctions() const;
87
+ void setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions);
88
+
89
+ NS::UInteger maxCallStackDepth() const;
90
+ void setMaxCallStackDepth(NS::UInteger maxCallStackDepth);
91
+ };
92
+
93
+ class ComputePipelineState : public NS::Referencing<ComputePipelineState>
94
+ {
95
+ public:
96
+ NS::String* label() const;
97
+
98
+ class Device* device() const;
99
+
100
+ NS::UInteger maxTotalThreadsPerThreadgroup() const;
101
+
102
+ NS::UInteger threadExecutionWidth() const;
103
+
104
+ NS::UInteger staticThreadgroupMemoryLength() const;
105
+
106
+ NS::UInteger imageblockMemoryLength(MTL::Size imageblockDimensions);
107
+
108
+ bool supportIndirectCommandBuffers() const;
109
+
110
+ MTL::ResourceID gpuResourceID() const;
111
+
112
+ class FunctionHandle* functionHandle(const class Function* function);
113
+
114
+ class ComputePipelineState* newComputePipelineState(const NS::Array* functions, NS::Error** error);
115
+
116
+ class VisibleFunctionTable* newVisibleFunctionTable(const class VisibleFunctionTableDescriptor* descriptor);
117
+
118
+ class IntersectionFunctionTable* newIntersectionFunctionTable(const class IntersectionFunctionTableDescriptor* descriptor);
119
+ };
120
+
121
+ }
122
+
123
+ // static method: alloc
124
+ _MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::alloc()
125
+ {
126
+ return NS::Object::alloc<MTL::ComputePipelineReflection>(_MTL_PRIVATE_CLS(MTLComputePipelineReflection));
127
+ }
128
+
129
+ // method: init
130
+ _MTL_INLINE MTL::ComputePipelineReflection* MTL::ComputePipelineReflection::init()
131
+ {
132
+ return NS::Object::init<MTL::ComputePipelineReflection>();
133
+ }
134
+
135
+ // property: bindings
136
+ _MTL_INLINE NS::Array* MTL::ComputePipelineReflection::bindings() const
137
+ {
138
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(bindings));
139
+ }
140
+
141
+ // property: arguments
142
+ _MTL_INLINE NS::Array* MTL::ComputePipelineReflection::arguments() const
143
+ {
144
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(arguments));
145
+ }
146
+
147
+ // static method: alloc
148
+ _MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::alloc()
149
+ {
150
+ return NS::Object::alloc<MTL::ComputePipelineDescriptor>(_MTL_PRIVATE_CLS(MTLComputePipelineDescriptor));
151
+ }
152
+
153
+ // method: init
154
+ _MTL_INLINE MTL::ComputePipelineDescriptor* MTL::ComputePipelineDescriptor::init()
155
+ {
156
+ return NS::Object::init<MTL::ComputePipelineDescriptor>();
157
+ }
158
+
159
+ // property: label
160
+ _MTL_INLINE NS::String* MTL::ComputePipelineDescriptor::label() const
161
+ {
162
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
163
+ }
164
+
165
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setLabel(const NS::String* label)
166
+ {
167
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
168
+ }
169
+
170
+ // property: computeFunction
171
+ _MTL_INLINE MTL::Function* MTL::ComputePipelineDescriptor::computeFunction() const
172
+ {
173
+ return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(computeFunction));
174
+ }
175
+
176
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setComputeFunction(const MTL::Function* computeFunction)
177
+ {
178
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputeFunction_), computeFunction);
179
+ }
180
+
181
+ // property: threadGroupSizeIsMultipleOfThreadExecutionWidth
182
+ _MTL_INLINE bool MTL::ComputePipelineDescriptor::threadGroupSizeIsMultipleOfThreadExecutionWidth() const
183
+ {
184
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(threadGroupSizeIsMultipleOfThreadExecutionWidth));
185
+ }
186
+
187
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool threadGroupSizeIsMultipleOfThreadExecutionWidth)
188
+ {
189
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadGroupSizeIsMultipleOfThreadExecutionWidth_), threadGroupSizeIsMultipleOfThreadExecutionWidth);
190
+ }
191
+
192
+ // property: maxTotalThreadsPerThreadgroup
193
+ _MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxTotalThreadsPerThreadgroup() const
194
+ {
195
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
196
+ }
197
+
198
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
199
+ {
200
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
201
+ }
202
+
203
+ // property: stageInputDescriptor
204
+ _MTL_INLINE MTL::StageInputOutputDescriptor* MTL::ComputePipelineDescriptor::stageInputDescriptor() const
205
+ {
206
+ return Object::sendMessage<MTL::StageInputOutputDescriptor*>(this, _MTL_PRIVATE_SEL(stageInputDescriptor));
207
+ }
208
+
209
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setStageInputDescriptor(const MTL::StageInputOutputDescriptor* stageInputDescriptor)
210
+ {
211
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInputDescriptor_), stageInputDescriptor);
212
+ }
213
+
214
+ // property: buffers
215
+ _MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::ComputePipelineDescriptor::buffers() const
216
+ {
217
+ return Object::sendMessage<MTL::PipelineBufferDescriptorArray*>(this, _MTL_PRIVATE_SEL(buffers));
218
+ }
219
+
220
+ // property: supportIndirectCommandBuffers
221
+ _MTL_INLINE bool MTL::ComputePipelineDescriptor::supportIndirectCommandBuffers() const
222
+ {
223
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
224
+ }
225
+
226
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportIndirectCommandBuffers(bool supportIndirectCommandBuffers)
227
+ {
228
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportIndirectCommandBuffers_), supportIndirectCommandBuffers);
229
+ }
230
+
231
+ // property: insertLibraries
232
+ _MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::insertLibraries() const
233
+ {
234
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(insertLibraries));
235
+ }
236
+
237
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setInsertLibraries(const NS::Array* insertLibraries)
238
+ {
239
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInsertLibraries_), insertLibraries);
240
+ }
241
+
242
+ // property: preloadedLibraries
243
+ _MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::preloadedLibraries() const
244
+ {
245
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(preloadedLibraries));
246
+ }
247
+
248
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setPreloadedLibraries(const NS::Array* preloadedLibraries)
249
+ {
250
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreloadedLibraries_), preloadedLibraries);
251
+ }
252
+
253
+ // property: binaryArchives
254
+ _MTL_INLINE NS::Array* MTL::ComputePipelineDescriptor::binaryArchives() const
255
+ {
256
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
257
+ }
258
+
259
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
260
+ {
261
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
262
+ }
263
+
264
+ // method: reset
265
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::reset()
266
+ {
267
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
268
+ }
269
+
270
+ // property: linkedFunctions
271
+ _MTL_INLINE MTL::LinkedFunctions* MTL::ComputePipelineDescriptor::linkedFunctions() const
272
+ {
273
+ return Object::sendMessage<MTL::LinkedFunctions*>(this, _MTL_PRIVATE_SEL(linkedFunctions));
274
+ }
275
+
276
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setLinkedFunctions(const MTL::LinkedFunctions* linkedFunctions)
277
+ {
278
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLinkedFunctions_), linkedFunctions);
279
+ }
280
+
281
+ // property: supportAddingBinaryFunctions
282
+ _MTL_INLINE bool MTL::ComputePipelineDescriptor::supportAddingBinaryFunctions() const
283
+ {
284
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportAddingBinaryFunctions));
285
+ }
286
+
287
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setSupportAddingBinaryFunctions(bool supportAddingBinaryFunctions)
288
+ {
289
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportAddingBinaryFunctions_), supportAddingBinaryFunctions);
290
+ }
291
+
292
+ // property: maxCallStackDepth
293
+ _MTL_INLINE NS::UInteger MTL::ComputePipelineDescriptor::maxCallStackDepth() const
294
+ {
295
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCallStackDepth));
296
+ }
297
+
298
+ _MTL_INLINE void MTL::ComputePipelineDescriptor::setMaxCallStackDepth(NS::UInteger maxCallStackDepth)
299
+ {
300
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCallStackDepth_), maxCallStackDepth);
301
+ }
302
+
303
+ // property: label
304
+ _MTL_INLINE NS::String* MTL::ComputePipelineState::label() const
305
+ {
306
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
307
+ }
308
+
309
+ // property: device
310
+ _MTL_INLINE MTL::Device* MTL::ComputePipelineState::device() const
311
+ {
312
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
313
+ }
314
+
315
+ // property: maxTotalThreadsPerThreadgroup
316
+ _MTL_INLINE NS::UInteger MTL::ComputePipelineState::maxTotalThreadsPerThreadgroup() const
317
+ {
318
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
319
+ }
320
+
321
+ // property: threadExecutionWidth
322
+ _MTL_INLINE NS::UInteger MTL::ComputePipelineState::threadExecutionWidth() const
323
+ {
324
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(threadExecutionWidth));
325
+ }
326
+
327
+ // property: staticThreadgroupMemoryLength
328
+ _MTL_INLINE NS::UInteger MTL::ComputePipelineState::staticThreadgroupMemoryLength() const
329
+ {
330
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(staticThreadgroupMemoryLength));
331
+ }
332
+
333
+ // method: imageblockMemoryLengthForDimensions:
334
+ _MTL_INLINE NS::UInteger MTL::ComputePipelineState::imageblockMemoryLength(MTL::Size imageblockDimensions)
335
+ {
336
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(imageblockMemoryLengthForDimensions_), imageblockDimensions);
337
+ }
338
+
339
+ // property: supportIndirectCommandBuffers
340
+ _MTL_INLINE bool MTL::ComputePipelineState::supportIndirectCommandBuffers() const
341
+ {
342
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportIndirectCommandBuffers));
343
+ }
344
+
345
+ // property: gpuResourceID
346
+ _MTL_INLINE MTL::ResourceID MTL::ComputePipelineState::gpuResourceID() const
347
+ {
348
+ return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
349
+ }
350
+
351
+ // method: functionHandleWithFunction:
352
+ _MTL_INLINE MTL::FunctionHandle* MTL::ComputePipelineState::functionHandle(const MTL::Function* function)
353
+ {
354
+ return Object::sendMessage<MTL::FunctionHandle*>(this, _MTL_PRIVATE_SEL(functionHandleWithFunction_), function);
355
+ }
356
+
357
+ // method: newComputePipelineStateWithAdditionalBinaryFunctions:error:
358
+ _MTL_INLINE MTL::ComputePipelineState* MTL::ComputePipelineState::newComputePipelineState(const NS::Array* functions, NS::Error** error)
359
+ {
360
+ return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithAdditionalBinaryFunctions_error_), functions, error);
361
+ }
362
+
363
+ // method: newVisibleFunctionTableWithDescriptor:
364
+ _MTL_INLINE MTL::VisibleFunctionTable* MTL::ComputePipelineState::newVisibleFunctionTable(const MTL::VisibleFunctionTableDescriptor* descriptor)
365
+ {
366
+ return Object::sendMessage<MTL::VisibleFunctionTable*>(this, _MTL_PRIVATE_SEL(newVisibleFunctionTableWithDescriptor_), descriptor);
367
+ }
368
+
369
+ // method: newIntersectionFunctionTableWithDescriptor:
370
+ _MTL_INLINE MTL::IntersectionFunctionTable* MTL::ComputePipelineState::newIntersectionFunctionTable(const MTL::IntersectionFunctionTableDescriptor* descriptor)
371
+ {
372
+ return Object::sendMessage<MTL::IntersectionFunctionTable*>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionTableWithDescriptor_), descriptor);
373
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLCounters.hpp ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLCounters.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLResource.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ struct CounterResultTimestamp
34
+ {
35
+ uint64_t timestamp;
36
+ } _MTL_PACKED;
37
+
38
+ struct CounterResultStageUtilization
39
+ {
40
+ uint64_t totalCycles;
41
+ uint64_t vertexCycles;
42
+ uint64_t tessellationCycles;
43
+ uint64_t postTessellationVertexCycles;
44
+ uint64_t fragmentCycles;
45
+ uint64_t renderTargetCycles;
46
+ } _MTL_PACKED;
47
+
48
+ struct CounterResultStatistic
49
+ {
50
+ uint64_t tessellationInputPatches;
51
+ uint64_t vertexInvocations;
52
+ uint64_t postTessellationVertexInvocations;
53
+ uint64_t clipperInvocations;
54
+ uint64_t clipperPrimitivesOut;
55
+ uint64_t fragmentInvocations;
56
+ uint64_t fragmentsPassed;
57
+ uint64_t computeKernelInvocations;
58
+ } _MTL_PACKED;
59
+
60
+ _MTL_CONST(NS::ErrorDomain, CounterErrorDomain);
61
+
62
+ using CommonCounter = NS::String*;
63
+
64
+ _MTL_CONST(CommonCounter, CommonCounterTimestamp);
65
+ _MTL_CONST(CommonCounter, CommonCounterTessellationInputPatches);
66
+ _MTL_CONST(CommonCounter, CommonCounterVertexInvocations);
67
+ _MTL_CONST(CommonCounter, CommonCounterPostTessellationVertexInvocations);
68
+ _MTL_CONST(CommonCounter, CommonCounterClipperInvocations);
69
+ _MTL_CONST(CommonCounter, CommonCounterClipperPrimitivesOut);
70
+ _MTL_CONST(CommonCounter, CommonCounterFragmentInvocations);
71
+ _MTL_CONST(CommonCounter, CommonCounterFragmentsPassed);
72
+ _MTL_CONST(CommonCounter, CommonCounterComputeKernelInvocations);
73
+ _MTL_CONST(CommonCounter, CommonCounterTotalCycles);
74
+ _MTL_CONST(CommonCounter, CommonCounterVertexCycles);
75
+ _MTL_CONST(CommonCounter, CommonCounterTessellationCycles);
76
+ _MTL_CONST(CommonCounter, CommonCounterPostTessellationVertexCycles);
77
+ _MTL_CONST(CommonCounter, CommonCounterFragmentCycles);
78
+ _MTL_CONST(CommonCounter, CommonCounterRenderTargetWriteCycles);
79
+
80
+ using CommonCounterSet = NS::String*;
81
+
82
+ _MTL_CONST(CommonCounterSet, CommonCounterSetTimestamp);
83
+ _MTL_CONST(CommonCounterSet, CommonCounterSetStageUtilization);
84
+ _MTL_CONST(CommonCounterSet, CommonCounterSetStatistic);
85
+
86
+ class Counter : public NS::Referencing<Counter>
87
+ {
88
+ public:
89
+ NS::String* name() const;
90
+ };
91
+
92
+ class CounterSet : public NS::Referencing<CounterSet>
93
+ {
94
+ public:
95
+ NS::String* name() const;
96
+
97
+ NS::Array* counters() const;
98
+ };
99
+
100
+ class CounterSampleBufferDescriptor : public NS::Copying<CounterSampleBufferDescriptor>
101
+ {
102
+ public:
103
+ static class CounterSampleBufferDescriptor* alloc();
104
+
105
+ class CounterSampleBufferDescriptor* init();
106
+
107
+ class CounterSet* counterSet() const;
108
+ void setCounterSet(const class CounterSet* counterSet);
109
+
110
+ NS::String* label() const;
111
+ void setLabel(const NS::String* label);
112
+
113
+ MTL::StorageMode storageMode() const;
114
+ void setStorageMode(MTL::StorageMode storageMode);
115
+
116
+ NS::UInteger sampleCount() const;
117
+ void setSampleCount(NS::UInteger sampleCount);
118
+ };
119
+
120
+ class CounterSampleBuffer : public NS::Referencing<CounterSampleBuffer>
121
+ {
122
+ public:
123
+ class Device* device() const;
124
+
125
+ NS::String* label() const;
126
+
127
+ NS::UInteger sampleCount() const;
128
+
129
+ NS::Data* resolveCounterRange(NS::Range range);
130
+ };
131
+
132
+ _MTL_ENUM(NS::Integer, CounterSampleBufferError) {
133
+ CounterSampleBufferErrorOutOfMemory = 0,
134
+ CounterSampleBufferErrorInvalid = 1,
135
+ CounterSampleBufferErrorInternal = 2,
136
+ };
137
+
138
+ }
139
+
140
+ _MTL_PRIVATE_DEF_STR(NS::ErrorDomain, CounterErrorDomain);
141
+
142
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTimestamp);
143
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTessellationInputPatches);
144
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterVertexInvocations);
145
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterPostTessellationVertexInvocations);
146
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterClipperInvocations);
147
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterClipperPrimitivesOut);
148
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterFragmentInvocations);
149
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterFragmentsPassed);
150
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterComputeKernelInvocations);
151
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTotalCycles);
152
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterVertexCycles);
153
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterTessellationCycles);
154
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterPostTessellationVertexCycles);
155
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterFragmentCycles);
156
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounter, CommonCounterRenderTargetWriteCycles);
157
+
158
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounterSet, CommonCounterSetTimestamp);
159
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounterSet, CommonCounterSetStageUtilization);
160
+ _MTL_PRIVATE_DEF_STR(MTL::CommonCounterSet, CommonCounterSetStatistic);
161
+
162
+ // property: name
163
+ _MTL_INLINE NS::String* MTL::Counter::name() const
164
+ {
165
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
166
+ }
167
+
168
+ // property: name
169
+ _MTL_INLINE NS::String* MTL::CounterSet::name() const
170
+ {
171
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
172
+ }
173
+
174
+ // property: counters
175
+ _MTL_INLINE NS::Array* MTL::CounterSet::counters() const
176
+ {
177
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(counters));
178
+ }
179
+
180
+ // static method: alloc
181
+ _MTL_INLINE MTL::CounterSampleBufferDescriptor* MTL::CounterSampleBufferDescriptor::alloc()
182
+ {
183
+ return NS::Object::alloc<MTL::CounterSampleBufferDescriptor>(_MTL_PRIVATE_CLS(MTLCounterSampleBufferDescriptor));
184
+ }
185
+
186
+ // method: init
187
+ _MTL_INLINE MTL::CounterSampleBufferDescriptor* MTL::CounterSampleBufferDescriptor::init()
188
+ {
189
+ return NS::Object::init<MTL::CounterSampleBufferDescriptor>();
190
+ }
191
+
192
+ // property: counterSet
193
+ _MTL_INLINE MTL::CounterSet* MTL::CounterSampleBufferDescriptor::counterSet() const
194
+ {
195
+ return Object::sendMessage<MTL::CounterSet*>(this, _MTL_PRIVATE_SEL(counterSet));
196
+ }
197
+
198
+ _MTL_INLINE void MTL::CounterSampleBufferDescriptor::setCounterSet(const MTL::CounterSet* counterSet)
199
+ {
200
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCounterSet_), counterSet);
201
+ }
202
+
203
+ // property: label
204
+ _MTL_INLINE NS::String* MTL::CounterSampleBufferDescriptor::label() const
205
+ {
206
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
207
+ }
208
+
209
+ _MTL_INLINE void MTL::CounterSampleBufferDescriptor::setLabel(const NS::String* label)
210
+ {
211
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
212
+ }
213
+
214
+ // property: storageMode
215
+ _MTL_INLINE MTL::StorageMode MTL::CounterSampleBufferDescriptor::storageMode() const
216
+ {
217
+ return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
218
+ }
219
+
220
+ _MTL_INLINE void MTL::CounterSampleBufferDescriptor::setStorageMode(MTL::StorageMode storageMode)
221
+ {
222
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStorageMode_), storageMode);
223
+ }
224
+
225
+ // property: sampleCount
226
+ _MTL_INLINE NS::UInteger MTL::CounterSampleBufferDescriptor::sampleCount() const
227
+ {
228
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sampleCount));
229
+ }
230
+
231
+ _MTL_INLINE void MTL::CounterSampleBufferDescriptor::setSampleCount(NS::UInteger sampleCount)
232
+ {
233
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleCount_), sampleCount);
234
+ }
235
+
236
+ // property: device
237
+ _MTL_INLINE MTL::Device* MTL::CounterSampleBuffer::device() const
238
+ {
239
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
240
+ }
241
+
242
+ // property: label
243
+ _MTL_INLINE NS::String* MTL::CounterSampleBuffer::label() const
244
+ {
245
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
246
+ }
247
+
248
+ // property: sampleCount
249
+ _MTL_INLINE NS::UInteger MTL::CounterSampleBuffer::sampleCount() const
250
+ {
251
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sampleCount));
252
+ }
253
+
254
+ // method: resolveCounterRange:
255
+ _MTL_INLINE NS::Data* MTL::CounterSampleBuffer::resolveCounterRange(NS::Range range)
256
+ {
257
+ return Object::sendMessage<NS::Data*>(this, _MTL_PRIVATE_SEL(resolveCounterRange_), range);
258
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDefines.hpp ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLDefines.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
+
25
+ #include "../Foundation/NSDefines.hpp"
26
+
27
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
28
+
29
+ #define _MTL_EXPORT _NS_EXPORT
30
+ #define _MTL_EXTERN _NS_EXTERN
31
+ #define _MTL_INLINE _NS_INLINE
32
+ #define _MTL_PACKED _NS_PACKED
33
+
34
+ #define _MTL_CONST(type, name) _NS_CONST(type, name)
35
+ #define _MTL_ENUM(type, name) _NS_ENUM(type, name)
36
+ #define _MTL_OPTIONS(type, name) _NS_OPTIONS(type, name)
37
+
38
+ #define _MTL_VALIDATE_SIZE(ns, name) _NS_VALIDATE_SIZE(ns, name)
39
+ #define _MTL_VALIDATE_ENUM(ns, name) _NS_VALIDATE_ENUM(ns, name)
40
+
41
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDepthStencil.hpp ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLDepthStencil.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLDepthStencil.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ _MTL_ENUM(NS::UInteger, CompareFunction) {
34
+ CompareFunctionNever = 0,
35
+ CompareFunctionLess = 1,
36
+ CompareFunctionEqual = 2,
37
+ CompareFunctionLessEqual = 3,
38
+ CompareFunctionGreater = 4,
39
+ CompareFunctionNotEqual = 5,
40
+ CompareFunctionGreaterEqual = 6,
41
+ CompareFunctionAlways = 7,
42
+ };
43
+
44
+ _MTL_ENUM(NS::UInteger, StencilOperation) {
45
+ StencilOperationKeep = 0,
46
+ StencilOperationZero = 1,
47
+ StencilOperationReplace = 2,
48
+ StencilOperationIncrementClamp = 3,
49
+ StencilOperationDecrementClamp = 4,
50
+ StencilOperationInvert = 5,
51
+ StencilOperationIncrementWrap = 6,
52
+ StencilOperationDecrementWrap = 7,
53
+ };
54
+
55
+ class StencilDescriptor : public NS::Copying<StencilDescriptor>
56
+ {
57
+ public:
58
+ static class StencilDescriptor* alloc();
59
+
60
+ class StencilDescriptor* init();
61
+
62
+ MTL::CompareFunction stencilCompareFunction() const;
63
+ void setStencilCompareFunction(MTL::CompareFunction stencilCompareFunction);
64
+
65
+ MTL::StencilOperation stencilFailureOperation() const;
66
+ void setStencilFailureOperation(MTL::StencilOperation stencilFailureOperation);
67
+
68
+ MTL::StencilOperation depthFailureOperation() const;
69
+ void setDepthFailureOperation(MTL::StencilOperation depthFailureOperation);
70
+
71
+ MTL::StencilOperation depthStencilPassOperation() const;
72
+ void setDepthStencilPassOperation(MTL::StencilOperation depthStencilPassOperation);
73
+
74
+ uint32_t readMask() const;
75
+ void setReadMask(uint32_t readMask);
76
+
77
+ uint32_t writeMask() const;
78
+ void setWriteMask(uint32_t writeMask);
79
+ };
80
+
81
+ class DepthStencilDescriptor : public NS::Copying<DepthStencilDescriptor>
82
+ {
83
+ public:
84
+ static class DepthStencilDescriptor* alloc();
85
+
86
+ class DepthStencilDescriptor* init();
87
+
88
+ MTL::CompareFunction depthCompareFunction() const;
89
+ void setDepthCompareFunction(MTL::CompareFunction depthCompareFunction);
90
+
91
+ bool depthWriteEnabled() const;
92
+ void setDepthWriteEnabled(bool depthWriteEnabled);
93
+
94
+ class StencilDescriptor* frontFaceStencil() const;
95
+ void setFrontFaceStencil(const class StencilDescriptor* frontFaceStencil);
96
+
97
+ class StencilDescriptor* backFaceStencil() const;
98
+ void setBackFaceStencil(const class StencilDescriptor* backFaceStencil);
99
+
100
+ NS::String* label() const;
101
+ void setLabel(const NS::String* label);
102
+ };
103
+
104
+ class DepthStencilState : public NS::Referencing<DepthStencilState>
105
+ {
106
+ public:
107
+ NS::String* label() const;
108
+
109
+ class Device* device() const;
110
+ };
111
+
112
+ }
113
+
114
+ // static method: alloc
115
+ _MTL_INLINE MTL::StencilDescriptor* MTL::StencilDescriptor::alloc()
116
+ {
117
+ return NS::Object::alloc<MTL::StencilDescriptor>(_MTL_PRIVATE_CLS(MTLStencilDescriptor));
118
+ }
119
+
120
+ // method: init
121
+ _MTL_INLINE MTL::StencilDescriptor* MTL::StencilDescriptor::init()
122
+ {
123
+ return NS::Object::init<MTL::StencilDescriptor>();
124
+ }
125
+
126
+ // property: stencilCompareFunction
127
+ _MTL_INLINE MTL::CompareFunction MTL::StencilDescriptor::stencilCompareFunction() const
128
+ {
129
+ return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(stencilCompareFunction));
130
+ }
131
+
132
+ _MTL_INLINE void MTL::StencilDescriptor::setStencilCompareFunction(MTL::CompareFunction stencilCompareFunction)
133
+ {
134
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilCompareFunction_), stencilCompareFunction);
135
+ }
136
+
137
+ // property: stencilFailureOperation
138
+ _MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::stencilFailureOperation() const
139
+ {
140
+ return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(stencilFailureOperation));
141
+ }
142
+
143
+ _MTL_INLINE void MTL::StencilDescriptor::setStencilFailureOperation(MTL::StencilOperation stencilFailureOperation)
144
+ {
145
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilFailureOperation_), stencilFailureOperation);
146
+ }
147
+
148
+ // property: depthFailureOperation
149
+ _MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::depthFailureOperation() const
150
+ {
151
+ return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(depthFailureOperation));
152
+ }
153
+
154
+ _MTL_INLINE void MTL::StencilDescriptor::setDepthFailureOperation(MTL::StencilOperation depthFailureOperation)
155
+ {
156
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthFailureOperation_), depthFailureOperation);
157
+ }
158
+
159
+ // property: depthStencilPassOperation
160
+ _MTL_INLINE MTL::StencilOperation MTL::StencilDescriptor::depthStencilPassOperation() const
161
+ {
162
+ return Object::sendMessage<MTL::StencilOperation>(this, _MTL_PRIVATE_SEL(depthStencilPassOperation));
163
+ }
164
+
165
+ _MTL_INLINE void MTL::StencilDescriptor::setDepthStencilPassOperation(MTL::StencilOperation depthStencilPassOperation)
166
+ {
167
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStencilPassOperation_), depthStencilPassOperation);
168
+ }
169
+
170
+ // property: readMask
171
+ _MTL_INLINE uint32_t MTL::StencilDescriptor::readMask() const
172
+ {
173
+ return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(readMask));
174
+ }
175
+
176
+ _MTL_INLINE void MTL::StencilDescriptor::setReadMask(uint32_t readMask)
177
+ {
178
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setReadMask_), readMask);
179
+ }
180
+
181
+ // property: writeMask
182
+ _MTL_INLINE uint32_t MTL::StencilDescriptor::writeMask() const
183
+ {
184
+ return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(writeMask));
185
+ }
186
+
187
+ _MTL_INLINE void MTL::StencilDescriptor::setWriteMask(uint32_t writeMask)
188
+ {
189
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setWriteMask_), writeMask);
190
+ }
191
+
192
+ // static method: alloc
193
+ _MTL_INLINE MTL::DepthStencilDescriptor* MTL::DepthStencilDescriptor::alloc()
194
+ {
195
+ return NS::Object::alloc<MTL::DepthStencilDescriptor>(_MTL_PRIVATE_CLS(MTLDepthStencilDescriptor));
196
+ }
197
+
198
+ // method: init
199
+ _MTL_INLINE MTL::DepthStencilDescriptor* MTL::DepthStencilDescriptor::init()
200
+ {
201
+ return NS::Object::init<MTL::DepthStencilDescriptor>();
202
+ }
203
+
204
+ // property: depthCompareFunction
205
+ _MTL_INLINE MTL::CompareFunction MTL::DepthStencilDescriptor::depthCompareFunction() const
206
+ {
207
+ return Object::sendMessage<MTL::CompareFunction>(this, _MTL_PRIVATE_SEL(depthCompareFunction));
208
+ }
209
+
210
+ _MTL_INLINE void MTL::DepthStencilDescriptor::setDepthCompareFunction(MTL::CompareFunction depthCompareFunction)
211
+ {
212
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthCompareFunction_), depthCompareFunction);
213
+ }
214
+
215
+ // property: depthWriteEnabled
216
+ _MTL_INLINE bool MTL::DepthStencilDescriptor::depthWriteEnabled() const
217
+ {
218
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isDepthWriteEnabled));
219
+ }
220
+
221
+ _MTL_INLINE void MTL::DepthStencilDescriptor::setDepthWriteEnabled(bool depthWriteEnabled)
222
+ {
223
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthWriteEnabled_), depthWriteEnabled);
224
+ }
225
+
226
+ // property: frontFaceStencil
227
+ _MTL_INLINE MTL::StencilDescriptor* MTL::DepthStencilDescriptor::frontFaceStencil() const
228
+ {
229
+ return Object::sendMessage<MTL::StencilDescriptor*>(this, _MTL_PRIVATE_SEL(frontFaceStencil));
230
+ }
231
+
232
+ _MTL_INLINE void MTL::DepthStencilDescriptor::setFrontFaceStencil(const MTL::StencilDescriptor* frontFaceStencil)
233
+ {
234
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFrontFaceStencil_), frontFaceStencil);
235
+ }
236
+
237
+ // property: backFaceStencil
238
+ _MTL_INLINE MTL::StencilDescriptor* MTL::DepthStencilDescriptor::backFaceStencil() const
239
+ {
240
+ return Object::sendMessage<MTL::StencilDescriptor*>(this, _MTL_PRIVATE_SEL(backFaceStencil));
241
+ }
242
+
243
+ _MTL_INLINE void MTL::DepthStencilDescriptor::setBackFaceStencil(const MTL::StencilDescriptor* backFaceStencil)
244
+ {
245
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBackFaceStencil_), backFaceStencil);
246
+ }
247
+
248
+ // property: label
249
+ _MTL_INLINE NS::String* MTL::DepthStencilDescriptor::label() const
250
+ {
251
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
252
+ }
253
+
254
+ _MTL_INLINE void MTL::DepthStencilDescriptor::setLabel(const NS::String* label)
255
+ {
256
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
257
+ }
258
+
259
+ // property: label
260
+ _MTL_INLINE NS::String* MTL::DepthStencilState::label() const
261
+ {
262
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
263
+ }
264
+
265
+ // property: device
266
+ _MTL_INLINE MTL::Device* MTL::DepthStencilState::device() const
267
+ {
268
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
269
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDevice.hpp ADDED
@@ -0,0 +1,1426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLDevice.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLArgument.hpp"
30
+ #include "MTLDevice.hpp"
31
+ #include "MTLPixelFormat.hpp"
32
+ #include "MTLResource.hpp"
33
+ #include "MTLTexture.hpp"
34
+ #include "MTLTypes.hpp"
35
+ #include <IOSurface/IOSurfaceRef.h>
36
+ #include <functional>
37
+
38
+ namespace MTL
39
+ {
40
+ _MTL_ENUM(NS::Integer, IOCompressionMethod) {
41
+ IOCompressionMethodZlib = 0,
42
+ IOCompressionMethodLZFSE = 1,
43
+ IOCompressionMethodLZ4 = 2,
44
+ IOCompressionMethodLZMA = 3,
45
+ IOCompressionMethodLZBitmap = 4,
46
+ };
47
+
48
+ _MTL_ENUM(NS::UInteger, FeatureSet) {
49
+ FeatureSet_iOS_GPUFamily1_v1 = 0,
50
+ FeatureSet_iOS_GPUFamily2_v1 = 1,
51
+ FeatureSet_iOS_GPUFamily1_v2 = 2,
52
+ FeatureSet_iOS_GPUFamily2_v2 = 3,
53
+ FeatureSet_iOS_GPUFamily3_v1 = 4,
54
+ FeatureSet_iOS_GPUFamily1_v3 = 5,
55
+ FeatureSet_iOS_GPUFamily2_v3 = 6,
56
+ FeatureSet_iOS_GPUFamily3_v2 = 7,
57
+ FeatureSet_iOS_GPUFamily1_v4 = 8,
58
+ FeatureSet_iOS_GPUFamily2_v4 = 9,
59
+ FeatureSet_iOS_GPUFamily3_v3 = 10,
60
+ FeatureSet_iOS_GPUFamily4_v1 = 11,
61
+ FeatureSet_iOS_GPUFamily1_v5 = 12,
62
+ FeatureSet_iOS_GPUFamily2_v5 = 13,
63
+ FeatureSet_iOS_GPUFamily3_v4 = 14,
64
+ FeatureSet_iOS_GPUFamily4_v2 = 15,
65
+ FeatureSet_iOS_GPUFamily5_v1 = 16,
66
+ FeatureSet_macOS_GPUFamily1_v1 = 10000,
67
+ FeatureSet_OSX_GPUFamily1_v1 = 10000,
68
+ FeatureSet_macOS_GPUFamily1_v2 = 10001,
69
+ FeatureSet_OSX_GPUFamily1_v2 = 10001,
70
+ FeatureSet_OSX_ReadWriteTextureTier2 = 10002,
71
+ FeatureSet_macOS_ReadWriteTextureTier2 = 10002,
72
+ FeatureSet_macOS_GPUFamily1_v3 = 10003,
73
+ FeatureSet_macOS_GPUFamily1_v4 = 10004,
74
+ FeatureSet_macOS_GPUFamily2_v1 = 10005,
75
+ FeatureSet_watchOS_GPUFamily1_v1 = 20000,
76
+ FeatureSet_WatchOS_GPUFamily1_v1 = 20000,
77
+ FeatureSet_watchOS_GPUFamily2_v1 = 20001,
78
+ FeatureSet_WatchOS_GPUFamily2_v1 = 20001,
79
+ FeatureSet_tvOS_GPUFamily1_v1 = 30000,
80
+ FeatureSet_TVOS_GPUFamily1_v1 = 30000,
81
+ FeatureSet_tvOS_GPUFamily1_v2 = 30001,
82
+ FeatureSet_tvOS_GPUFamily1_v3 = 30002,
83
+ FeatureSet_tvOS_GPUFamily2_v1 = 30003,
84
+ FeatureSet_tvOS_GPUFamily1_v4 = 30004,
85
+ FeatureSet_tvOS_GPUFamily2_v2 = 30005,
86
+ };
87
+
88
+ _MTL_ENUM(NS::Integer, GPUFamily) {
89
+ GPUFamilyApple1 = 1001,
90
+ GPUFamilyApple2 = 1002,
91
+ GPUFamilyApple3 = 1003,
92
+ GPUFamilyApple4 = 1004,
93
+ GPUFamilyApple5 = 1005,
94
+ GPUFamilyApple6 = 1006,
95
+ GPUFamilyApple7 = 1007,
96
+ GPUFamilyApple8 = 1008,
97
+ GPUFamilyMac1 = 2001,
98
+ GPUFamilyMac2 = 2002,
99
+ GPUFamilyCommon1 = 3001,
100
+ GPUFamilyCommon2 = 3002,
101
+ GPUFamilyCommon3 = 3003,
102
+ GPUFamilyMacCatalyst1 = 4001,
103
+ GPUFamilyMacCatalyst2 = 4002,
104
+ GPUFamilyMetal3 = 5001,
105
+ };
106
+
107
+ _MTL_ENUM(NS::UInteger, DeviceLocation) {
108
+ DeviceLocationBuiltIn = 0,
109
+ DeviceLocationSlot = 1,
110
+ DeviceLocationExternal = 2,
111
+ DeviceLocationUnspecified = NS::UIntegerMax,
112
+ };
113
+
114
+ _MTL_OPTIONS(NS::UInteger, PipelineOption) {
115
+ PipelineOptionNone = 0,
116
+ PipelineOptionArgumentInfo = 1,
117
+ PipelineOptionBufferTypeInfo = 2,
118
+ PipelineOptionFailOnBinaryArchiveMiss = 4,
119
+ };
120
+
121
+ _MTL_ENUM(NS::UInteger, ReadWriteTextureTier) {
122
+ ReadWriteTextureTierNone = 0,
123
+ ReadWriteTextureTier1 = 1,
124
+ ReadWriteTextureTier2 = 2,
125
+ };
126
+
127
+ _MTL_ENUM(NS::UInteger, ArgumentBuffersTier) {
128
+ ArgumentBuffersTier1 = 0,
129
+ ArgumentBuffersTier2 = 1,
130
+ };
131
+
132
+ _MTL_ENUM(NS::UInteger, SparseTextureRegionAlignmentMode) {
133
+ SparseTextureRegionAlignmentModeOutward = 0,
134
+ SparseTextureRegionAlignmentModeInward = 1,
135
+ };
136
+
137
+ _MTL_ENUM(NS::Integer, SparsePageSize) {
138
+ SparsePageSize16 = 101,
139
+ SparsePageSize64 = 102,
140
+ SparsePageSize256 = 103,
141
+ };
142
+
143
+ struct AccelerationStructureSizes
144
+ {
145
+ NS::UInteger accelerationStructureSize;
146
+ NS::UInteger buildScratchBufferSize;
147
+ NS::UInteger refitScratchBufferSize;
148
+ } _MTL_PACKED;
149
+
150
+ _MTL_ENUM(NS::UInteger, CounterSamplingPoint) {
151
+ CounterSamplingPointAtStageBoundary = 0,
152
+ CounterSamplingPointAtDrawBoundary = 1,
153
+ CounterSamplingPointAtDispatchBoundary = 2,
154
+ CounterSamplingPointAtTileDispatchBoundary = 3,
155
+ CounterSamplingPointAtBlitBoundary = 4,
156
+ };
157
+
158
+ struct SizeAndAlign
159
+ {
160
+ NS::UInteger size;
161
+ NS::UInteger align;
162
+ } _MTL_PACKED;
163
+
164
+ class ArgumentDescriptor : public NS::Copying<ArgumentDescriptor>
165
+ {
166
+ public:
167
+ static class ArgumentDescriptor* alloc();
168
+
169
+ class ArgumentDescriptor* init();
170
+
171
+ static class ArgumentDescriptor* argumentDescriptor();
172
+
173
+ MTL::DataType dataType() const;
174
+ void setDataType(MTL::DataType dataType);
175
+
176
+ NS::UInteger index() const;
177
+ void setIndex(NS::UInteger index);
178
+
179
+ NS::UInteger arrayLength() const;
180
+ void setArrayLength(NS::UInteger arrayLength);
181
+
182
+ MTL::BindingAccess access() const;
183
+ void setAccess(MTL::BindingAccess access);
184
+
185
+ MTL::TextureType textureType() const;
186
+ void setTextureType(MTL::TextureType textureType);
187
+
188
+ NS::UInteger constantBlockAlignment() const;
189
+ void setConstantBlockAlignment(NS::UInteger constantBlockAlignment);
190
+ };
191
+
192
+ class Architecture : public NS::Copying<Architecture>
193
+ {
194
+ public:
195
+ static class Architecture* alloc();
196
+
197
+ class Architecture* init();
198
+
199
+ NS::String* name() const;
200
+ };
201
+
202
+ using DeviceNotificationName = NS::String*;
203
+ _MTL_CONST(DeviceNotificationName, DeviceWasAddedNotification);
204
+ _MTL_CONST(DeviceNotificationName, DeviceRemovalRequestedNotification);
205
+ _MTL_CONST(DeviceNotificationName, DeviceWasRemovedNotification);
206
+ _MTL_CONST(NS::ErrorUserInfoKey, CommandBufferEncoderInfoErrorKey);
207
+
208
+ using DeviceNotificationHandlerBlock = void (^)(class Device* pDevice, DeviceNotificationName notifyName);
209
+
210
+ using DeviceNotificationHandlerFunction = std::function<void(class Device* pDevice, DeviceNotificationName notifyName)>;
211
+
212
+ using AutoreleasedComputePipelineReflection = class ComputePipelineReflection*;
213
+
214
+ using AutoreleasedRenderPipelineReflection = class RenderPipelineReflection*;
215
+
216
+ using NewLibraryCompletionHandler = void (^)(class Library*, NS::Error*);
217
+
218
+ using NewLibraryCompletionHandlerFunction = std::function<void(class Library*, NS::Error*)>;
219
+
220
+ using NewRenderPipelineStateCompletionHandler = void (^)(class RenderPipelineState*, NS::Error*);
221
+
222
+ using NewRenderPipelineStateCompletionHandlerFunction = std::function<void(class RenderPipelineState*, NS::Error*)>;
223
+
224
+ using NewRenderPipelineStateWithReflectionCompletionHandler = void (^)(class RenderPipelineState*, class RenderPipelineReflection*, NS::Error*);
225
+
226
+ using NewRenderPipelineStateWithReflectionCompletionHandlerFunction = std::function<void(class RenderPipelineState*, class RenderPipelineReflection*, NS::Error*)>;
227
+
228
+ using NewComputePipelineStateCompletionHandler = void (^)(class ComputePipelineState*, NS::Error*);
229
+
230
+ using NewComputePipelineStateCompletionHandlerFunction = std::function<void(class ComputePipelineState*, NS::Error*)>;
231
+
232
+ using NewComputePipelineStateWithReflectionCompletionHandler = void (^)(class ComputePipelineState*, class ComputePipelineReflection*, NS::Error*);
233
+
234
+ using NewComputePipelineStateWithReflectionCompletionHandlerFunction = std::function<void(class ComputePipelineState*, class ComputePipelineReflection*, NS::Error*)>;
235
+
236
+ using Timestamp = std::uint64_t;
237
+
238
+ MTL::Device* CreateSystemDefaultDevice();
239
+
240
+ NS::Array* CopyAllDevices();
241
+
242
+ NS::Array* CopyAllDevicesWithObserver(NS::Object** pOutObserver, DeviceNotificationHandlerBlock handler);
243
+
244
+ NS::Array* CopyAllDevicesWithObserver(NS::Object** pOutObserver, const DeviceNotificationHandlerFunction& handler);
245
+
246
+ void RemoveDeviceObserver(const NS::Object* pObserver);
247
+
248
+ class Device : public NS::Referencing<Device>
249
+ {
250
+ public:
251
+ void newLibrary(const NS::String* pSource, const class CompileOptions* pOptions, const NewLibraryCompletionHandlerFunction& completionHandler);
252
+
253
+ void newLibrary(const class StitchedLibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& completionHandler);
254
+
255
+ void newRenderPipelineState(const class RenderPipelineDescriptor* pDescriptor, const NewRenderPipelineStateCompletionHandlerFunction& completionHandler);
256
+
257
+ void newRenderPipelineState(const class RenderPipelineDescriptor* pDescriptor, PipelineOption options, const NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler);
258
+
259
+ void newRenderPipelineState(const class TileRenderPipelineDescriptor* pDescriptor, PipelineOption options, const NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler);
260
+
261
+ void newComputePipelineState(const class Function* pFunction, const NewComputePipelineStateCompletionHandlerFunction& completionHandler);
262
+
263
+ void newComputePipelineState(const class Function* pFunction, PipelineOption options, const NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler);
264
+
265
+ void newComputePipelineState(const class ComputePipelineDescriptor* pDescriptor, PipelineOption options, const NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler);
266
+
267
+ bool isHeadless() const;
268
+
269
+ NS::String* name() const;
270
+
271
+ uint64_t registryID() const;
272
+
273
+ class Architecture* architecture() const;
274
+
275
+ MTL::Size maxThreadsPerThreadgroup() const;
276
+
277
+ bool lowPower() const;
278
+
279
+ bool headless() const;
280
+
281
+ bool removable() const;
282
+
283
+ bool hasUnifiedMemory() const;
284
+
285
+ uint64_t recommendedMaxWorkingSetSize() const;
286
+
287
+ MTL::DeviceLocation location() const;
288
+
289
+ NS::UInteger locationNumber() const;
290
+
291
+ uint64_t maxTransferRate() const;
292
+
293
+ bool depth24Stencil8PixelFormatSupported() const;
294
+
295
+ MTL::ReadWriteTextureTier readWriteTextureSupport() const;
296
+
297
+ MTL::ArgumentBuffersTier argumentBuffersSupport() const;
298
+
299
+ bool rasterOrderGroupsSupported() const;
300
+
301
+ bool supports32BitFloatFiltering() const;
302
+
303
+ bool supports32BitMSAA() const;
304
+
305
+ bool supportsQueryTextureLOD() const;
306
+
307
+ bool supportsBCTextureCompression() const;
308
+
309
+ bool supportsPullModelInterpolation() const;
310
+
311
+ bool barycentricCoordsSupported() const;
312
+
313
+ bool supportsShaderBarycentricCoordinates() const;
314
+
315
+ NS::UInteger currentAllocatedSize() const;
316
+
317
+ class CommandQueue* newCommandQueue();
318
+
319
+ class CommandQueue* newCommandQueue(NS::UInteger maxCommandBufferCount);
320
+
321
+ MTL::SizeAndAlign heapTextureSizeAndAlign(const class TextureDescriptor* desc);
322
+
323
+ MTL::SizeAndAlign heapBufferSizeAndAlign(NS::UInteger length, MTL::ResourceOptions options);
324
+
325
+ class Heap* newHeap(const class HeapDescriptor* descriptor);
326
+
327
+ class Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options);
328
+
329
+ class Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options);
330
+
331
+ class Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, void (^deallocator)(void*, NS::UInteger));
332
+
333
+ class DepthStencilState* newDepthStencilState(const class DepthStencilDescriptor* descriptor);
334
+
335
+ class Texture* newTexture(const class TextureDescriptor* descriptor);
336
+
337
+ class Texture* newTexture(const class TextureDescriptor* descriptor, const IOSurfaceRef iosurface, NS::UInteger plane);
338
+
339
+ class Texture* newSharedTexture(const class TextureDescriptor* descriptor);
340
+
341
+ class Texture* newSharedTexture(const class SharedTextureHandle* sharedHandle);
342
+
343
+ class SamplerState* newSamplerState(const class SamplerDescriptor* descriptor);
344
+
345
+ class Library* newDefaultLibrary();
346
+
347
+ class Library* newDefaultLibrary(const NS::Bundle* bundle, NS::Error** error);
348
+
349
+ class Library* newLibrary(const NS::String* filepath, NS::Error** error);
350
+
351
+ class Library* newLibrary(const NS::URL* url, NS::Error** error);
352
+
353
+ class Library* newLibrary(const dispatch_data_t data, NS::Error** error);
354
+
355
+ class Library* newLibrary(const NS::String* source, const class CompileOptions* options, NS::Error** error);
356
+
357
+ void newLibrary(const NS::String* source, const class CompileOptions* options, const MTL::NewLibraryCompletionHandler completionHandler);
358
+
359
+ class Library* newLibrary(const class StitchedLibraryDescriptor* descriptor, NS::Error** error);
360
+
361
+ void newLibrary(const class StitchedLibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler);
362
+
363
+ class RenderPipelineState* newRenderPipelineState(const class RenderPipelineDescriptor* descriptor, NS::Error** error);
364
+
365
+ class RenderPipelineState* newRenderPipelineState(const class RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);
366
+
367
+ void newRenderPipelineState(const class RenderPipelineDescriptor* descriptor, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);
368
+
369
+ void newRenderPipelineState(const class RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);
370
+
371
+ class ComputePipelineState* newComputePipelineState(const class Function* computeFunction, NS::Error** error);
372
+
373
+ class ComputePipelineState* newComputePipelineState(const class Function* computeFunction, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error);
374
+
375
+ void newComputePipelineState(const class Function* computeFunction, const MTL::NewComputePipelineStateCompletionHandler completionHandler);
376
+
377
+ void newComputePipelineState(const class Function* computeFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler);
378
+
379
+ class ComputePipelineState* newComputePipelineState(const class ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error);
380
+
381
+ void newComputePipelineState(const class ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler);
382
+
383
+ class Fence* newFence();
384
+
385
+ bool supportsFeatureSet(MTL::FeatureSet featureSet);
386
+
387
+ bool supportsFamily(MTL::GPUFamily gpuFamily);
388
+
389
+ bool supportsTextureSampleCount(NS::UInteger sampleCount);
390
+
391
+ NS::UInteger minimumLinearTextureAlignmentForPixelFormat(MTL::PixelFormat format);
392
+
393
+ NS::UInteger minimumTextureBufferAlignmentForPixelFormat(MTL::PixelFormat format);
394
+
395
+ class RenderPipelineState* newRenderPipelineState(const class TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);
396
+
397
+ void newRenderPipelineState(const class TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);
398
+
399
+ class RenderPipelineState* newRenderPipelineState(const class MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);
400
+
401
+ void newRenderPipelineState(const class MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);
402
+
403
+ NS::UInteger maxThreadgroupMemoryLength() const;
404
+
405
+ NS::UInteger maxArgumentBufferSamplerCount() const;
406
+
407
+ bool programmableSamplePositionsSupported() const;
408
+
409
+ void getDefaultSamplePositions(MTL::SamplePosition* positions, NS::UInteger count);
410
+
411
+ class ArgumentEncoder* newArgumentEncoder(const NS::Array* arguments);
412
+
413
+ bool supportsRasterizationRateMap(NS::UInteger layerCount);
414
+
415
+ class RasterizationRateMap* newRasterizationRateMap(const class RasterizationRateMapDescriptor* descriptor);
416
+
417
+ class IndirectCommandBuffer* newIndirectCommandBuffer(const class IndirectCommandBufferDescriptor* descriptor, NS::UInteger maxCount, MTL::ResourceOptions options);
418
+
419
+ class Event* newEvent();
420
+
421
+ class SharedEvent* newSharedEvent();
422
+
423
+ class SharedEvent* newSharedEvent(const class SharedEventHandle* sharedEventHandle);
424
+
425
+ uint64_t peerGroupID() const;
426
+
427
+ uint32_t peerIndex() const;
428
+
429
+ uint32_t peerCount() const;
430
+
431
+ class IOFileHandle* newIOHandle(const NS::URL* url, NS::Error** error);
432
+
433
+ class IOCommandQueue* newIOCommandQueue(const class IOCommandQueueDescriptor* descriptor, NS::Error** error);
434
+
435
+ class IOFileHandle* newIOHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error);
436
+
437
+ class IOFileHandle* newIOFileHandle(const NS::URL* url, NS::Error** error);
438
+
439
+ class IOFileHandle* newIOFileHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error);
440
+
441
+ MTL::Size sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount);
442
+
443
+ NS::UInteger sparseTileSizeInBytes() const;
444
+
445
+ void convertSparsePixelRegions(const MTL::Region* pixelRegions, MTL::Region* tileRegions, MTL::Size tileSize, MTL::SparseTextureRegionAlignmentMode mode, NS::UInteger numRegions);
446
+
447
+ void convertSparseTileRegions(const MTL::Region* tileRegions, MTL::Region* pixelRegions, MTL::Size tileSize, NS::UInteger numRegions);
448
+
449
+ NS::UInteger sparseTileSizeInBytes(MTL::SparsePageSize sparsePageSize);
450
+
451
+ MTL::Size sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount, MTL::SparsePageSize sparsePageSize);
452
+
453
+ NS::UInteger maxBufferLength() const;
454
+
455
+ NS::Array* counterSets() const;
456
+
457
+ class CounterSampleBuffer* newCounterSampleBuffer(const class CounterSampleBufferDescriptor* descriptor, NS::Error** error);
458
+
459
+ void sampleTimestamps(MTL::Timestamp* cpuTimestamp, MTL::Timestamp* gpuTimestamp);
460
+
461
+ class ArgumentEncoder* newArgumentEncoder(const class BufferBinding* bufferBinding);
462
+
463
+ bool supportsCounterSampling(MTL::CounterSamplingPoint samplingPoint);
464
+
465
+ bool supportsVertexAmplificationCount(NS::UInteger count);
466
+
467
+ bool supportsDynamicLibraries() const;
468
+
469
+ bool supportsRenderDynamicLibraries() const;
470
+
471
+ class DynamicLibrary* newDynamicLibrary(const class Library* library, NS::Error** error);
472
+
473
+ class DynamicLibrary* newDynamicLibrary(const NS::URL* url, NS::Error** error);
474
+
475
+ class BinaryArchive* newBinaryArchive(const class BinaryArchiveDescriptor* descriptor, NS::Error** error);
476
+
477
+ bool supportsRaytracing() const;
478
+
479
+ MTL::AccelerationStructureSizes accelerationStructureSizes(const class AccelerationStructureDescriptor* descriptor);
480
+
481
+ class AccelerationStructure* newAccelerationStructure(NS::UInteger size);
482
+
483
+ class AccelerationStructure* newAccelerationStructure(const class AccelerationStructureDescriptor* descriptor);
484
+
485
+ MTL::SizeAndAlign heapAccelerationStructureSizeAndAlign(NS::UInteger size);
486
+
487
+ MTL::SizeAndAlign heapAccelerationStructureSizeAndAlign(const class AccelerationStructureDescriptor* descriptor);
488
+
489
+ bool supportsFunctionPointers() const;
490
+
491
+ bool supportsFunctionPointersFromRender() const;
492
+
493
+ bool supportsRaytracingFromRender() const;
494
+
495
+ bool supportsPrimitiveMotionBlur() const;
496
+
497
+ bool shouldMaximizeConcurrentCompilation() const;
498
+ void setShouldMaximizeConcurrentCompilation(bool shouldMaximizeConcurrentCompilation);
499
+
500
+ NS::UInteger maximumConcurrentCompilationTaskCount() const;
501
+ };
502
+
503
+ }
504
+
505
+ // static method: alloc
506
+ _MTL_INLINE MTL::ArgumentDescriptor* MTL::ArgumentDescriptor::alloc()
507
+ {
508
+ return NS::Object::alloc<MTL::ArgumentDescriptor>(_MTL_PRIVATE_CLS(MTLArgumentDescriptor));
509
+ }
510
+
511
+ // method: init
512
+ _MTL_INLINE MTL::ArgumentDescriptor* MTL::ArgumentDescriptor::init()
513
+ {
514
+ return NS::Object::init<MTL::ArgumentDescriptor>();
515
+ }
516
+
517
+ // static method: argumentDescriptor
518
+ _MTL_INLINE MTL::ArgumentDescriptor* MTL::ArgumentDescriptor::argumentDescriptor()
519
+ {
520
+ return Object::sendMessage<MTL::ArgumentDescriptor*>(_MTL_PRIVATE_CLS(MTLArgumentDescriptor), _MTL_PRIVATE_SEL(argumentDescriptor));
521
+ }
522
+
523
+ // property: dataType
524
+ _MTL_INLINE MTL::DataType MTL::ArgumentDescriptor::dataType() const
525
+ {
526
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(dataType));
527
+ }
528
+
529
+ _MTL_INLINE void MTL::ArgumentDescriptor::setDataType(MTL::DataType dataType)
530
+ {
531
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDataType_), dataType);
532
+ }
533
+
534
+ // property: index
535
+ _MTL_INLINE NS::UInteger MTL::ArgumentDescriptor::index() const
536
+ {
537
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
538
+ }
539
+
540
+ _MTL_INLINE void MTL::ArgumentDescriptor::setIndex(NS::UInteger index)
541
+ {
542
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setIndex_), index);
543
+ }
544
+
545
+ // property: arrayLength
546
+ _MTL_INLINE NS::UInteger MTL::ArgumentDescriptor::arrayLength() const
547
+ {
548
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(arrayLength));
549
+ }
550
+
551
+ _MTL_INLINE void MTL::ArgumentDescriptor::setArrayLength(NS::UInteger arrayLength)
552
+ {
553
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArrayLength_), arrayLength);
554
+ }
555
+
556
+ // property: access
557
+ _MTL_INLINE MTL::BindingAccess MTL::ArgumentDescriptor::access() const
558
+ {
559
+ return Object::sendMessage<MTL::BindingAccess>(this, _MTL_PRIVATE_SEL(access));
560
+ }
561
+
562
+ _MTL_INLINE void MTL::ArgumentDescriptor::setAccess(MTL::BindingAccess access)
563
+ {
564
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAccess_), access);
565
+ }
566
+
567
+ // property: textureType
568
+ _MTL_INLINE MTL::TextureType MTL::ArgumentDescriptor::textureType() const
569
+ {
570
+ return Object::sendMessage<MTL::TextureType>(this, _MTL_PRIVATE_SEL(textureType));
571
+ }
572
+
573
+ _MTL_INLINE void MTL::ArgumentDescriptor::setTextureType(MTL::TextureType textureType)
574
+ {
575
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTextureType_), textureType);
576
+ }
577
+
578
+ // property: constantBlockAlignment
579
+ _MTL_INLINE NS::UInteger MTL::ArgumentDescriptor::constantBlockAlignment() const
580
+ {
581
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(constantBlockAlignment));
582
+ }
583
+
584
+ _MTL_INLINE void MTL::ArgumentDescriptor::setConstantBlockAlignment(NS::UInteger constantBlockAlignment)
585
+ {
586
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantBlockAlignment_), constantBlockAlignment);
587
+ }
588
+
589
+ // static method: alloc
590
+ _MTL_INLINE MTL::Architecture* MTL::Architecture::alloc()
591
+ {
592
+ return NS::Object::alloc<MTL::Architecture>(_MTL_PRIVATE_CLS(MTLArchitecture));
593
+ }
594
+
595
+ // method: init
596
+ _MTL_INLINE MTL::Architecture* MTL::Architecture::init()
597
+ {
598
+ return NS::Object::init<MTL::Architecture>();
599
+ }
600
+
601
+ // property: name
602
+ _MTL_INLINE NS::String* MTL::Architecture::name() const
603
+ {
604
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
605
+ }
606
+
607
+ _MTL_PRIVATE_DEF_WEAK_CONST(MTL::DeviceNotificationName, DeviceWasAddedNotification);
608
+ _MTL_PRIVATE_DEF_WEAK_CONST(MTL::DeviceNotificationName, DeviceRemovalRequestedNotification);
609
+ _MTL_PRIVATE_DEF_WEAK_CONST(MTL::DeviceNotificationName, DeviceWasRemovedNotification);
610
+ _MTL_PRIVATE_DEF_CONST(NS::ErrorUserInfoKey, CommandBufferEncoderInfoErrorKey);
611
+
612
+ #if defined(MTL_PRIVATE_IMPLEMENTATION)
613
+
614
+ extern "C" MTL::Device* MTLCreateSystemDefaultDevice();
615
+
616
+ extern "C" NS::Array* MTLCopyAllDevices();
617
+
618
+ extern "C" NS::Array* MTLCopyAllDevicesWithObserver(NS::Object**, MTL::DeviceNotificationHandlerBlock);
619
+
620
+ extern "C" void MTLRemoveDeviceObserver(const NS::Object*);
621
+
622
+ #include <TargetConditionals.h>
623
+
624
+ _NS_EXPORT MTL::Device* MTL::CreateSystemDefaultDevice()
625
+ {
626
+ return ::MTLCreateSystemDefaultDevice();
627
+ }
628
+
629
+ _NS_EXPORT NS::Array* MTL::CopyAllDevices()
630
+ {
631
+ #if TARGET_OS_OSX
632
+ return ::MTLCopyAllDevices();
633
+ #else
634
+ return nullptr;
635
+ #endif // TARGET_OS_OSX
636
+ }
637
+
638
+ _NS_EXPORT NS::Array* MTL::CopyAllDevicesWithObserver(NS::Object** pOutObserver, DeviceNotificationHandlerBlock handler)
639
+ {
640
+ #if TARGET_OS_OSX
641
+ return ::MTLCopyAllDevicesWithObserver(pOutObserver, handler);
642
+ #else
643
+ (void)pOutObserver;
644
+ (void)handler;
645
+
646
+ return nullptr;
647
+ #endif // TARGET_OS_OSX
648
+ }
649
+
650
+ _NS_EXPORT NS::Array* MTL::CopyAllDevicesWithObserver(NS::Object** pOutObserver, const DeviceNotificationHandlerFunction& handler)
651
+ {
652
+ __block DeviceNotificationHandlerFunction function = handler;
653
+
654
+ return CopyAllDevicesWithObserver(pOutObserver, ^(Device* pDevice, DeviceNotificationName pNotificationName) { function(pDevice, pNotificationName); });
655
+ }
656
+
657
+ _NS_EXPORT void MTL::RemoveDeviceObserver(const NS::Object* pObserver)
658
+ {
659
+ #if TARGET_OS_OSX
660
+ ::MTLRemoveDeviceObserver(pObserver);
661
+ #endif // TARGET_OS_OSX
662
+ }
663
+
664
+ #endif // MTL_PRIVATE_IMPLEMENTATION
665
+
666
+ _MTL_INLINE void MTL::Device::newLibrary(const NS::String* pSource, const CompileOptions* pOptions, const NewLibraryCompletionHandlerFunction& completionHandler)
667
+ {
668
+ __block NewLibraryCompletionHandlerFunction blockCompletionHandler = completionHandler;
669
+
670
+ newLibrary(pSource, pOptions, ^(Library* pLibrary, NS::Error* pError) { blockCompletionHandler(pLibrary, pError); });
671
+ }
672
+
673
+ _MTL_INLINE void MTL::Device::newLibrary(const class StitchedLibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& completionHandler)
674
+ {
675
+ __block NewLibraryCompletionHandlerFunction blockCompletionHandler = completionHandler;
676
+
677
+ newLibrary(pDescriptor, ^(Library* pLibrary, NS::Error* pError) { blockCompletionHandler(pLibrary, pError); });
678
+ }
679
+
680
+ _MTL_INLINE void MTL::Device::newRenderPipelineState(const RenderPipelineDescriptor* pDescriptor, const NewRenderPipelineStateCompletionHandlerFunction& completionHandler)
681
+ {
682
+ __block NewRenderPipelineStateCompletionHandlerFunction blockCompletionHandler = completionHandler;
683
+
684
+ newRenderPipelineState(pDescriptor, ^(RenderPipelineState* pPipelineState, NS::Error* pError) { blockCompletionHandler(pPipelineState, pError); });
685
+ }
686
+
687
+ _MTL_INLINE void MTL::Device::newRenderPipelineState(const RenderPipelineDescriptor* pDescriptor, PipelineOption options, const NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler)
688
+ {
689
+ __block NewRenderPipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;
690
+
691
+ newRenderPipelineState(pDescriptor, options, ^(RenderPipelineState* pPipelineState, class RenderPipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });
692
+ }
693
+
694
+ _MTL_INLINE void MTL::Device::newRenderPipelineState(const TileRenderPipelineDescriptor* pDescriptor, PipelineOption options, const NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler)
695
+ {
696
+ __block NewRenderPipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;
697
+
698
+ newRenderPipelineState(pDescriptor, options, ^(RenderPipelineState* pPipelineState, class RenderPipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });
699
+ }
700
+
701
+ _MTL_INLINE void MTL::Device::newComputePipelineState(const class Function* pFunction, const NewComputePipelineStateCompletionHandlerFunction& completionHandler)
702
+ {
703
+ __block NewComputePipelineStateCompletionHandlerFunction blockCompletionHandler = completionHandler;
704
+
705
+ newComputePipelineState(pFunction, ^(ComputePipelineState* pPipelineState, NS::Error* pError) { blockCompletionHandler(pPipelineState, pError); });
706
+ }
707
+
708
+ _MTL_INLINE void MTL::Device::newComputePipelineState(const Function* pFunction, PipelineOption options, const NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler)
709
+ {
710
+ __block NewComputePipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;
711
+
712
+ newComputePipelineState(pFunction, options, ^(ComputePipelineState* pPipelineState, ComputePipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });
713
+ }
714
+
715
+ _MTL_INLINE void MTL::Device::newComputePipelineState(const ComputePipelineDescriptor* pDescriptor, PipelineOption options, const NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler)
716
+ {
717
+ __block NewComputePipelineStateWithReflectionCompletionHandlerFunction blockCompletionHandler = completionHandler;
718
+
719
+ newComputePipelineState(pDescriptor, options, ^(ComputePipelineState* pPipelineState, ComputePipelineReflection* pReflection, NS::Error* pError) { blockCompletionHandler(pPipelineState, pReflection, pError); });
720
+ }
721
+
722
+ _MTL_INLINE bool MTL::Device::isHeadless() const
723
+ {
724
+ return headless();
725
+ }
726
+
727
+ // property: name
728
+ _MTL_INLINE NS::String* MTL::Device::name() const
729
+ {
730
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
731
+ }
732
+
733
+ // property: registryID
734
+ _MTL_INLINE uint64_t MTL::Device::registryID() const
735
+ {
736
+ return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(registryID));
737
+ }
738
+
739
+ // property: architecture
740
+ _MTL_INLINE MTL::Architecture* MTL::Device::architecture() const
741
+ {
742
+ return Object::sendMessage<MTL::Architecture*>(this, _MTL_PRIVATE_SEL(architecture));
743
+ }
744
+
745
+ // property: maxThreadsPerThreadgroup
746
+ _MTL_INLINE MTL::Size MTL::Device::maxThreadsPerThreadgroup() const
747
+ {
748
+ return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(maxThreadsPerThreadgroup));
749
+ }
750
+
751
+ // property: lowPower
752
+ _MTL_INLINE bool MTL::Device::lowPower() const
753
+ {
754
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isLowPower));
755
+ }
756
+
757
+ // property: headless
758
+ _MTL_INLINE bool MTL::Device::headless() const
759
+ {
760
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isHeadless));
761
+ }
762
+
763
+ // property: removable
764
+ _MTL_INLINE bool MTL::Device::removable() const
765
+ {
766
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isRemovable));
767
+ }
768
+
769
+ // property: hasUnifiedMemory
770
+ _MTL_INLINE bool MTL::Device::hasUnifiedMemory() const
771
+ {
772
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(hasUnifiedMemory));
773
+ }
774
+
775
+ // property: recommendedMaxWorkingSetSize
776
+ _MTL_INLINE uint64_t MTL::Device::recommendedMaxWorkingSetSize() const
777
+ {
778
+ return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(recommendedMaxWorkingSetSize));
779
+ }
780
+
781
+ // property: location
782
+ _MTL_INLINE MTL::DeviceLocation MTL::Device::location() const
783
+ {
784
+ return Object::sendMessage<MTL::DeviceLocation>(this, _MTL_PRIVATE_SEL(location));
785
+ }
786
+
787
+ // property: locationNumber
788
+ _MTL_INLINE NS::UInteger MTL::Device::locationNumber() const
789
+ {
790
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(locationNumber));
791
+ }
792
+
793
+ // property: maxTransferRate
794
+ _MTL_INLINE uint64_t MTL::Device::maxTransferRate() const
795
+ {
796
+ return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(maxTransferRate));
797
+ }
798
+
799
+ // property: depth24Stencil8PixelFormatSupported
800
+ _MTL_INLINE bool MTL::Device::depth24Stencil8PixelFormatSupported() const
801
+ {
802
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(isDepth24Stencil8PixelFormatSupported));
803
+ }
804
+
805
+ // property: readWriteTextureSupport
806
+ _MTL_INLINE MTL::ReadWriteTextureTier MTL::Device::readWriteTextureSupport() const
807
+ {
808
+ return Object::sendMessage<MTL::ReadWriteTextureTier>(this, _MTL_PRIVATE_SEL(readWriteTextureSupport));
809
+ }
810
+
811
+ // property: argumentBuffersSupport
812
+ _MTL_INLINE MTL::ArgumentBuffersTier MTL::Device::argumentBuffersSupport() const
813
+ {
814
+ return Object::sendMessage<MTL::ArgumentBuffersTier>(this, _MTL_PRIVATE_SEL(argumentBuffersSupport));
815
+ }
816
+
817
+ // property: rasterOrderGroupsSupported
818
+ _MTL_INLINE bool MTL::Device::rasterOrderGroupsSupported() const
819
+ {
820
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areRasterOrderGroupsSupported));
821
+ }
822
+
823
+ // property: supports32BitFloatFiltering
824
+ _MTL_INLINE bool MTL::Device::supports32BitFloatFiltering() const
825
+ {
826
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supports32BitFloatFiltering));
827
+ }
828
+
829
+ // property: supports32BitMSAA
830
+ _MTL_INLINE bool MTL::Device::supports32BitMSAA() const
831
+ {
832
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supports32BitMSAA));
833
+ }
834
+
835
+ // property: supportsQueryTextureLOD
836
+ _MTL_INLINE bool MTL::Device::supportsQueryTextureLOD() const
837
+ {
838
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsQueryTextureLOD));
839
+ }
840
+
841
+ // property: supportsBCTextureCompression
842
+ _MTL_INLINE bool MTL::Device::supportsBCTextureCompression() const
843
+ {
844
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsBCTextureCompression));
845
+ }
846
+
847
+ // property: supportsPullModelInterpolation
848
+ _MTL_INLINE bool MTL::Device::supportsPullModelInterpolation() const
849
+ {
850
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsPullModelInterpolation));
851
+ }
852
+
853
+ // property: barycentricCoordsSupported
854
+ _MTL_INLINE bool MTL::Device::barycentricCoordsSupported() const
855
+ {
856
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areBarycentricCoordsSupported));
857
+ }
858
+
859
+ // property: supportsShaderBarycentricCoordinates
860
+ _MTL_INLINE bool MTL::Device::supportsShaderBarycentricCoordinates() const
861
+ {
862
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsShaderBarycentricCoordinates));
863
+ }
864
+
865
+ // property: currentAllocatedSize
866
+ _MTL_INLINE NS::UInteger MTL::Device::currentAllocatedSize() const
867
+ {
868
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(currentAllocatedSize));
869
+ }
870
+
871
+ // method: newCommandQueue
872
+ _MTL_INLINE MTL::CommandQueue* MTL::Device::newCommandQueue()
873
+ {
874
+ return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(newCommandQueue));
875
+ }
876
+
877
+ // method: newCommandQueueWithMaxCommandBufferCount:
878
+ _MTL_INLINE MTL::CommandQueue* MTL::Device::newCommandQueue(NS::UInteger maxCommandBufferCount)
879
+ {
880
+ return Object::sendMessage<MTL::CommandQueue*>(this, _MTL_PRIVATE_SEL(newCommandQueueWithMaxCommandBufferCount_), maxCommandBufferCount);
881
+ }
882
+
883
+ // method: heapTextureSizeAndAlignWithDescriptor:
884
+ _MTL_INLINE MTL::SizeAndAlign MTL::Device::heapTextureSizeAndAlign(const MTL::TextureDescriptor* desc)
885
+ {
886
+ return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapTextureSizeAndAlignWithDescriptor_), desc);
887
+ }
888
+
889
+ // method: heapBufferSizeAndAlignWithLength:options:
890
+ _MTL_INLINE MTL::SizeAndAlign MTL::Device::heapBufferSizeAndAlign(NS::UInteger length, MTL::ResourceOptions options)
891
+ {
892
+ return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapBufferSizeAndAlignWithLength_options_), length, options);
893
+ }
894
+
895
+ // method: newHeapWithDescriptor:
896
+ _MTL_INLINE MTL::Heap* MTL::Device::newHeap(const MTL::HeapDescriptor* descriptor)
897
+ {
898
+ return Object::sendMessage<MTL::Heap*>(this, _MTL_PRIVATE_SEL(newHeapWithDescriptor_), descriptor);
899
+ }
900
+
901
+ // method: newBufferWithLength:options:
902
+ _MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(NS::UInteger length, MTL::ResourceOptions options)
903
+ {
904
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_), length, options);
905
+ }
906
+
907
+ // method: newBufferWithBytes:length:options:
908
+ _MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options)
909
+ {
910
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithBytes_length_options_), pointer, length, options);
911
+ }
912
+
913
+ // method: newBufferWithBytesNoCopy:length:options:deallocator:
914
+ _MTL_INLINE MTL::Buffer* MTL::Device::newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, void (^deallocator)(void*, NS::UInteger))
915
+ {
916
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithBytesNoCopy_length_options_deallocator_), pointer, length, options, deallocator);
917
+ }
918
+
919
+ // method: newDepthStencilStateWithDescriptor:
920
+ _MTL_INLINE MTL::DepthStencilState* MTL::Device::newDepthStencilState(const MTL::DepthStencilDescriptor* descriptor)
921
+ {
922
+ return Object::sendMessage<MTL::DepthStencilState*>(this, _MTL_PRIVATE_SEL(newDepthStencilStateWithDescriptor_), descriptor);
923
+ }
924
+
925
+ // method: newTextureWithDescriptor:
926
+ _MTL_INLINE MTL::Texture* MTL::Device::newTexture(const MTL::TextureDescriptor* descriptor)
927
+ {
928
+ return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_), descriptor);
929
+ }
930
+
931
+ // method: newTextureWithDescriptor:iosurface:plane:
932
+ _MTL_INLINE MTL::Texture* MTL::Device::newTexture(const MTL::TextureDescriptor* descriptor, const IOSurfaceRef iosurface, NS::UInteger plane)
933
+ {
934
+ return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_iosurface_plane_), descriptor, iosurface, plane);
935
+ }
936
+
937
+ // method: newSharedTextureWithDescriptor:
938
+ _MTL_INLINE MTL::Texture* MTL::Device::newSharedTexture(const MTL::TextureDescriptor* descriptor)
939
+ {
940
+ return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newSharedTextureWithDescriptor_), descriptor);
941
+ }
942
+
943
+ // method: newSharedTextureWithHandle:
944
+ _MTL_INLINE MTL::Texture* MTL::Device::newSharedTexture(const MTL::SharedTextureHandle* sharedHandle)
945
+ {
946
+ return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newSharedTextureWithHandle_), sharedHandle);
947
+ }
948
+
949
+ // method: newSamplerStateWithDescriptor:
950
+ _MTL_INLINE MTL::SamplerState* MTL::Device::newSamplerState(const MTL::SamplerDescriptor* descriptor)
951
+ {
952
+ return Object::sendMessage<MTL::SamplerState*>(this, _MTL_PRIVATE_SEL(newSamplerStateWithDescriptor_), descriptor);
953
+ }
954
+
955
+ // method: newDefaultLibrary
956
+ _MTL_INLINE MTL::Library* MTL::Device::newDefaultLibrary()
957
+ {
958
+ return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newDefaultLibrary));
959
+ }
960
+
961
+ // method: newDefaultLibraryWithBundle:error:
962
+ _MTL_INLINE MTL::Library* MTL::Device::newDefaultLibrary(const NS::Bundle* bundle, NS::Error** error)
963
+ {
964
+ return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newDefaultLibraryWithBundle_error_), bundle, error);
965
+ }
966
+
967
+ // method: newLibraryWithFile:error:
968
+ _MTL_INLINE MTL::Library* MTL::Device::newLibrary(const NS::String* filepath, NS::Error** error)
969
+ {
970
+ return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithFile_error_), filepath, error);
971
+ }
972
+
973
+ // method: newLibraryWithURL:error:
974
+ _MTL_INLINE MTL::Library* MTL::Device::newLibrary(const NS::URL* url, NS::Error** error)
975
+ {
976
+ return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithURL_error_), url, error);
977
+ }
978
+
979
+ // method: newLibraryWithData:error:
980
+ _MTL_INLINE MTL::Library* MTL::Device::newLibrary(const dispatch_data_t data, NS::Error** error)
981
+ {
982
+ return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithData_error_), data, error);
983
+ }
984
+
985
+ // method: newLibraryWithSource:options:error:
986
+ _MTL_INLINE MTL::Library* MTL::Device::newLibrary(const NS::String* source, const MTL::CompileOptions* options, NS::Error** error)
987
+ {
988
+ return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithSource_options_error_), source, options, error);
989
+ }
990
+
991
+ // method: newLibraryWithSource:options:completionHandler:
992
+ _MTL_INLINE void MTL::Device::newLibrary(const NS::String* source, const MTL::CompileOptions* options, const MTL::NewLibraryCompletionHandler completionHandler)
993
+ {
994
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newLibraryWithSource_options_completionHandler_), source, options, completionHandler);
995
+ }
996
+
997
+ // method: newLibraryWithStitchedDescriptor:error:
998
+ _MTL_INLINE MTL::Library* MTL::Device::newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, NS::Error** error)
999
+ {
1000
+ return Object::sendMessage<MTL::Library*>(this, _MTL_PRIVATE_SEL(newLibraryWithStitchedDescriptor_error_), descriptor, error);
1001
+ }
1002
+
1003
+ // method: newLibraryWithStitchedDescriptor:completionHandler:
1004
+ _MTL_INLINE void MTL::Device::newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler)
1005
+ {
1006
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newLibraryWithStitchedDescriptor_completionHandler_), descriptor, completionHandler);
1007
+ }
1008
+
1009
+ // method: newRenderPipelineStateWithDescriptor:error:
1010
+ _MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, NS::Error** error)
1011
+ {
1012
+ return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_error_), descriptor, error);
1013
+ }
1014
+
1015
+ // method: newRenderPipelineStateWithDescriptor:options:reflection:error:
1016
+ _MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error)
1017
+ {
1018
+ return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_options_reflection_error_), descriptor, options, reflection, error);
1019
+ }
1020
+
1021
+ // method: newRenderPipelineStateWithDescriptor:completionHandler:
1022
+ _MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, const MTL::NewRenderPipelineStateCompletionHandler completionHandler)
1023
+ {
1024
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_completionHandler_), descriptor, completionHandler);
1025
+ }
1026
+
1027
+ // method: newRenderPipelineStateWithDescriptor:options:completionHandler:
1028
+ _MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler)
1029
+ {
1030
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithDescriptor_options_completionHandler_), descriptor, options, completionHandler);
1031
+ }
1032
+
1033
+ // method: newComputePipelineStateWithFunction:error:
1034
+ _MTL_INLINE MTL::ComputePipelineState* MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, NS::Error** error)
1035
+ {
1036
+ return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_error_), computeFunction, error);
1037
+ }
1038
+
1039
+ // method: newComputePipelineStateWithFunction:options:reflection:error:
1040
+ _MTL_INLINE MTL::ComputePipelineState* MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error)
1041
+ {
1042
+ return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_options_reflection_error_), computeFunction, options, reflection, error);
1043
+ }
1044
+
1045
+ // method: newComputePipelineStateWithFunction:completionHandler:
1046
+ _MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, const MTL::NewComputePipelineStateCompletionHandler completionHandler)
1047
+ {
1048
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_completionHandler_), computeFunction, completionHandler);
1049
+ }
1050
+
1051
+ // method: newComputePipelineStateWithFunction:options:completionHandler:
1052
+ _MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler)
1053
+ {
1054
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithFunction_options_completionHandler_), computeFunction, options, completionHandler);
1055
+ }
1056
+
1057
+ // method: newComputePipelineStateWithDescriptor:options:reflection:error:
1058
+ _MTL_INLINE MTL::ComputePipelineState* MTL::Device::newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error)
1059
+ {
1060
+ return Object::sendMessage<MTL::ComputePipelineState*>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_options_reflection_error_), descriptor, options, reflection, error);
1061
+ }
1062
+
1063
+ // method: newComputePipelineStateWithDescriptor:options:completionHandler:
1064
+ _MTL_INLINE void MTL::Device::newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler)
1065
+ {
1066
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newComputePipelineStateWithDescriptor_options_completionHandler_), descriptor, options, completionHandler);
1067
+ }
1068
+
1069
+ // method: newFence
1070
+ _MTL_INLINE MTL::Fence* MTL::Device::newFence()
1071
+ {
1072
+ return Object::sendMessage<MTL::Fence*>(this, _MTL_PRIVATE_SEL(newFence));
1073
+ }
1074
+
1075
+ // method: supportsFeatureSet:
1076
+ _MTL_INLINE bool MTL::Device::supportsFeatureSet(MTL::FeatureSet featureSet)
1077
+ {
1078
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFeatureSet_), featureSet);
1079
+ }
1080
+
1081
+ // method: supportsFamily:
1082
+ _MTL_INLINE bool MTL::Device::supportsFamily(MTL::GPUFamily gpuFamily)
1083
+ {
1084
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFamily_), gpuFamily);
1085
+ }
1086
+
1087
+ // method: supportsTextureSampleCount:
1088
+ _MTL_INLINE bool MTL::Device::supportsTextureSampleCount(NS::UInteger sampleCount)
1089
+ {
1090
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsTextureSampleCount_), sampleCount);
1091
+ }
1092
+
1093
+ // method: minimumLinearTextureAlignmentForPixelFormat:
1094
+ _MTL_INLINE NS::UInteger MTL::Device::minimumLinearTextureAlignmentForPixelFormat(MTL::PixelFormat format)
1095
+ {
1096
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(minimumLinearTextureAlignmentForPixelFormat_), format);
1097
+ }
1098
+
1099
+ // method: minimumTextureBufferAlignmentForPixelFormat:
1100
+ _MTL_INLINE NS::UInteger MTL::Device::minimumTextureBufferAlignmentForPixelFormat(MTL::PixelFormat format)
1101
+ {
1102
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(minimumTextureBufferAlignmentForPixelFormat_), format);
1103
+ }
1104
+
1105
+ // method: newRenderPipelineStateWithTileDescriptor:options:reflection:error:
1106
+ _MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error)
1107
+ {
1108
+ return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithTileDescriptor_options_reflection_error_), descriptor, options, reflection, error);
1109
+ }
1110
+
1111
+ // method: newRenderPipelineStateWithTileDescriptor:options:completionHandler:
1112
+ _MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler)
1113
+ {
1114
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithTileDescriptor_options_completionHandler_), descriptor, options, completionHandler);
1115
+ }
1116
+
1117
+ // method: newRenderPipelineStateWithMeshDescriptor:options:reflection:error:
1118
+ _MTL_INLINE MTL::RenderPipelineState* MTL::Device::newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error)
1119
+ {
1120
+ return Object::sendMessage<MTL::RenderPipelineState*>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithMeshDescriptor_options_reflection_error_), descriptor, options, reflection, error);
1121
+ }
1122
+
1123
+ // method: newRenderPipelineStateWithMeshDescriptor:options:completionHandler:
1124
+ _MTL_INLINE void MTL::Device::newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler)
1125
+ {
1126
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newRenderPipelineStateWithMeshDescriptor_options_completionHandler_), descriptor, options, completionHandler);
1127
+ }
1128
+
1129
+ // property: maxThreadgroupMemoryLength
1130
+ _MTL_INLINE NS::UInteger MTL::Device::maxThreadgroupMemoryLength() const
1131
+ {
1132
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxThreadgroupMemoryLength));
1133
+ }
1134
+
1135
+ // property: maxArgumentBufferSamplerCount
1136
+ _MTL_INLINE NS::UInteger MTL::Device::maxArgumentBufferSamplerCount() const
1137
+ {
1138
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxArgumentBufferSamplerCount));
1139
+ }
1140
+
1141
+ // property: programmableSamplePositionsSupported
1142
+ _MTL_INLINE bool MTL::Device::programmableSamplePositionsSupported() const
1143
+ {
1144
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(areProgrammableSamplePositionsSupported));
1145
+ }
1146
+
1147
+ // method: getDefaultSamplePositions:count:
1148
+ _MTL_INLINE void MTL::Device::getDefaultSamplePositions(MTL::SamplePosition* positions, NS::UInteger count)
1149
+ {
1150
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(getDefaultSamplePositions_count_), positions, count);
1151
+ }
1152
+
1153
+ // method: newArgumentEncoderWithArguments:
1154
+ _MTL_INLINE MTL::ArgumentEncoder* MTL::Device::newArgumentEncoder(const NS::Array* arguments)
1155
+ {
1156
+ return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithArguments_), arguments);
1157
+ }
1158
+
1159
+ // method: supportsRasterizationRateMapWithLayerCount:
1160
+ _MTL_INLINE bool MTL::Device::supportsRasterizationRateMap(NS::UInteger layerCount)
1161
+ {
1162
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRasterizationRateMapWithLayerCount_), layerCount);
1163
+ }
1164
+
1165
+ // method: newRasterizationRateMapWithDescriptor:
1166
+ _MTL_INLINE MTL::RasterizationRateMap* MTL::Device::newRasterizationRateMap(const MTL::RasterizationRateMapDescriptor* descriptor)
1167
+ {
1168
+ return Object::sendMessage<MTL::RasterizationRateMap*>(this, _MTL_PRIVATE_SEL(newRasterizationRateMapWithDescriptor_), descriptor);
1169
+ }
1170
+
1171
+ // method: newIndirectCommandBufferWithDescriptor:maxCommandCount:options:
1172
+ _MTL_INLINE MTL::IndirectCommandBuffer* MTL::Device::newIndirectCommandBuffer(const MTL::IndirectCommandBufferDescriptor* descriptor, NS::UInteger maxCount, MTL::ResourceOptions options)
1173
+ {
1174
+ return Object::sendMessage<MTL::IndirectCommandBuffer*>(this, _MTL_PRIVATE_SEL(newIndirectCommandBufferWithDescriptor_maxCommandCount_options_), descriptor, maxCount, options);
1175
+ }
1176
+
1177
+ // method: newEvent
1178
+ _MTL_INLINE MTL::Event* MTL::Device::newEvent()
1179
+ {
1180
+ return Object::sendMessage<MTL::Event*>(this, _MTL_PRIVATE_SEL(newEvent));
1181
+ }
1182
+
1183
+ // method: newSharedEvent
1184
+ _MTL_INLINE MTL::SharedEvent* MTL::Device::newSharedEvent()
1185
+ {
1186
+ return Object::sendMessage<MTL::SharedEvent*>(this, _MTL_PRIVATE_SEL(newSharedEvent));
1187
+ }
1188
+
1189
+ // method: newSharedEventWithHandle:
1190
+ _MTL_INLINE MTL::SharedEvent* MTL::Device::newSharedEvent(const MTL::SharedEventHandle* sharedEventHandle)
1191
+ {
1192
+ return Object::sendMessage<MTL::SharedEvent*>(this, _MTL_PRIVATE_SEL(newSharedEventWithHandle_), sharedEventHandle);
1193
+ }
1194
+
1195
+ // property: peerGroupID
1196
+ _MTL_INLINE uint64_t MTL::Device::peerGroupID() const
1197
+ {
1198
+ return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(peerGroupID));
1199
+ }
1200
+
1201
+ // property: peerIndex
1202
+ _MTL_INLINE uint32_t MTL::Device::peerIndex() const
1203
+ {
1204
+ return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(peerIndex));
1205
+ }
1206
+
1207
+ // property: peerCount
1208
+ _MTL_INLINE uint32_t MTL::Device::peerCount() const
1209
+ {
1210
+ return Object::sendMessage<uint32_t>(this, _MTL_PRIVATE_SEL(peerCount));
1211
+ }
1212
+
1213
+ // method: newIOHandleWithURL:error:
1214
+ _MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOHandle(const NS::URL* url, NS::Error** error)
1215
+ {
1216
+ return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOHandleWithURL_error_), url, error);
1217
+ }
1218
+
1219
+ // method: newIOCommandQueueWithDescriptor:error:
1220
+ _MTL_INLINE MTL::IOCommandQueue* MTL::Device::newIOCommandQueue(const MTL::IOCommandQueueDescriptor* descriptor, NS::Error** error)
1221
+ {
1222
+ return Object::sendMessage<MTL::IOCommandQueue*>(this, _MTL_PRIVATE_SEL(newIOCommandQueueWithDescriptor_error_), descriptor, error);
1223
+ }
1224
+
1225
+ // method: newIOHandleWithURL:compressionMethod:error:
1226
+ _MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error)
1227
+ {
1228
+ return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOHandleWithURL_compressionMethod_error_), url, compressionMethod, error);
1229
+ }
1230
+
1231
+ // method: newIOFileHandleWithURL:error:
1232
+ _MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOFileHandle(const NS::URL* url, NS::Error** error)
1233
+ {
1234
+ return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOFileHandleWithURL_error_), url, error);
1235
+ }
1236
+
1237
+ // method: newIOFileHandleWithURL:compressionMethod:error:
1238
+ _MTL_INLINE MTL::IOFileHandle* MTL::Device::newIOFileHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error)
1239
+ {
1240
+ return Object::sendMessage<MTL::IOFileHandle*>(this, _MTL_PRIVATE_SEL(newIOFileHandleWithURL_compressionMethod_error_), url, compressionMethod, error);
1241
+ }
1242
+
1243
+ // method: sparseTileSizeWithTextureType:pixelFormat:sampleCount:
1244
+ _MTL_INLINE MTL::Size MTL::Device::sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount)
1245
+ {
1246
+ return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(sparseTileSizeWithTextureType_pixelFormat_sampleCount_), textureType, pixelFormat, sampleCount);
1247
+ }
1248
+
1249
+ // property: sparseTileSizeInBytes
1250
+ _MTL_INLINE NS::UInteger MTL::Device::sparseTileSizeInBytes() const
1251
+ {
1252
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sparseTileSizeInBytes));
1253
+ }
1254
+
1255
+ // method: convertSparsePixelRegions:toTileRegions:withTileSize:alignmentMode:numRegions:
1256
+ _MTL_INLINE void MTL::Device::convertSparsePixelRegions(const MTL::Region* pixelRegions, MTL::Region* tileRegions, MTL::Size tileSize, MTL::SparseTextureRegionAlignmentMode mode, NS::UInteger numRegions)
1257
+ {
1258
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(convertSparsePixelRegions_toTileRegions_withTileSize_alignmentMode_numRegions_), pixelRegions, tileRegions, tileSize, mode, numRegions);
1259
+ }
1260
+
1261
+ // method: convertSparseTileRegions:toPixelRegions:withTileSize:numRegions:
1262
+ _MTL_INLINE void MTL::Device::convertSparseTileRegions(const MTL::Region* tileRegions, MTL::Region* pixelRegions, MTL::Size tileSize, NS::UInteger numRegions)
1263
+ {
1264
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(convertSparseTileRegions_toPixelRegions_withTileSize_numRegions_), tileRegions, pixelRegions, tileSize, numRegions);
1265
+ }
1266
+
1267
+ // method: sparseTileSizeInBytesForSparsePageSize:
1268
+ _MTL_INLINE NS::UInteger MTL::Device::sparseTileSizeInBytes(MTL::SparsePageSize sparsePageSize)
1269
+ {
1270
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(sparseTileSizeInBytesForSparsePageSize_), sparsePageSize);
1271
+ }
1272
+
1273
+ // method: sparseTileSizeWithTextureType:pixelFormat:sampleCount:sparsePageSize:
1274
+ _MTL_INLINE MTL::Size MTL::Device::sparseTileSize(MTL::TextureType textureType, MTL::PixelFormat pixelFormat, NS::UInteger sampleCount, MTL::SparsePageSize sparsePageSize)
1275
+ {
1276
+ return Object::sendMessage<MTL::Size>(this, _MTL_PRIVATE_SEL(sparseTileSizeWithTextureType_pixelFormat_sampleCount_sparsePageSize_), textureType, pixelFormat, sampleCount, sparsePageSize);
1277
+ }
1278
+
1279
+ // property: maxBufferLength
1280
+ _MTL_INLINE NS::UInteger MTL::Device::maxBufferLength() const
1281
+ {
1282
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxBufferLength));
1283
+ }
1284
+
1285
+ // property: counterSets
1286
+ _MTL_INLINE NS::Array* MTL::Device::counterSets() const
1287
+ {
1288
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(counterSets));
1289
+ }
1290
+
1291
+ // method: newCounterSampleBufferWithDescriptor:error:
1292
+ _MTL_INLINE MTL::CounterSampleBuffer* MTL::Device::newCounterSampleBuffer(const MTL::CounterSampleBufferDescriptor* descriptor, NS::Error** error)
1293
+ {
1294
+ return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(newCounterSampleBufferWithDescriptor_error_), descriptor, error);
1295
+ }
1296
+
1297
+ // method: sampleTimestamps:gpuTimestamp:
1298
+ _MTL_INLINE void MTL::Device::sampleTimestamps(MTL::Timestamp* cpuTimestamp, MTL::Timestamp* gpuTimestamp)
1299
+ {
1300
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(sampleTimestamps_gpuTimestamp_), cpuTimestamp, gpuTimestamp);
1301
+ }
1302
+
1303
+ // method: newArgumentEncoderWithBufferBinding:
1304
+ _MTL_INLINE MTL::ArgumentEncoder* MTL::Device::newArgumentEncoder(const MTL::BufferBinding* bufferBinding)
1305
+ {
1306
+ return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithBufferBinding_), bufferBinding);
1307
+ }
1308
+
1309
+ // method: supportsCounterSampling:
1310
+ _MTL_INLINE bool MTL::Device::supportsCounterSampling(MTL::CounterSamplingPoint samplingPoint)
1311
+ {
1312
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsCounterSampling_), samplingPoint);
1313
+ }
1314
+
1315
+ // method: supportsVertexAmplificationCount:
1316
+ _MTL_INLINE bool MTL::Device::supportsVertexAmplificationCount(NS::UInteger count)
1317
+ {
1318
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsVertexAmplificationCount_), count);
1319
+ }
1320
+
1321
+ // property: supportsDynamicLibraries
1322
+ _MTL_INLINE bool MTL::Device::supportsDynamicLibraries() const
1323
+ {
1324
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsDynamicLibraries));
1325
+ }
1326
+
1327
+ // property: supportsRenderDynamicLibraries
1328
+ _MTL_INLINE bool MTL::Device::supportsRenderDynamicLibraries() const
1329
+ {
1330
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRenderDynamicLibraries));
1331
+ }
1332
+
1333
+ // method: newDynamicLibrary:error:
1334
+ _MTL_INLINE MTL::DynamicLibrary* MTL::Device::newDynamicLibrary(const MTL::Library* library, NS::Error** error)
1335
+ {
1336
+ return Object::sendMessage<MTL::DynamicLibrary*>(this, _MTL_PRIVATE_SEL(newDynamicLibrary_error_), library, error);
1337
+ }
1338
+
1339
+ // method: newDynamicLibraryWithURL:error:
1340
+ _MTL_INLINE MTL::DynamicLibrary* MTL::Device::newDynamicLibrary(const NS::URL* url, NS::Error** error)
1341
+ {
1342
+ return Object::sendMessage<MTL::DynamicLibrary*>(this, _MTL_PRIVATE_SEL(newDynamicLibraryWithURL_error_), url, error);
1343
+ }
1344
+
1345
+ // method: newBinaryArchiveWithDescriptor:error:
1346
+ _MTL_INLINE MTL::BinaryArchive* MTL::Device::newBinaryArchive(const MTL::BinaryArchiveDescriptor* descriptor, NS::Error** error)
1347
+ {
1348
+ return Object::sendMessage<MTL::BinaryArchive*>(this, _MTL_PRIVATE_SEL(newBinaryArchiveWithDescriptor_error_), descriptor, error);
1349
+ }
1350
+
1351
+ // property: supportsRaytracing
1352
+ _MTL_INLINE bool MTL::Device::supportsRaytracing() const
1353
+ {
1354
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRaytracing));
1355
+ }
1356
+
1357
+ // method: accelerationStructureSizesWithDescriptor:
1358
+ _MTL_INLINE MTL::AccelerationStructureSizes MTL::Device::accelerationStructureSizes(const MTL::AccelerationStructureDescriptor* descriptor)
1359
+ {
1360
+ return Object::sendMessage<MTL::AccelerationStructureSizes>(this, _MTL_PRIVATE_SEL(accelerationStructureSizesWithDescriptor_), descriptor);
1361
+ }
1362
+
1363
+ // method: newAccelerationStructureWithSize:
1364
+ _MTL_INLINE MTL::AccelerationStructure* MTL::Device::newAccelerationStructure(NS::UInteger size)
1365
+ {
1366
+ return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_), size);
1367
+ }
1368
+
1369
+ // method: newAccelerationStructureWithDescriptor:
1370
+ _MTL_INLINE MTL::AccelerationStructure* MTL::Device::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor)
1371
+ {
1372
+ return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_), descriptor);
1373
+ }
1374
+
1375
+ // method: heapAccelerationStructureSizeAndAlignWithSize:
1376
+ _MTL_INLINE MTL::SizeAndAlign MTL::Device::heapAccelerationStructureSizeAndAlign(NS::UInteger size)
1377
+ {
1378
+ return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapAccelerationStructureSizeAndAlignWithSize_), size);
1379
+ }
1380
+
1381
+ // method: heapAccelerationStructureSizeAndAlignWithDescriptor:
1382
+ _MTL_INLINE MTL::SizeAndAlign MTL::Device::heapAccelerationStructureSizeAndAlign(const MTL::AccelerationStructureDescriptor* descriptor)
1383
+ {
1384
+ return Object::sendMessage<MTL::SizeAndAlign>(this, _MTL_PRIVATE_SEL(heapAccelerationStructureSizeAndAlignWithDescriptor_), descriptor);
1385
+ }
1386
+
1387
+ // property: supportsFunctionPointers
1388
+ _MTL_INLINE bool MTL::Device::supportsFunctionPointers() const
1389
+ {
1390
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFunctionPointers));
1391
+ }
1392
+
1393
+ // property: supportsFunctionPointersFromRender
1394
+ _MTL_INLINE bool MTL::Device::supportsFunctionPointersFromRender() const
1395
+ {
1396
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsFunctionPointersFromRender));
1397
+ }
1398
+
1399
+ // property: supportsRaytracingFromRender
1400
+ _MTL_INLINE bool MTL::Device::supportsRaytracingFromRender() const
1401
+ {
1402
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsRaytracingFromRender));
1403
+ }
1404
+
1405
+ // property: supportsPrimitiveMotionBlur
1406
+ _MTL_INLINE bool MTL::Device::supportsPrimitiveMotionBlur() const
1407
+ {
1408
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsPrimitiveMotionBlur));
1409
+ }
1410
+
1411
+ // property: shouldMaximizeConcurrentCompilation
1412
+ _MTL_INLINE bool MTL::Device::shouldMaximizeConcurrentCompilation() const
1413
+ {
1414
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(shouldMaximizeConcurrentCompilation));
1415
+ }
1416
+
1417
+ _MTL_INLINE void MTL::Device::setShouldMaximizeConcurrentCompilation(bool shouldMaximizeConcurrentCompilation)
1418
+ {
1419
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShouldMaximizeConcurrentCompilation_), shouldMaximizeConcurrentCompilation);
1420
+ }
1421
+
1422
+ // property: maximumConcurrentCompilationTaskCount
1423
+ _MTL_INLINE NS::UInteger MTL::Device::maximumConcurrentCompilationTaskCount() const
1424
+ {
1425
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maximumConcurrentCompilationTaskCount));
1426
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDrawable.hpp ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLDrawable.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include <CoreFoundation/CoreFoundation.h>
30
+ #include <functional>
31
+
32
+ namespace MTL
33
+ {
34
+ using DrawablePresentedHandler = void (^)(class Drawable*);
35
+
36
+ using DrawablePresentedHandlerFunction = std::function<void(class Drawable*)>;
37
+
38
+ class Drawable : public NS::Referencing<Drawable>
39
+ {
40
+ public:
41
+ void addPresentedHandler(const MTL::DrawablePresentedHandlerFunction& function);
42
+
43
+ void present();
44
+
45
+ void presentAtTime(CFTimeInterval presentationTime);
46
+
47
+ void presentAfterMinimumDuration(CFTimeInterval duration);
48
+
49
+ void addPresentedHandler(const MTL::DrawablePresentedHandler block);
50
+
51
+ CFTimeInterval presentedTime() const;
52
+
53
+ NS::UInteger drawableID() const;
54
+ };
55
+
56
+ }
57
+
58
+ _MTL_INLINE void MTL::Drawable::addPresentedHandler(const MTL::DrawablePresentedHandlerFunction& function)
59
+ {
60
+ __block DrawablePresentedHandlerFunction blockFunction = function;
61
+
62
+ addPresentedHandler(^(Drawable* pDrawable) { blockFunction(pDrawable); });
63
+ }
64
+
65
+ // method: present
66
+ _MTL_INLINE void MTL::Drawable::present()
67
+ {
68
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(present));
69
+ }
70
+
71
+ // method: presentAtTime:
72
+ _MTL_INLINE void MTL::Drawable::presentAtTime(CFTimeInterval presentationTime)
73
+ {
74
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentAtTime_), presentationTime);
75
+ }
76
+
77
+ // method: presentAfterMinimumDuration:
78
+ _MTL_INLINE void MTL::Drawable::presentAfterMinimumDuration(CFTimeInterval duration)
79
+ {
80
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(presentAfterMinimumDuration_), duration);
81
+ }
82
+
83
+ // method: addPresentedHandler:
84
+ _MTL_INLINE void MTL::Drawable::addPresentedHandler(const MTL::DrawablePresentedHandler block)
85
+ {
86
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addPresentedHandler_), block);
87
+ }
88
+
89
+ // property: presentedTime
90
+ _MTL_INLINE CFTimeInterval MTL::Drawable::presentedTime() const
91
+ {
92
+ return Object::sendMessage<CFTimeInterval>(this, _MTL_PRIVATE_SEL(presentedTime));
93
+ }
94
+
95
+ // property: drawableID
96
+ _MTL_INLINE NS::UInteger MTL::Drawable::drawableID() const
97
+ {
98
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(drawableID));
99
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLDynamicLibrary.hpp ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLDynamicLibrary.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+ _MTL_ENUM(NS::UInteger, DynamicLibraryError) {
32
+ DynamicLibraryErrorNone = 0,
33
+ DynamicLibraryErrorInvalidFile = 1,
34
+ DynamicLibraryErrorCompilationFailure = 2,
35
+ DynamicLibraryErrorUnresolvedInstallName = 3,
36
+ DynamicLibraryErrorDependencyLoadFailure = 4,
37
+ DynamicLibraryErrorUnsupported = 5,
38
+ };
39
+
40
+ class DynamicLibrary : public NS::Referencing<DynamicLibrary>
41
+ {
42
+ public:
43
+ NS::String* label() const;
44
+ void setLabel(const NS::String* label);
45
+
46
+ class Device* device() const;
47
+
48
+ NS::String* installName() const;
49
+
50
+ bool serializeToURL(const NS::URL* url, NS::Error** error);
51
+ };
52
+
53
+ }
54
+
55
+ // property: label
56
+ _MTL_INLINE NS::String* MTL::DynamicLibrary::label() const
57
+ {
58
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
59
+ }
60
+
61
+ _MTL_INLINE void MTL::DynamicLibrary::setLabel(const NS::String* label)
62
+ {
63
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
64
+ }
65
+
66
+ // property: device
67
+ _MTL_INLINE MTL::Device* MTL::DynamicLibrary::device() const
68
+ {
69
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
70
+ }
71
+
72
+ // property: installName
73
+ _MTL_INLINE NS::String* MTL::DynamicLibrary::installName() const
74
+ {
75
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(installName));
76
+ }
77
+
78
+ // method: serializeToURL:error:
79
+ _MTL_INLINE bool MTL::DynamicLibrary::serializeToURL(const NS::URL* url, NS::Error** error)
80
+ {
81
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(serializeToURL_error_), url, error);
82
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLEvent.hpp ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLEvent.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLEvent.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ class Event : public NS::Referencing<Event>
34
+ {
35
+ public:
36
+ class Device* device() const;
37
+
38
+ NS::String* label() const;
39
+ void setLabel(const NS::String* label);
40
+ };
41
+
42
+ class SharedEventListener : public NS::Referencing<SharedEventListener>
43
+ {
44
+ public:
45
+ static class SharedEventListener* alloc();
46
+
47
+ MTL::SharedEventListener* init();
48
+
49
+ MTL::SharedEventListener* init(const dispatch_queue_t dispatchQueue);
50
+
51
+ dispatch_queue_t dispatchQueue() const;
52
+ };
53
+
54
+ using SharedEventNotificationBlock = void (^)(SharedEvent* pEvent, std::uint64_t value);
55
+
56
+ class SharedEvent : public NS::Referencing<SharedEvent, Event>
57
+ {
58
+ public:
59
+ void notifyListener(const class SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block);
60
+
61
+ class SharedEventHandle* newSharedEventHandle();
62
+
63
+ uint64_t signaledValue() const;
64
+ void setSignaledValue(uint64_t signaledValue);
65
+ };
66
+
67
+ class SharedEventHandle : public NS::SecureCoding<SharedEventHandle>
68
+ {
69
+ public:
70
+ static class SharedEventHandle* alloc();
71
+
72
+ class SharedEventHandle* init();
73
+
74
+ NS::String* label() const;
75
+ };
76
+
77
+ }
78
+
79
+ // property: device
80
+ _MTL_INLINE MTL::Device* MTL::Event::device() const
81
+ {
82
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
83
+ }
84
+
85
+ // property: label
86
+ _MTL_INLINE NS::String* MTL::Event::label() const
87
+ {
88
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
89
+ }
90
+
91
+ _MTL_INLINE void MTL::Event::setLabel(const NS::String* label)
92
+ {
93
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
94
+ }
95
+
96
+ // static method: alloc
97
+ _MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::alloc()
98
+ {
99
+ return NS::Object::alloc<MTL::SharedEventListener>(_MTL_PRIVATE_CLS(MTLSharedEventListener));
100
+ }
101
+
102
+ // method: init
103
+ _MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init()
104
+ {
105
+ return NS::Object::init<MTL::SharedEventListener>();
106
+ }
107
+
108
+ // method: initWithDispatchQueue:
109
+ _MTL_INLINE MTL::SharedEventListener* MTL::SharedEventListener::init(const dispatch_queue_t dispatchQueue)
110
+ {
111
+ return Object::sendMessage<MTL::SharedEventListener*>(this, _MTL_PRIVATE_SEL(initWithDispatchQueue_), dispatchQueue);
112
+ }
113
+
114
+ // property: dispatchQueue
115
+ _MTL_INLINE dispatch_queue_t MTL::SharedEventListener::dispatchQueue() const
116
+ {
117
+ return Object::sendMessage<dispatch_queue_t>(this, _MTL_PRIVATE_SEL(dispatchQueue));
118
+ }
119
+
120
+ // method: notifyListener:atValue:block:
121
+ _MTL_INLINE void MTL::SharedEvent::notifyListener(const MTL::SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block)
122
+ {
123
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(notifyListener_atValue_block_), listener, value, block);
124
+ }
125
+
126
+ // method: newSharedEventHandle
127
+ _MTL_INLINE MTL::SharedEventHandle* MTL::SharedEvent::newSharedEventHandle()
128
+ {
129
+ return Object::sendMessage<MTL::SharedEventHandle*>(this, _MTL_PRIVATE_SEL(newSharedEventHandle));
130
+ }
131
+
132
+ // property: signaledValue
133
+ _MTL_INLINE uint64_t MTL::SharedEvent::signaledValue() const
134
+ {
135
+ return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(signaledValue));
136
+ }
137
+
138
+ _MTL_INLINE void MTL::SharedEvent::setSignaledValue(uint64_t signaledValue)
139
+ {
140
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSignaledValue_), signaledValue);
141
+ }
142
+
143
+ // static method: alloc
144
+ _MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::alloc()
145
+ {
146
+ return NS::Object::alloc<MTL::SharedEventHandle>(_MTL_PRIVATE_CLS(MTLSharedEventHandle));
147
+ }
148
+
149
+ // method: init
150
+ _MTL_INLINE MTL::SharedEventHandle* MTL::SharedEventHandle::init()
151
+ {
152
+ return NS::Object::init<MTL::SharedEventHandle>();
153
+ }
154
+
155
+ // property: label
156
+ _MTL_INLINE NS::String* MTL::SharedEventHandle::label() const
157
+ {
158
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
159
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFence.hpp ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLFence.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+ class Fence : public NS::Referencing<Fence>
32
+ {
33
+ public:
34
+ class Device* device() const;
35
+
36
+ NS::String* label() const;
37
+ void setLabel(const NS::String* label);
38
+ };
39
+
40
+ }
41
+
42
+ // property: device
43
+ _MTL_INLINE MTL::Device* MTL::Fence::device() const
44
+ {
45
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
46
+ }
47
+
48
+ // property: label
49
+ _MTL_INLINE NS::String* MTL::Fence::label() const
50
+ {
51
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
52
+ }
53
+
54
+ _MTL_INLINE void MTL::Fence::setLabel(const NS::String* label)
55
+ {
56
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
57
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionConstantValues.hpp ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLFunctionConstantValues.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLArgument.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ class FunctionConstantValues : public NS::Copying<FunctionConstantValues>
34
+ {
35
+ public:
36
+ static class FunctionConstantValues* alloc();
37
+
38
+ class FunctionConstantValues* init();
39
+
40
+ void setConstantValue(const void* value, MTL::DataType type, NS::UInteger index);
41
+
42
+ void setConstantValues(const void* values, MTL::DataType type, NS::Range range);
43
+
44
+ void setConstantValue(const void* value, MTL::DataType type, const NS::String* name);
45
+
46
+ void reset();
47
+ };
48
+
49
+ }
50
+
51
+ // static method: alloc
52
+ _MTL_INLINE MTL::FunctionConstantValues* MTL::FunctionConstantValues::alloc()
53
+ {
54
+ return NS::Object::alloc<MTL::FunctionConstantValues>(_MTL_PRIVATE_CLS(MTLFunctionConstantValues));
55
+ }
56
+
57
+ // method: init
58
+ _MTL_INLINE MTL::FunctionConstantValues* MTL::FunctionConstantValues::init()
59
+ {
60
+ return NS::Object::init<MTL::FunctionConstantValues>();
61
+ }
62
+
63
+ // method: setConstantValue:type:atIndex:
64
+ _MTL_INLINE void MTL::FunctionConstantValues::setConstantValue(const void* value, MTL::DataType type, NS::UInteger index)
65
+ {
66
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValue_type_atIndex_), value, type, index);
67
+ }
68
+
69
+ // method: setConstantValues:type:withRange:
70
+ _MTL_INLINE void MTL::FunctionConstantValues::setConstantValues(const void* values, MTL::DataType type, NS::Range range)
71
+ {
72
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValues_type_withRange_), values, type, range);
73
+ }
74
+
75
+ // method: setConstantValue:type:withName:
76
+ _MTL_INLINE void MTL::FunctionConstantValues::setConstantValue(const void* value, MTL::DataType type, const NS::String* name)
77
+ {
78
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValue_type_withName_), value, type, name);
79
+ }
80
+
81
+ // method: reset
82
+ _MTL_INLINE void MTL::FunctionConstantValues::reset()
83
+ {
84
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
85
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionDescriptor.hpp ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLFunctionDescriptor.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLFunctionDescriptor.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ _MTL_OPTIONS(NS::UInteger, FunctionOptions) {
34
+ FunctionOptionNone = 0,
35
+ FunctionOptionCompileToBinary = 1,
36
+ FunctionOptionStoreFunctionInMetalScript = 2,
37
+ };
38
+
39
+ class FunctionDescriptor : public NS::Copying<FunctionDescriptor>
40
+ {
41
+ public:
42
+ static class FunctionDescriptor* alloc();
43
+
44
+ class FunctionDescriptor* init();
45
+
46
+ static class FunctionDescriptor* functionDescriptor();
47
+
48
+ NS::String* name() const;
49
+ void setName(const NS::String* name);
50
+
51
+ NS::String* specializedName() const;
52
+ void setSpecializedName(const NS::String* specializedName);
53
+
54
+ class FunctionConstantValues* constantValues() const;
55
+ void setConstantValues(const class FunctionConstantValues* constantValues);
56
+
57
+ MTL::FunctionOptions options() const;
58
+ void setOptions(MTL::FunctionOptions options);
59
+
60
+ NS::Array* binaryArchives() const;
61
+ void setBinaryArchives(const NS::Array* binaryArchives);
62
+ };
63
+
64
+ class IntersectionFunctionDescriptor : public NS::Copying<IntersectionFunctionDescriptor, MTL::FunctionDescriptor>
65
+ {
66
+ public:
67
+ static class IntersectionFunctionDescriptor* alloc();
68
+
69
+ class IntersectionFunctionDescriptor* init();
70
+ };
71
+
72
+ }
73
+
74
+ // static method: alloc
75
+ _MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::alloc()
76
+ {
77
+ return NS::Object::alloc<MTL::FunctionDescriptor>(_MTL_PRIVATE_CLS(MTLFunctionDescriptor));
78
+ }
79
+
80
+ // method: init
81
+ _MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::init()
82
+ {
83
+ return NS::Object::init<MTL::FunctionDescriptor>();
84
+ }
85
+
86
+ // static method: functionDescriptor
87
+ _MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::functionDescriptor()
88
+ {
89
+ return Object::sendMessage<MTL::FunctionDescriptor*>(_MTL_PRIVATE_CLS(MTLFunctionDescriptor), _MTL_PRIVATE_SEL(functionDescriptor));
90
+ }
91
+
92
+ // property: name
93
+ _MTL_INLINE NS::String* MTL::FunctionDescriptor::name() const
94
+ {
95
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
96
+ }
97
+
98
+ _MTL_INLINE void MTL::FunctionDescriptor::setName(const NS::String* name)
99
+ {
100
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
101
+ }
102
+
103
+ // property: specializedName
104
+ _MTL_INLINE NS::String* MTL::FunctionDescriptor::specializedName() const
105
+ {
106
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(specializedName));
107
+ }
108
+
109
+ _MTL_INLINE void MTL::FunctionDescriptor::setSpecializedName(const NS::String* specializedName)
110
+ {
111
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSpecializedName_), specializedName);
112
+ }
113
+
114
+ // property: constantValues
115
+ _MTL_INLINE MTL::FunctionConstantValues* MTL::FunctionDescriptor::constantValues() const
116
+ {
117
+ return Object::sendMessage<MTL::FunctionConstantValues*>(this, _MTL_PRIVATE_SEL(constantValues));
118
+ }
119
+
120
+ _MTL_INLINE void MTL::FunctionDescriptor::setConstantValues(const MTL::FunctionConstantValues* constantValues)
121
+ {
122
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValues_), constantValues);
123
+ }
124
+
125
+ // property: options
126
+ _MTL_INLINE MTL::FunctionOptions MTL::FunctionDescriptor::options() const
127
+ {
128
+ return Object::sendMessage<MTL::FunctionOptions>(this, _MTL_PRIVATE_SEL(options));
129
+ }
130
+
131
+ _MTL_INLINE void MTL::FunctionDescriptor::setOptions(MTL::FunctionOptions options)
132
+ {
133
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);
134
+ }
135
+
136
+ // property: binaryArchives
137
+ _MTL_INLINE NS::Array* MTL::FunctionDescriptor::binaryArchives() const
138
+ {
139
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives));
140
+ }
141
+
142
+ _MTL_INLINE void MTL::FunctionDescriptor::setBinaryArchives(const NS::Array* binaryArchives)
143
+ {
144
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives);
145
+ }
146
+
147
+ // static method: alloc
148
+ _MTL_INLINE MTL::IntersectionFunctionDescriptor* MTL::IntersectionFunctionDescriptor::alloc()
149
+ {
150
+ return NS::Object::alloc<MTL::IntersectionFunctionDescriptor>(_MTL_PRIVATE_CLS(MTLIntersectionFunctionDescriptor));
151
+ }
152
+
153
+ // method: init
154
+ _MTL_INLINE MTL::IntersectionFunctionDescriptor* MTL::IntersectionFunctionDescriptor::init()
155
+ {
156
+ return NS::Object::init<MTL::IntersectionFunctionDescriptor>();
157
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionHandle.hpp ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLFunctionHandle.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLLibrary.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ class FunctionHandle : public NS::Referencing<FunctionHandle>
34
+ {
35
+ public:
36
+ MTL::FunctionType functionType() const;
37
+
38
+ NS::String* name() const;
39
+
40
+ class Device* device() const;
41
+ };
42
+
43
+ }
44
+
45
+ // property: functionType
46
+ _MTL_INLINE MTL::FunctionType MTL::FunctionHandle::functionType() const
47
+ {
48
+ return Object::sendMessage<MTL::FunctionType>(this, _MTL_PRIVATE_SEL(functionType));
49
+ }
50
+
51
+ // property: name
52
+ _MTL_INLINE NS::String* MTL::FunctionHandle::name() const
53
+ {
54
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
55
+ }
56
+
57
+ // property: device
58
+ _MTL_INLINE MTL::Device* MTL::FunctionHandle::device() const
59
+ {
60
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
61
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionLog.hpp ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLFunctionLog.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLFunctionLog.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ _MTL_ENUM(NS::UInteger, FunctionLogType) {
34
+ FunctionLogTypeValidation = 0,
35
+ };
36
+
37
+ class LogContainer : public NS::Referencing<LogContainer, NS::FastEnumeration>
38
+ {
39
+ public:
40
+ };
41
+
42
+ class FunctionLogDebugLocation : public NS::Referencing<FunctionLogDebugLocation>
43
+ {
44
+ public:
45
+ NS::String* functionName() const;
46
+
47
+ NS::URL* URL() const;
48
+
49
+ NS::UInteger line() const;
50
+
51
+ NS::UInteger column() const;
52
+ };
53
+
54
+ class FunctionLog : public NS::Referencing<FunctionLog>
55
+ {
56
+ public:
57
+ MTL::FunctionLogType type() const;
58
+
59
+ NS::String* encoderLabel() const;
60
+
61
+ class Function* function() const;
62
+
63
+ class FunctionLogDebugLocation* debugLocation() const;
64
+ };
65
+
66
+ }
67
+
68
+ // property: functionName
69
+ _MTL_INLINE NS::String* MTL::FunctionLogDebugLocation::functionName() const
70
+ {
71
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(functionName));
72
+ }
73
+
74
+ // property: URL
75
+ _MTL_INLINE NS::URL* MTL::FunctionLogDebugLocation::URL() const
76
+ {
77
+ return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(URL));
78
+ }
79
+
80
+ // property: line
81
+ _MTL_INLINE NS::UInteger MTL::FunctionLogDebugLocation::line() const
82
+ {
83
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(line));
84
+ }
85
+
86
+ // property: column
87
+ _MTL_INLINE NS::UInteger MTL::FunctionLogDebugLocation::column() const
88
+ {
89
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(column));
90
+ }
91
+
92
+ // property: type
93
+ _MTL_INLINE MTL::FunctionLogType MTL::FunctionLog::type() const
94
+ {
95
+ return Object::sendMessage<MTL::FunctionLogType>(this, _MTL_PRIVATE_SEL(type));
96
+ }
97
+
98
+ // property: encoderLabel
99
+ _MTL_INLINE NS::String* MTL::FunctionLog::encoderLabel() const
100
+ {
101
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(encoderLabel));
102
+ }
103
+
104
+ // property: function
105
+ _MTL_INLINE MTL::Function* MTL::FunctionLog::function() const
106
+ {
107
+ return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(function));
108
+ }
109
+
110
+ // property: debugLocation
111
+ _MTL_INLINE MTL::FunctionLogDebugLocation* MTL::FunctionLog::debugLocation() const
112
+ {
113
+ return Object::sendMessage<MTL::FunctionLogDebugLocation*>(this, _MTL_PRIVATE_SEL(debugLocation));
114
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLFunctionStitching.hpp ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLFunctionStitching.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLFunctionStitching.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ class FunctionStitchingAttribute : public NS::Referencing<FunctionStitchingAttribute>
34
+ {
35
+ public:
36
+ };
37
+
38
+ class FunctionStitchingAttributeAlwaysInline : public NS::Referencing<FunctionStitchingAttributeAlwaysInline, FunctionStitchingAttribute>
39
+ {
40
+ public:
41
+ static class FunctionStitchingAttributeAlwaysInline* alloc();
42
+
43
+ class FunctionStitchingAttributeAlwaysInline* init();
44
+ };
45
+
46
+ class FunctionStitchingNode : public NS::Copying<FunctionStitchingNode>
47
+ {
48
+ public:
49
+ };
50
+
51
+ class FunctionStitchingInputNode : public NS::Referencing<FunctionStitchingInputNode, FunctionStitchingNode>
52
+ {
53
+ public:
54
+ static class FunctionStitchingInputNode* alloc();
55
+
56
+ class FunctionStitchingInputNode* init();
57
+
58
+ NS::UInteger argumentIndex() const;
59
+ void setArgumentIndex(NS::UInteger argumentIndex);
60
+
61
+ MTL::FunctionStitchingInputNode* init(NS::UInteger argument);
62
+ };
63
+
64
+ class FunctionStitchingFunctionNode : public NS::Referencing<FunctionStitchingFunctionNode, FunctionStitchingNode>
65
+ {
66
+ public:
67
+ static class FunctionStitchingFunctionNode* alloc();
68
+
69
+ class FunctionStitchingFunctionNode* init();
70
+
71
+ NS::String* name() const;
72
+ void setName(const NS::String* name);
73
+
74
+ NS::Array* arguments() const;
75
+ void setArguments(const NS::Array* arguments);
76
+
77
+ NS::Array* controlDependencies() const;
78
+ void setControlDependencies(const NS::Array* controlDependencies);
79
+
80
+ MTL::FunctionStitchingFunctionNode* init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies);
81
+ };
82
+
83
+ class FunctionStitchingGraph : public NS::Copying<FunctionStitchingGraph>
84
+ {
85
+ public:
86
+ static class FunctionStitchingGraph* alloc();
87
+
88
+ class FunctionStitchingGraph* init();
89
+
90
+ NS::String* functionName() const;
91
+ void setFunctionName(const NS::String* functionName);
92
+
93
+ NS::Array* nodes() const;
94
+ void setNodes(const NS::Array* nodes);
95
+
96
+ class FunctionStitchingFunctionNode* outputNode() const;
97
+ void setOutputNode(const class FunctionStitchingFunctionNode* outputNode);
98
+
99
+ NS::Array* attributes() const;
100
+ void setAttributes(const NS::Array* attributes);
101
+
102
+ MTL::FunctionStitchingGraph* init(const NS::String* functionName, const NS::Array* nodes, const class FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes);
103
+ };
104
+
105
+ class StitchedLibraryDescriptor : public NS::Copying<StitchedLibraryDescriptor>
106
+ {
107
+ public:
108
+ static class StitchedLibraryDescriptor* alloc();
109
+
110
+ class StitchedLibraryDescriptor* init();
111
+
112
+ NS::Array* functionGraphs() const;
113
+ void setFunctionGraphs(const NS::Array* functionGraphs);
114
+
115
+ NS::Array* functions() const;
116
+ void setFunctions(const NS::Array* functions);
117
+ };
118
+
119
+ }
120
+
121
+ // static method: alloc
122
+ _MTL_INLINE MTL::FunctionStitchingAttributeAlwaysInline* MTL::FunctionStitchingAttributeAlwaysInline::alloc()
123
+ {
124
+ return NS::Object::alloc<MTL::FunctionStitchingAttributeAlwaysInline>(_MTL_PRIVATE_CLS(MTLFunctionStitchingAttributeAlwaysInline));
125
+ }
126
+
127
+ // method: init
128
+ _MTL_INLINE MTL::FunctionStitchingAttributeAlwaysInline* MTL::FunctionStitchingAttributeAlwaysInline::init()
129
+ {
130
+ return NS::Object::init<MTL::FunctionStitchingAttributeAlwaysInline>();
131
+ }
132
+
133
+ // static method: alloc
134
+ _MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::alloc()
135
+ {
136
+ return NS::Object::alloc<MTL::FunctionStitchingInputNode>(_MTL_PRIVATE_CLS(MTLFunctionStitchingInputNode));
137
+ }
138
+
139
+ // method: init
140
+ _MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::init()
141
+ {
142
+ return NS::Object::init<MTL::FunctionStitchingInputNode>();
143
+ }
144
+
145
+ // property: argumentIndex
146
+ _MTL_INLINE NS::UInteger MTL::FunctionStitchingInputNode::argumentIndex() const
147
+ {
148
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(argumentIndex));
149
+ }
150
+
151
+ _MTL_INLINE void MTL::FunctionStitchingInputNode::setArgumentIndex(NS::UInteger argumentIndex)
152
+ {
153
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArgumentIndex_), argumentIndex);
154
+ }
155
+
156
+ // method: initWithArgumentIndex:
157
+ _MTL_INLINE MTL::FunctionStitchingInputNode* MTL::FunctionStitchingInputNode::init(NS::UInteger argument)
158
+ {
159
+ return Object::sendMessage<MTL::FunctionStitchingInputNode*>(this, _MTL_PRIVATE_SEL(initWithArgumentIndex_), argument);
160
+ }
161
+
162
+ // static method: alloc
163
+ _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::alloc()
164
+ {
165
+ return NS::Object::alloc<MTL::FunctionStitchingFunctionNode>(_MTL_PRIVATE_CLS(MTLFunctionStitchingFunctionNode));
166
+ }
167
+
168
+ // method: init
169
+ _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::init()
170
+ {
171
+ return NS::Object::init<MTL::FunctionStitchingFunctionNode>();
172
+ }
173
+
174
+ // property: name
175
+ _MTL_INLINE NS::String* MTL::FunctionStitchingFunctionNode::name() const
176
+ {
177
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
178
+ }
179
+
180
+ _MTL_INLINE void MTL::FunctionStitchingFunctionNode::setName(const NS::String* name)
181
+ {
182
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name);
183
+ }
184
+
185
+ // property: arguments
186
+ _MTL_INLINE NS::Array* MTL::FunctionStitchingFunctionNode::arguments() const
187
+ {
188
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(arguments));
189
+ }
190
+
191
+ _MTL_INLINE void MTL::FunctionStitchingFunctionNode::setArguments(const NS::Array* arguments)
192
+ {
193
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setArguments_), arguments);
194
+ }
195
+
196
+ // property: controlDependencies
197
+ _MTL_INLINE NS::Array* MTL::FunctionStitchingFunctionNode::controlDependencies() const
198
+ {
199
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(controlDependencies));
200
+ }
201
+
202
+ _MTL_INLINE void MTL::FunctionStitchingFunctionNode::setControlDependencies(const NS::Array* controlDependencies)
203
+ {
204
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setControlDependencies_), controlDependencies);
205
+ }
206
+
207
+ // method: initWithName:arguments:controlDependencies:
208
+ _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingFunctionNode::init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies)
209
+ {
210
+ return Object::sendMessage<MTL::FunctionStitchingFunctionNode*>(this, _MTL_PRIVATE_SEL(initWithName_arguments_controlDependencies_), name, arguments, controlDependencies);
211
+ }
212
+
213
+ // static method: alloc
214
+ _MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::alloc()
215
+ {
216
+ return NS::Object::alloc<MTL::FunctionStitchingGraph>(_MTL_PRIVATE_CLS(MTLFunctionStitchingGraph));
217
+ }
218
+
219
+ // method: init
220
+ _MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::init()
221
+ {
222
+ return NS::Object::init<MTL::FunctionStitchingGraph>();
223
+ }
224
+
225
+ // property: functionName
226
+ _MTL_INLINE NS::String* MTL::FunctionStitchingGraph::functionName() const
227
+ {
228
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(functionName));
229
+ }
230
+
231
+ _MTL_INLINE void MTL::FunctionStitchingGraph::setFunctionName(const NS::String* functionName)
232
+ {
233
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionName_), functionName);
234
+ }
235
+
236
+ // property: nodes
237
+ _MTL_INLINE NS::Array* MTL::FunctionStitchingGraph::nodes() const
238
+ {
239
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(nodes));
240
+ }
241
+
242
+ _MTL_INLINE void MTL::FunctionStitchingGraph::setNodes(const NS::Array* nodes)
243
+ {
244
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setNodes_), nodes);
245
+ }
246
+
247
+ // property: outputNode
248
+ _MTL_INLINE MTL::FunctionStitchingFunctionNode* MTL::FunctionStitchingGraph::outputNode() const
249
+ {
250
+ return Object::sendMessage<MTL::FunctionStitchingFunctionNode*>(this, _MTL_PRIVATE_SEL(outputNode));
251
+ }
252
+
253
+ _MTL_INLINE void MTL::FunctionStitchingGraph::setOutputNode(const MTL::FunctionStitchingFunctionNode* outputNode)
254
+ {
255
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOutputNode_), outputNode);
256
+ }
257
+
258
+ // property: attributes
259
+ _MTL_INLINE NS::Array* MTL::FunctionStitchingGraph::attributes() const
260
+ {
261
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(attributes));
262
+ }
263
+
264
+ _MTL_INLINE void MTL::FunctionStitchingGraph::setAttributes(const NS::Array* attributes)
265
+ {
266
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAttributes_), attributes);
267
+ }
268
+
269
+ // method: initWithFunctionName:nodes:outputNode:attributes:
270
+ _MTL_INLINE MTL::FunctionStitchingGraph* MTL::FunctionStitchingGraph::init(const NS::String* functionName, const NS::Array* nodes, const MTL::FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes)
271
+ {
272
+ return Object::sendMessage<MTL::FunctionStitchingGraph*>(this, _MTL_PRIVATE_SEL(initWithFunctionName_nodes_outputNode_attributes_), functionName, nodes, outputNode, attributes);
273
+ }
274
+
275
+ // static method: alloc
276
+ _MTL_INLINE MTL::StitchedLibraryDescriptor* MTL::StitchedLibraryDescriptor::alloc()
277
+ {
278
+ return NS::Object::alloc<MTL::StitchedLibraryDescriptor>(_MTL_PRIVATE_CLS(MTLStitchedLibraryDescriptor));
279
+ }
280
+
281
+ // method: init
282
+ _MTL_INLINE MTL::StitchedLibraryDescriptor* MTL::StitchedLibraryDescriptor::init()
283
+ {
284
+ return NS::Object::init<MTL::StitchedLibraryDescriptor>();
285
+ }
286
+
287
+ // property: functionGraphs
288
+ _MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::functionGraphs() const
289
+ {
290
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functionGraphs));
291
+ }
292
+
293
+ _MTL_INLINE void MTL::StitchedLibraryDescriptor::setFunctionGraphs(const NS::Array* functionGraphs)
294
+ {
295
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionGraphs_), functionGraphs);
296
+ }
297
+
298
+ // property: functions
299
+ _MTL_INLINE NS::Array* MTL::StitchedLibraryDescriptor::functions() const
300
+ {
301
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functions));
302
+ }
303
+
304
+ _MTL_INLINE void MTL::StitchedLibraryDescriptor::setFunctions(const NS::Array* functions)
305
+ {
306
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_), functions);
307
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLHeaderBridge.hpp ADDED
The diff for this file is too large to render. See raw diff
 
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLHeap.hpp ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLHeap.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLDevice.hpp"
30
+ #include "MTLHeap.hpp"
31
+ #include "MTLResource.hpp"
32
+
33
+ namespace MTL
34
+ {
35
+ _MTL_ENUM(NS::Integer, HeapType) {
36
+ HeapTypeAutomatic = 0,
37
+ HeapTypePlacement = 1,
38
+ HeapTypeSparse = 2,
39
+ };
40
+
41
+ class HeapDescriptor : public NS::Copying<HeapDescriptor>
42
+ {
43
+ public:
44
+ static class HeapDescriptor* alloc();
45
+
46
+ class HeapDescriptor* init();
47
+
48
+ NS::UInteger size() const;
49
+ void setSize(NS::UInteger size);
50
+
51
+ MTL::StorageMode storageMode() const;
52
+ void setStorageMode(MTL::StorageMode storageMode);
53
+
54
+ MTL::CPUCacheMode cpuCacheMode() const;
55
+ void setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode);
56
+
57
+ MTL::SparsePageSize sparsePageSize() const;
58
+ void setSparsePageSize(MTL::SparsePageSize sparsePageSize);
59
+
60
+ MTL::HazardTrackingMode hazardTrackingMode() const;
61
+ void setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode);
62
+
63
+ MTL::ResourceOptions resourceOptions() const;
64
+ void setResourceOptions(MTL::ResourceOptions resourceOptions);
65
+
66
+ MTL::HeapType type() const;
67
+ void setType(MTL::HeapType type);
68
+ };
69
+
70
+ class Heap : public NS::Referencing<Heap>
71
+ {
72
+ public:
73
+ NS::String* label() const;
74
+ void setLabel(const NS::String* label);
75
+
76
+ class Device* device() const;
77
+
78
+ MTL::StorageMode storageMode() const;
79
+
80
+ MTL::CPUCacheMode cpuCacheMode() const;
81
+
82
+ MTL::HazardTrackingMode hazardTrackingMode() const;
83
+
84
+ MTL::ResourceOptions resourceOptions() const;
85
+
86
+ NS::UInteger size() const;
87
+
88
+ NS::UInteger usedSize() const;
89
+
90
+ NS::UInteger currentAllocatedSize() const;
91
+
92
+ NS::UInteger maxAvailableSize(NS::UInteger alignment);
93
+
94
+ class Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options);
95
+
96
+ class Texture* newTexture(const class TextureDescriptor* descriptor);
97
+
98
+ MTL::PurgeableState setPurgeableState(MTL::PurgeableState state);
99
+
100
+ MTL::HeapType type() const;
101
+
102
+ class Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset);
103
+
104
+ class Texture* newTexture(const class TextureDescriptor* descriptor, NS::UInteger offset);
105
+
106
+ class AccelerationStructure* newAccelerationStructure(NS::UInteger size);
107
+
108
+ class AccelerationStructure* newAccelerationStructure(const class AccelerationStructureDescriptor* descriptor);
109
+
110
+ class AccelerationStructure* newAccelerationStructure(NS::UInteger size, NS::UInteger offset);
111
+
112
+ class AccelerationStructure* newAccelerationStructure(const class AccelerationStructureDescriptor* descriptor, NS::UInteger offset);
113
+ };
114
+
115
+ }
116
+
117
+ // static method: alloc
118
+ _MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::alloc()
119
+ {
120
+ return NS::Object::alloc<MTL::HeapDescriptor>(_MTL_PRIVATE_CLS(MTLHeapDescriptor));
121
+ }
122
+
123
+ // method: init
124
+ _MTL_INLINE MTL::HeapDescriptor* MTL::HeapDescriptor::init()
125
+ {
126
+ return NS::Object::init<MTL::HeapDescriptor>();
127
+ }
128
+
129
+ // property: size
130
+ _MTL_INLINE NS::UInteger MTL::HeapDescriptor::size() const
131
+ {
132
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
133
+ }
134
+
135
+ _MTL_INLINE void MTL::HeapDescriptor::setSize(NS::UInteger size)
136
+ {
137
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSize_), size);
138
+ }
139
+
140
+ // property: storageMode
141
+ _MTL_INLINE MTL::StorageMode MTL::HeapDescriptor::storageMode() const
142
+ {
143
+ return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
144
+ }
145
+
146
+ _MTL_INLINE void MTL::HeapDescriptor::setStorageMode(MTL::StorageMode storageMode)
147
+ {
148
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStorageMode_), storageMode);
149
+ }
150
+
151
+ // property: cpuCacheMode
152
+ _MTL_INLINE MTL::CPUCacheMode MTL::HeapDescriptor::cpuCacheMode() const
153
+ {
154
+ return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
155
+ }
156
+
157
+ _MTL_INLINE void MTL::HeapDescriptor::setCpuCacheMode(MTL::CPUCacheMode cpuCacheMode)
158
+ {
159
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCpuCacheMode_), cpuCacheMode);
160
+ }
161
+
162
+ // property: sparsePageSize
163
+ _MTL_INLINE MTL::SparsePageSize MTL::HeapDescriptor::sparsePageSize() const
164
+ {
165
+ return Object::sendMessage<MTL::SparsePageSize>(this, _MTL_PRIVATE_SEL(sparsePageSize));
166
+ }
167
+
168
+ _MTL_INLINE void MTL::HeapDescriptor::setSparsePageSize(MTL::SparsePageSize sparsePageSize)
169
+ {
170
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSparsePageSize_), sparsePageSize);
171
+ }
172
+
173
+ // property: hazardTrackingMode
174
+ _MTL_INLINE MTL::HazardTrackingMode MTL::HeapDescriptor::hazardTrackingMode() const
175
+ {
176
+ return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
177
+ }
178
+
179
+ _MTL_INLINE void MTL::HeapDescriptor::setHazardTrackingMode(MTL::HazardTrackingMode hazardTrackingMode)
180
+ {
181
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setHazardTrackingMode_), hazardTrackingMode);
182
+ }
183
+
184
+ // property: resourceOptions
185
+ _MTL_INLINE MTL::ResourceOptions MTL::HeapDescriptor::resourceOptions() const
186
+ {
187
+ return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
188
+ }
189
+
190
+ _MTL_INLINE void MTL::HeapDescriptor::setResourceOptions(MTL::ResourceOptions resourceOptions)
191
+ {
192
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResourceOptions_), resourceOptions);
193
+ }
194
+
195
+ // property: type
196
+ _MTL_INLINE MTL::HeapType MTL::HeapDescriptor::type() const
197
+ {
198
+ return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
199
+ }
200
+
201
+ _MTL_INLINE void MTL::HeapDescriptor::setType(MTL::HeapType type)
202
+ {
203
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
204
+ }
205
+
206
+ // property: label
207
+ _MTL_INLINE NS::String* MTL::Heap::label() const
208
+ {
209
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
210
+ }
211
+
212
+ _MTL_INLINE void MTL::Heap::setLabel(const NS::String* label)
213
+ {
214
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
215
+ }
216
+
217
+ // property: device
218
+ _MTL_INLINE MTL::Device* MTL::Heap::device() const
219
+ {
220
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
221
+ }
222
+
223
+ // property: storageMode
224
+ _MTL_INLINE MTL::StorageMode MTL::Heap::storageMode() const
225
+ {
226
+ return Object::sendMessage<MTL::StorageMode>(this, _MTL_PRIVATE_SEL(storageMode));
227
+ }
228
+
229
+ // property: cpuCacheMode
230
+ _MTL_INLINE MTL::CPUCacheMode MTL::Heap::cpuCacheMode() const
231
+ {
232
+ return Object::sendMessage<MTL::CPUCacheMode>(this, _MTL_PRIVATE_SEL(cpuCacheMode));
233
+ }
234
+
235
+ // property: hazardTrackingMode
236
+ _MTL_INLINE MTL::HazardTrackingMode MTL::Heap::hazardTrackingMode() const
237
+ {
238
+ return Object::sendMessage<MTL::HazardTrackingMode>(this, _MTL_PRIVATE_SEL(hazardTrackingMode));
239
+ }
240
+
241
+ // property: resourceOptions
242
+ _MTL_INLINE MTL::ResourceOptions MTL::Heap::resourceOptions() const
243
+ {
244
+ return Object::sendMessage<MTL::ResourceOptions>(this, _MTL_PRIVATE_SEL(resourceOptions));
245
+ }
246
+
247
+ // property: size
248
+ _MTL_INLINE NS::UInteger MTL::Heap::size() const
249
+ {
250
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
251
+ }
252
+
253
+ // property: usedSize
254
+ _MTL_INLINE NS::UInteger MTL::Heap::usedSize() const
255
+ {
256
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(usedSize));
257
+ }
258
+
259
+ // property: currentAllocatedSize
260
+ _MTL_INLINE NS::UInteger MTL::Heap::currentAllocatedSize() const
261
+ {
262
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(currentAllocatedSize));
263
+ }
264
+
265
+ // method: maxAvailableSizeWithAlignment:
266
+ _MTL_INLINE NS::UInteger MTL::Heap::maxAvailableSize(NS::UInteger alignment)
267
+ {
268
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxAvailableSizeWithAlignment_), alignment);
269
+ }
270
+
271
+ // method: newBufferWithLength:options:
272
+ _MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options)
273
+ {
274
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_), length, options);
275
+ }
276
+
277
+ // method: newTextureWithDescriptor:
278
+ _MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* descriptor)
279
+ {
280
+ return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_), descriptor);
281
+ }
282
+
283
+ // method: setPurgeableState:
284
+ _MTL_INLINE MTL::PurgeableState MTL::Heap::setPurgeableState(MTL::PurgeableState state)
285
+ {
286
+ return Object::sendMessage<MTL::PurgeableState>(this, _MTL_PRIVATE_SEL(setPurgeableState_), state);
287
+ }
288
+
289
+ // property: type
290
+ _MTL_INLINE MTL::HeapType MTL::Heap::type() const
291
+ {
292
+ return Object::sendMessage<MTL::HeapType>(this, _MTL_PRIVATE_SEL(type));
293
+ }
294
+
295
+ // method: newBufferWithLength:options:offset:
296
+ _MTL_INLINE MTL::Buffer* MTL::Heap::newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset)
297
+ {
298
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(newBufferWithLength_options_offset_), length, options, offset);
299
+ }
300
+
301
+ // method: newTextureWithDescriptor:offset:
302
+ _MTL_INLINE MTL::Texture* MTL::Heap::newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset)
303
+ {
304
+ return Object::sendMessage<MTL::Texture*>(this, _MTL_PRIVATE_SEL(newTextureWithDescriptor_offset_), descriptor, offset);
305
+ }
306
+
307
+ // method: newAccelerationStructureWithSize:
308
+ _MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(NS::UInteger size)
309
+ {
310
+ return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_), size);
311
+ }
312
+
313
+ // method: newAccelerationStructureWithDescriptor:
314
+ _MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor)
315
+ {
316
+ return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_), descriptor);
317
+ }
318
+
319
+ // method: newAccelerationStructureWithSize:offset:
320
+ _MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(NS::UInteger size, NS::UInteger offset)
321
+ {
322
+ return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithSize_offset_), size, offset);
323
+ }
324
+
325
+ // method: newAccelerationStructureWithDescriptor:offset:
326
+ _MTL_INLINE MTL::AccelerationStructure* MTL::Heap::newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor, NS::UInteger offset)
327
+ {
328
+ return Object::sendMessage<MTL::AccelerationStructure*>(this, _MTL_PRIVATE_SEL(newAccelerationStructureWithDescriptor_offset_), descriptor, offset);
329
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIOCommandBuffer.hpp ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLIOCommandBuffer.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLIOCommandBuffer.hpp"
30
+ #include "MTLTypes.hpp"
31
+
32
+ namespace MTL
33
+ {
34
+ _MTL_ENUM(NS::Integer, IOStatus) {
35
+ IOStatusPending = 0,
36
+ IOStatusCancelled = 1,
37
+ IOStatusError = 2,
38
+ IOStatusComplete = 3,
39
+ };
40
+
41
+ using IOCommandBufferHandler = void (^)(class IOCommandBuffer*);
42
+
43
+ using IOCommandBufferHandlerFunction = std::function<void(class IOCommandBuffer*)>;
44
+
45
+ class IOCommandBuffer : public NS::Referencing<IOCommandBuffer>
46
+ {
47
+ public:
48
+ void addCompletedHandler(const MTL::IOCommandBufferHandlerFunction& function);
49
+
50
+ void addCompletedHandler(const MTL::IOCommandBufferHandler block);
51
+
52
+ void loadBytes(const void* pointer, NS::UInteger size, const class IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset);
53
+
54
+ void loadBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger size, const class IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset);
55
+
56
+ void loadTexture(const class Texture* texture, NS::UInteger slice, NS::UInteger level, MTL::Size size, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Origin destinationOrigin, const class IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset);
57
+
58
+ void copyStatusToBuffer(const class Buffer* buffer, NS::UInteger offset);
59
+
60
+ void commit();
61
+
62
+ void waitUntilCompleted();
63
+
64
+ void tryCancel();
65
+
66
+ void addBarrier();
67
+
68
+ void pushDebugGroup(const NS::String* string);
69
+
70
+ void popDebugGroup();
71
+
72
+ void enqueue();
73
+
74
+ void wait(const class SharedEvent* event, uint64_t value);
75
+
76
+ void signalEvent(const class SharedEvent* event, uint64_t value);
77
+
78
+ NS::String* label() const;
79
+ void setLabel(const NS::String* label);
80
+
81
+ MTL::IOStatus status() const;
82
+
83
+ NS::Error* error() const;
84
+ };
85
+
86
+ }
87
+
88
+ _MTL_INLINE void MTL::IOCommandBuffer::addCompletedHandler(const MTL::IOCommandBufferHandlerFunction& function)
89
+ {
90
+ __block IOCommandBufferHandlerFunction blockFunction = function;
91
+
92
+ addCompletedHandler(^(IOCommandBuffer* pCommandBuffer) { blockFunction(pCommandBuffer); });
93
+ }
94
+
95
+ // method: addCompletedHandler:
96
+ _MTL_INLINE void MTL::IOCommandBuffer::addCompletedHandler(const MTL::IOCommandBufferHandler block)
97
+ {
98
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addCompletedHandler_), block);
99
+ }
100
+
101
+ // method: loadBytes:size:sourceHandle:sourceHandleOffset:
102
+ _MTL_INLINE void MTL::IOCommandBuffer::loadBytes(const void* pointer, NS::UInteger size, const MTL::IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset)
103
+ {
104
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(loadBytes_size_sourceHandle_sourceHandleOffset_), pointer, size, sourceHandle, sourceHandleOffset);
105
+ }
106
+
107
+ // method: loadBuffer:offset:size:sourceHandle:sourceHandleOffset:
108
+ _MTL_INLINE void MTL::IOCommandBuffer::loadBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger size, const MTL::IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset)
109
+ {
110
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(loadBuffer_offset_size_sourceHandle_sourceHandleOffset_), buffer, offset, size, sourceHandle, sourceHandleOffset);
111
+ }
112
+
113
+ // method: loadTexture:slice:level:size:sourceBytesPerRow:sourceBytesPerImage:destinationOrigin:sourceHandle:sourceHandleOffset:
114
+ _MTL_INLINE void MTL::IOCommandBuffer::loadTexture(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level, MTL::Size size, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Origin destinationOrigin, const MTL::IOFileHandle* sourceHandle, NS::UInteger sourceHandleOffset)
115
+ {
116
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(loadTexture_slice_level_size_sourceBytesPerRow_sourceBytesPerImage_destinationOrigin_sourceHandle_sourceHandleOffset_), texture, slice, level, size, sourceBytesPerRow, sourceBytesPerImage, destinationOrigin, sourceHandle, sourceHandleOffset);
117
+ }
118
+
119
+ // method: copyStatusToBuffer:offset:
120
+ _MTL_INLINE void MTL::IOCommandBuffer::copyStatusToBuffer(const MTL::Buffer* buffer, NS::UInteger offset)
121
+ {
122
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(copyStatusToBuffer_offset_), buffer, offset);
123
+ }
124
+
125
+ // method: commit
126
+ _MTL_INLINE void MTL::IOCommandBuffer::commit()
127
+ {
128
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(commit));
129
+ }
130
+
131
+ // method: waitUntilCompleted
132
+ _MTL_INLINE void MTL::IOCommandBuffer::waitUntilCompleted()
133
+ {
134
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitUntilCompleted));
135
+ }
136
+
137
+ // method: tryCancel
138
+ _MTL_INLINE void MTL::IOCommandBuffer::tryCancel()
139
+ {
140
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(tryCancel));
141
+ }
142
+
143
+ // method: addBarrier
144
+ _MTL_INLINE void MTL::IOCommandBuffer::addBarrier()
145
+ {
146
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addBarrier));
147
+ }
148
+
149
+ // method: pushDebugGroup:
150
+ _MTL_INLINE void MTL::IOCommandBuffer::pushDebugGroup(const NS::String* string)
151
+ {
152
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
153
+ }
154
+
155
+ // method: popDebugGroup
156
+ _MTL_INLINE void MTL::IOCommandBuffer::popDebugGroup()
157
+ {
158
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
159
+ }
160
+
161
+ // method: enqueue
162
+ _MTL_INLINE void MTL::IOCommandBuffer::enqueue()
163
+ {
164
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(enqueue));
165
+ }
166
+
167
+ // method: waitForEvent:value:
168
+ _MTL_INLINE void MTL::IOCommandBuffer::wait(const MTL::SharedEvent* event, uint64_t value)
169
+ {
170
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForEvent_value_), event, value);
171
+ }
172
+
173
+ // method: signalEvent:value:
174
+ _MTL_INLINE void MTL::IOCommandBuffer::signalEvent(const MTL::SharedEvent* event, uint64_t value)
175
+ {
176
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(signalEvent_value_), event, value);
177
+ }
178
+
179
+ // property: label
180
+ _MTL_INLINE NS::String* MTL::IOCommandBuffer::label() const
181
+ {
182
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
183
+ }
184
+
185
+ _MTL_INLINE void MTL::IOCommandBuffer::setLabel(const NS::String* label)
186
+ {
187
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
188
+ }
189
+
190
+ // property: status
191
+ _MTL_INLINE MTL::IOStatus MTL::IOCommandBuffer::status() const
192
+ {
193
+ return Object::sendMessage<MTL::IOStatus>(this, _MTL_PRIVATE_SEL(status));
194
+ }
195
+
196
+ // property: error
197
+ _MTL_INLINE NS::Error* MTL::IOCommandBuffer::error() const
198
+ {
199
+ return Object::sendMessage<NS::Error*>(this, _MTL_PRIVATE_SEL(error));
200
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIOCommandQueue.hpp ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLIOCommandQueue.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLIOCommandQueue.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ _MTL_ENUM(NS::Integer, IOPriority) {
34
+ IOPriorityHigh = 0,
35
+ IOPriorityNormal = 1,
36
+ IOPriorityLow = 2,
37
+ };
38
+
39
+ _MTL_ENUM(NS::Integer, IOCommandQueueType) {
40
+ IOCommandQueueTypeConcurrent = 0,
41
+ IOCommandQueueTypeSerial = 1,
42
+ };
43
+
44
+ _MTL_CONST(NS::ErrorDomain, IOErrorDomain);
45
+
46
+ _MTL_ENUM(NS::Integer, IOError) {
47
+ IOErrorURLInvalid = 1,
48
+ IOErrorInternal = 2,
49
+ };
50
+
51
+ class IOCommandQueue : public NS::Referencing<IOCommandQueue>
52
+ {
53
+ public:
54
+ void enqueueBarrier();
55
+
56
+ class IOCommandBuffer* commandBuffer();
57
+
58
+ class IOCommandBuffer* commandBufferWithUnretainedReferences();
59
+
60
+ NS::String* label() const;
61
+ void setLabel(const NS::String* label);
62
+ };
63
+
64
+ class IOScratchBuffer : public NS::Referencing<IOScratchBuffer>
65
+ {
66
+ public:
67
+ class Buffer* buffer() const;
68
+ };
69
+
70
+ class IOScratchBufferAllocator : public NS::Referencing<IOScratchBufferAllocator>
71
+ {
72
+ public:
73
+ class IOScratchBuffer* newScratchBuffer(NS::UInteger minimumSize);
74
+ };
75
+
76
+ class IOCommandQueueDescriptor : public NS::Copying<IOCommandQueueDescriptor>
77
+ {
78
+ public:
79
+ static class IOCommandQueueDescriptor* alloc();
80
+
81
+ class IOCommandQueueDescriptor* init();
82
+
83
+ NS::UInteger maxCommandBufferCount() const;
84
+ void setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount);
85
+
86
+ MTL::IOPriority priority() const;
87
+ void setPriority(MTL::IOPriority priority);
88
+
89
+ MTL::IOCommandQueueType type() const;
90
+ void setType(MTL::IOCommandQueueType type);
91
+
92
+ NS::UInteger maxCommandsInFlight() const;
93
+ void setMaxCommandsInFlight(NS::UInteger maxCommandsInFlight);
94
+
95
+ class IOScratchBufferAllocator* scratchBufferAllocator() const;
96
+ void setScratchBufferAllocator(const class IOScratchBufferAllocator* scratchBufferAllocator);
97
+ };
98
+
99
+ class IOFileHandle : public NS::Referencing<IOFileHandle>
100
+ {
101
+ public:
102
+ NS::String* label() const;
103
+ void setLabel(const NS::String* label);
104
+ };
105
+
106
+ }
107
+
108
+ // method: enqueueBarrier
109
+ _MTL_INLINE void MTL::IOCommandQueue::enqueueBarrier()
110
+ {
111
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(enqueueBarrier));
112
+ }
113
+
114
+ // method: commandBuffer
115
+ _MTL_INLINE MTL::IOCommandBuffer* MTL::IOCommandQueue::commandBuffer()
116
+ {
117
+ return Object::sendMessage<MTL::IOCommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
118
+ }
119
+
120
+ // method: commandBufferWithUnretainedReferences
121
+ _MTL_INLINE MTL::IOCommandBuffer* MTL::IOCommandQueue::commandBufferWithUnretainedReferences()
122
+ {
123
+ return Object::sendMessage<MTL::IOCommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences));
124
+ }
125
+
126
+ // property: label
127
+ _MTL_INLINE NS::String* MTL::IOCommandQueue::label() const
128
+ {
129
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
130
+ }
131
+
132
+ _MTL_INLINE void MTL::IOCommandQueue::setLabel(const NS::String* label)
133
+ {
134
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
135
+ }
136
+
137
+ // property: buffer
138
+ _MTL_INLINE MTL::Buffer* MTL::IOScratchBuffer::buffer() const
139
+ {
140
+ return Object::sendMessage<MTL::Buffer*>(this, _MTL_PRIVATE_SEL(buffer));
141
+ }
142
+
143
+ // method: newScratchBufferWithMinimumSize:
144
+ _MTL_INLINE MTL::IOScratchBuffer* MTL::IOScratchBufferAllocator::newScratchBuffer(NS::UInteger minimumSize)
145
+ {
146
+ return Object::sendMessage<MTL::IOScratchBuffer*>(this, _MTL_PRIVATE_SEL(newScratchBufferWithMinimumSize_), minimumSize);
147
+ }
148
+
149
+ // static method: alloc
150
+ _MTL_INLINE MTL::IOCommandQueueDescriptor* MTL::IOCommandQueueDescriptor::alloc()
151
+ {
152
+ return NS::Object::alloc<MTL::IOCommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTLIOCommandQueueDescriptor));
153
+ }
154
+
155
+ // method: init
156
+ _MTL_INLINE MTL::IOCommandQueueDescriptor* MTL::IOCommandQueueDescriptor::init()
157
+ {
158
+ return NS::Object::init<MTL::IOCommandQueueDescriptor>();
159
+ }
160
+
161
+ // property: maxCommandBufferCount
162
+ _MTL_INLINE NS::UInteger MTL::IOCommandQueueDescriptor::maxCommandBufferCount() const
163
+ {
164
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandBufferCount));
165
+ }
166
+
167
+ _MTL_INLINE void MTL::IOCommandQueueDescriptor::setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount)
168
+ {
169
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandBufferCount_), maxCommandBufferCount);
170
+ }
171
+
172
+ // property: priority
173
+ _MTL_INLINE MTL::IOPriority MTL::IOCommandQueueDescriptor::priority() const
174
+ {
175
+ return Object::sendMessage<MTL::IOPriority>(this, _MTL_PRIVATE_SEL(priority));
176
+ }
177
+
178
+ _MTL_INLINE void MTL::IOCommandQueueDescriptor::setPriority(MTL::IOPriority priority)
179
+ {
180
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPriority_), priority);
181
+ }
182
+
183
+ // property: type
184
+ _MTL_INLINE MTL::IOCommandQueueType MTL::IOCommandQueueDescriptor::type() const
185
+ {
186
+ return Object::sendMessage<MTL::IOCommandQueueType>(this, _MTL_PRIVATE_SEL(type));
187
+ }
188
+
189
+ _MTL_INLINE void MTL::IOCommandQueueDescriptor::setType(MTL::IOCommandQueueType type)
190
+ {
191
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setType_), type);
192
+ }
193
+
194
+ // property: maxCommandsInFlight
195
+ _MTL_INLINE NS::UInteger MTL::IOCommandQueueDescriptor::maxCommandsInFlight() const
196
+ {
197
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandsInFlight));
198
+ }
199
+
200
+ _MTL_INLINE void MTL::IOCommandQueueDescriptor::setMaxCommandsInFlight(NS::UInteger maxCommandsInFlight)
201
+ {
202
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandsInFlight_), maxCommandsInFlight);
203
+ }
204
+
205
+ // property: scratchBufferAllocator
206
+ _MTL_INLINE MTL::IOScratchBufferAllocator* MTL::IOCommandQueueDescriptor::scratchBufferAllocator() const
207
+ {
208
+ return Object::sendMessage<MTL::IOScratchBufferAllocator*>(this, _MTL_PRIVATE_SEL(scratchBufferAllocator));
209
+ }
210
+
211
+ _MTL_INLINE void MTL::IOCommandQueueDescriptor::setScratchBufferAllocator(const MTL::IOScratchBufferAllocator* scratchBufferAllocator)
212
+ {
213
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setScratchBufferAllocator_), scratchBufferAllocator);
214
+ }
215
+
216
+ // property: label
217
+ _MTL_INLINE NS::String* MTL::IOFileHandle::label() const
218
+ {
219
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
220
+ }
221
+
222
+ _MTL_INLINE void MTL::IOFileHandle::setLabel(const NS::String* label)
223
+ {
224
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
225
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIOCompressor.hpp ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLIOCompressor.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+ #include "MTLDevice.hpp"
27
+
28
+ #include <Foundation/Foundation.hpp>
29
+
30
+ namespace MTL
31
+ {
32
+ using IOCompresionContext=void*;
33
+
34
+ _MTL_ENUM(NS::Integer, IOCompressionStatus) {
35
+ IOCompressionStatusComplete = 0,
36
+ IOCompressionStatusError = 1,
37
+ };
38
+
39
+ size_t IOCompressionContextDefaultChunkSize();
40
+
41
+ IOCompresionContext IOCreateCompressionContext(const char* path, IOCompressionMethod type, size_t chunkSize);
42
+
43
+ void IOCompressionContextAppendData(IOCompresionContext context, const void* data, size_t size);
44
+
45
+ IOCompressionStatus IOFlushAndDestroyCompressionContext(IOCompresionContext context);
46
+
47
+ }
48
+
49
+ #if defined(MTL_PRIVATE_IMPLEMENTATION)
50
+
51
+ namespace MTL::Private {
52
+
53
+ MTL_DEF_FUNC(MTLIOCompressionContextDefaultChunkSize, size_t (*)(void));
54
+
55
+ MTL_DEF_FUNC( MTLIOCreateCompressionContext, void* (*)(const char*, MTL::IOCompressionMethod, size_t) );
56
+
57
+ MTL_DEF_FUNC( MTLIOCompressionContextAppendData, void (*)(void*, const void*, size_t) );
58
+
59
+ MTL_DEF_FUNC( MTLIOFlushAndDestroyCompressionContext, MTL::IOCompressionStatus (*)(void*) );
60
+
61
+ }
62
+
63
+ _NS_EXPORT size_t MTL::IOCompressionContextDefaultChunkSize()
64
+ {
65
+ return MTL::Private::MTLIOCompressionContextDefaultChunkSize();
66
+ }
67
+
68
+ _NS_EXPORT void* MTL::IOCreateCompressionContext(const char* path, IOCompressionMethod type, size_t chunkSize)
69
+ {
70
+ if ( MTL::Private::MTLIOCreateCompressionContext )
71
+ {
72
+ return MTL::Private::MTLIOCreateCompressionContext( path, type, chunkSize );
73
+ }
74
+ return nullptr;
75
+ }
76
+
77
+ _NS_EXPORT void MTL::IOCompressionContextAppendData(void* context, const void* data, size_t size)
78
+ {
79
+ if ( MTL::Private::MTLIOCompressionContextAppendData )
80
+ {
81
+ MTL::Private::MTLIOCompressionContextAppendData( context, data, size );
82
+ }
83
+ }
84
+
85
+ _NS_EXPORT MTL::IOCompressionStatus MTL::IOFlushAndDestroyCompressionContext(void* context)
86
+ {
87
+ if ( MTL::Private::MTLIOFlushAndDestroyCompressionContext )
88
+ {
89
+ return MTL::Private::MTLIOFlushAndDestroyCompressionContext( context );
90
+ }
91
+ return MTL::IOCompressionStatusError;
92
+ }
93
+
94
+ #endif
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIndirectCommandBuffer.hpp ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLIndirectCommandBuffer.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLIndirectCommandBuffer.hpp"
30
+ #include "MTLResource.hpp"
31
+ #include "MTLTypes.hpp"
32
+
33
+ namespace MTL
34
+ {
35
+ _MTL_OPTIONS(NS::UInteger, IndirectCommandType) {
36
+ IndirectCommandTypeDraw = 1,
37
+ IndirectCommandTypeDrawIndexed = 2,
38
+ IndirectCommandTypeDrawPatches = 4,
39
+ IndirectCommandTypeDrawIndexedPatches = 8,
40
+ IndirectCommandTypeConcurrentDispatch = 32,
41
+ IndirectCommandTypeConcurrentDispatchThreads = 64,
42
+ };
43
+
44
+ struct IndirectCommandBufferExecutionRange
45
+ {
46
+ uint32_t location;
47
+ uint32_t length;
48
+ } _MTL_PACKED;
49
+
50
+ class IndirectCommandBufferDescriptor : public NS::Copying<IndirectCommandBufferDescriptor>
51
+ {
52
+ public:
53
+ static class IndirectCommandBufferDescriptor* alloc();
54
+
55
+ class IndirectCommandBufferDescriptor* init();
56
+
57
+ MTL::IndirectCommandType commandTypes() const;
58
+ void setCommandTypes(MTL::IndirectCommandType commandTypes);
59
+
60
+ bool inheritPipelineState() const;
61
+ void setInheritPipelineState(bool inheritPipelineState);
62
+
63
+ bool inheritBuffers() const;
64
+ void setInheritBuffers(bool inheritBuffers);
65
+
66
+ NS::UInteger maxVertexBufferBindCount() const;
67
+ void setMaxVertexBufferBindCount(NS::UInteger maxVertexBufferBindCount);
68
+
69
+ NS::UInteger maxFragmentBufferBindCount() const;
70
+ void setMaxFragmentBufferBindCount(NS::UInteger maxFragmentBufferBindCount);
71
+
72
+ NS::UInteger maxKernelBufferBindCount() const;
73
+ void setMaxKernelBufferBindCount(NS::UInteger maxKernelBufferBindCount);
74
+
75
+ NS::UInteger maxKernelThreadgroupMemoryBindCount() const;
76
+ void setMaxKernelThreadgroupMemoryBindCount(NS::UInteger maxKernelThreadgroupMemoryBindCount);
77
+
78
+ bool supportRayTracing() const;
79
+ void setSupportRayTracing(bool supportRayTracing);
80
+
81
+ bool supportDynamicAttributeStride() const;
82
+ void setSupportDynamicAttributeStride(bool supportDynamicAttributeStride);
83
+ };
84
+
85
+ class IndirectCommandBuffer : public NS::Referencing<IndirectCommandBuffer, Resource>
86
+ {
87
+ public:
88
+ NS::UInteger size() const;
89
+
90
+ MTL::ResourceID gpuResourceID() const;
91
+
92
+ void reset(NS::Range range);
93
+
94
+ class IndirectRenderCommand* indirectRenderCommand(NS::UInteger commandIndex);
95
+
96
+ class IndirectComputeCommand* indirectComputeCommand(NS::UInteger commandIndex);
97
+ };
98
+
99
+ }
100
+
101
+ // static method: alloc
102
+ _MTL_INLINE MTL::IndirectCommandBufferDescriptor* MTL::IndirectCommandBufferDescriptor::alloc()
103
+ {
104
+ return NS::Object::alloc<MTL::IndirectCommandBufferDescriptor>(_MTL_PRIVATE_CLS(MTLIndirectCommandBufferDescriptor));
105
+ }
106
+
107
+ // method: init
108
+ _MTL_INLINE MTL::IndirectCommandBufferDescriptor* MTL::IndirectCommandBufferDescriptor::init()
109
+ {
110
+ return NS::Object::init<MTL::IndirectCommandBufferDescriptor>();
111
+ }
112
+
113
+ // property: commandTypes
114
+ _MTL_INLINE MTL::IndirectCommandType MTL::IndirectCommandBufferDescriptor::commandTypes() const
115
+ {
116
+ return Object::sendMessage<MTL::IndirectCommandType>(this, _MTL_PRIVATE_SEL(commandTypes));
117
+ }
118
+
119
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setCommandTypes(MTL::IndirectCommandType commandTypes)
120
+ {
121
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCommandTypes_), commandTypes);
122
+ }
123
+
124
+ // property: inheritPipelineState
125
+ _MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::inheritPipelineState() const
126
+ {
127
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(inheritPipelineState));
128
+ }
129
+
130
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setInheritPipelineState(bool inheritPipelineState)
131
+ {
132
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInheritPipelineState_), inheritPipelineState);
133
+ }
134
+
135
+ // property: inheritBuffers
136
+ _MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::inheritBuffers() const
137
+ {
138
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(inheritBuffers));
139
+ }
140
+
141
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setInheritBuffers(bool inheritBuffers)
142
+ {
143
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInheritBuffers_), inheritBuffers);
144
+ }
145
+
146
+ // property: maxVertexBufferBindCount
147
+ _MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxVertexBufferBindCount() const
148
+ {
149
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxVertexBufferBindCount));
150
+ }
151
+
152
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxVertexBufferBindCount(NS::UInteger maxVertexBufferBindCount)
153
+ {
154
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxVertexBufferBindCount_), maxVertexBufferBindCount);
155
+ }
156
+
157
+ // property: maxFragmentBufferBindCount
158
+ _MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxFragmentBufferBindCount() const
159
+ {
160
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxFragmentBufferBindCount));
161
+ }
162
+
163
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxFragmentBufferBindCount(NS::UInteger maxFragmentBufferBindCount)
164
+ {
165
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxFragmentBufferBindCount_), maxFragmentBufferBindCount);
166
+ }
167
+
168
+ // property: maxKernelBufferBindCount
169
+ _MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxKernelBufferBindCount() const
170
+ {
171
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxKernelBufferBindCount));
172
+ }
173
+
174
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxKernelBufferBindCount(NS::UInteger maxKernelBufferBindCount)
175
+ {
176
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxKernelBufferBindCount_), maxKernelBufferBindCount);
177
+ }
178
+
179
+ // property: maxKernelThreadgroupMemoryBindCount
180
+ _MTL_INLINE NS::UInteger MTL::IndirectCommandBufferDescriptor::maxKernelThreadgroupMemoryBindCount() const
181
+ {
182
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxKernelThreadgroupMemoryBindCount));
183
+ }
184
+
185
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setMaxKernelThreadgroupMemoryBindCount(NS::UInteger maxKernelThreadgroupMemoryBindCount)
186
+ {
187
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxKernelThreadgroupMemoryBindCount_), maxKernelThreadgroupMemoryBindCount);
188
+ }
189
+
190
+ // property: supportRayTracing
191
+ _MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::supportRayTracing() const
192
+ {
193
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportRayTracing));
194
+ }
195
+
196
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setSupportRayTracing(bool supportRayTracing)
197
+ {
198
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportRayTracing_), supportRayTracing);
199
+ }
200
+
201
+ // property: supportDynamicAttributeStride
202
+ _MTL_INLINE bool MTL::IndirectCommandBufferDescriptor::supportDynamicAttributeStride() const
203
+ {
204
+ return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportDynamicAttributeStride));
205
+ }
206
+
207
+ _MTL_INLINE void MTL::IndirectCommandBufferDescriptor::setSupportDynamicAttributeStride(bool supportDynamicAttributeStride)
208
+ {
209
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportDynamicAttributeStride_), supportDynamicAttributeStride);
210
+ }
211
+
212
+ // property: size
213
+ _MTL_INLINE NS::UInteger MTL::IndirectCommandBuffer::size() const
214
+ {
215
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(size));
216
+ }
217
+
218
+ // property: gpuResourceID
219
+ _MTL_INLINE MTL::ResourceID MTL::IndirectCommandBuffer::gpuResourceID() const
220
+ {
221
+ return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
222
+ }
223
+
224
+ // method: resetWithRange:
225
+ _MTL_INLINE void MTL::IndirectCommandBuffer::reset(NS::Range range)
226
+ {
227
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(resetWithRange_), range);
228
+ }
229
+
230
+ // method: indirectRenderCommandAtIndex:
231
+ _MTL_INLINE MTL::IndirectRenderCommand* MTL::IndirectCommandBuffer::indirectRenderCommand(NS::UInteger commandIndex)
232
+ {
233
+ return Object::sendMessage<MTL::IndirectRenderCommand*>(this, _MTL_PRIVATE_SEL(indirectRenderCommandAtIndex_), commandIndex);
234
+ }
235
+
236
+ // method: indirectComputeCommandAtIndex:
237
+ _MTL_INLINE MTL::IndirectComputeCommand* MTL::IndirectCommandBuffer::indirectComputeCommand(NS::UInteger commandIndex)
238
+ {
239
+ return Object::sendMessage<MTL::IndirectComputeCommand*>(this, _MTL_PRIVATE_SEL(indirectComputeCommandAtIndex_), commandIndex);
240
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIndirectCommandEncoder.hpp ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLIndirectCommandEncoder.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLRenderCommandEncoder.hpp"
30
+ #include "MTLStageInputOutputDescriptor.hpp"
31
+ #include "MTLTypes.hpp"
32
+
33
+ namespace MTL
34
+ {
35
+ class IndirectRenderCommand : public NS::Referencing<IndirectRenderCommand>
36
+ {
37
+ public:
38
+ void setRenderPipelineState(const class RenderPipelineState* pipelineState);
39
+
40
+ void setVertexBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
41
+
42
+ void setFragmentBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
43
+
44
+ void setVertexBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
45
+
46
+ void drawPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const class Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const class Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride);
47
+
48
+ void drawIndexedPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const class Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const class Buffer* controlPointIndexBuffer, NS::UInteger controlPointIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const class Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride);
49
+
50
+ void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount, NS::UInteger baseInstance);
51
+
52
+ void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, const class Buffer* indexBuffer, NS::UInteger indexBufferOffset, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance);
53
+
54
+ void reset();
55
+ };
56
+
57
+ class IndirectComputeCommand : public NS::Referencing<IndirectComputeCommand>
58
+ {
59
+ public:
60
+ void setComputePipelineState(const class ComputePipelineState* pipelineState);
61
+
62
+ void setKernelBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
63
+
64
+ void setKernelBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);
65
+
66
+ void concurrentDispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);
67
+
68
+ void concurrentDispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup);
69
+
70
+ void setBarrier();
71
+
72
+ void clearBarrier();
73
+
74
+ void setImageblockWidth(NS::UInteger width, NS::UInteger height);
75
+
76
+ void reset();
77
+
78
+ void setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index);
79
+
80
+ void setStageInRegion(MTL::Region region);
81
+ };
82
+
83
+ }
84
+
85
+ // method: setRenderPipelineState:
86
+ _MTL_INLINE void MTL::IndirectRenderCommand::setRenderPipelineState(const MTL::RenderPipelineState* pipelineState)
87
+ {
88
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setRenderPipelineState_), pipelineState);
89
+ }
90
+
91
+ // method: setVertexBuffer:offset:atIndex:
92
+ _MTL_INLINE void MTL::IndirectRenderCommand::setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
93
+ {
94
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexBuffer_offset_atIndex_), buffer, offset, index);
95
+ }
96
+
97
+ // method: setFragmentBuffer:offset:atIndex:
98
+ _MTL_INLINE void MTL::IndirectRenderCommand::setFragmentBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
99
+ {
100
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFragmentBuffer_offset_atIndex_), buffer, offset, index);
101
+ }
102
+
103
+ // method: setVertexBuffer:offset:attributeStride:atIndex:
104
+ _MTL_INLINE void MTL::IndirectRenderCommand::setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
105
+ {
106
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVertexBuffer_offset_attributeStride_atIndex_), buffer, offset, stride, index);
107
+ }
108
+
109
+ // method: drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:
110
+ _MTL_INLINE void MTL::IndirectRenderCommand::drawPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride)
111
+ {
112
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride_), numberOfPatchControlPoints, patchStart, patchCount, patchIndexBuffer, patchIndexBufferOffset, instanceCount, baseInstance, buffer, offset, instanceStride);
113
+ }
114
+
115
+ // method: drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:
116
+ _MTL_INLINE void MTL::IndirectRenderCommand::drawIndexedPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const MTL::Buffer* controlPointIndexBuffer, NS::UInteger controlPointIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride)
117
+ {
118
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride_), numberOfPatchControlPoints, patchStart, patchCount, patchIndexBuffer, patchIndexBufferOffset, controlPointIndexBuffer, controlPointIndexBufferOffset, instanceCount, baseInstance, buffer, offset, instanceStride);
119
+ }
120
+
121
+ // method: drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:
122
+ _MTL_INLINE void MTL::IndirectRenderCommand::drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount, NS::UInteger baseInstance)
123
+ {
124
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance_), primitiveType, vertexStart, vertexCount, instanceCount, baseInstance);
125
+ }
126
+
127
+ // method: drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:
128
+ _MTL_INLINE void MTL::IndirectRenderCommand::drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, const MTL::Buffer* indexBuffer, NS::UInteger indexBufferOffset, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance)
129
+ {
130
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance_), primitiveType, indexCount, indexType, indexBuffer, indexBufferOffset, instanceCount, baseVertex, baseInstance);
131
+ }
132
+
133
+ // method: reset
134
+ _MTL_INLINE void MTL::IndirectRenderCommand::reset()
135
+ {
136
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
137
+ }
138
+
139
+ // method: setComputePipelineState:
140
+ _MTL_INLINE void MTL::IndirectComputeCommand::setComputePipelineState(const MTL::ComputePipelineState* pipelineState)
141
+ {
142
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setComputePipelineState_), pipelineState);
143
+ }
144
+
145
+ // method: setKernelBuffer:offset:atIndex:
146
+ _MTL_INLINE void MTL::IndirectComputeCommand::setKernelBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
147
+ {
148
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setKernelBuffer_offset_atIndex_), buffer, offset, index);
149
+ }
150
+
151
+ // method: setKernelBuffer:offset:attributeStride:atIndex:
152
+ _MTL_INLINE void MTL::IndirectComputeCommand::setKernelBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index)
153
+ {
154
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setKernelBuffer_offset_attributeStride_atIndex_), buffer, offset, stride, index);
155
+ }
156
+
157
+ // method: concurrentDispatchThreadgroups:threadsPerThreadgroup:
158
+ _MTL_INLINE void MTL::IndirectComputeCommand::concurrentDispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup)
159
+ {
160
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(concurrentDispatchThreadgroups_threadsPerThreadgroup_), threadgroupsPerGrid, threadsPerThreadgroup);
161
+ }
162
+
163
+ // method: concurrentDispatchThreads:threadsPerThreadgroup:
164
+ _MTL_INLINE void MTL::IndirectComputeCommand::concurrentDispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup)
165
+ {
166
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(concurrentDispatchThreads_threadsPerThreadgroup_), threadsPerGrid, threadsPerThreadgroup);
167
+ }
168
+
169
+ // method: setBarrier
170
+ _MTL_INLINE void MTL::IndirectComputeCommand::setBarrier()
171
+ {
172
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBarrier));
173
+ }
174
+
175
+ // method: clearBarrier
176
+ _MTL_INLINE void MTL::IndirectComputeCommand::clearBarrier()
177
+ {
178
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(clearBarrier));
179
+ }
180
+
181
+ // method: setImageblockWidth:height:
182
+ _MTL_INLINE void MTL::IndirectComputeCommand::setImageblockWidth(NS::UInteger width, NS::UInteger height)
183
+ {
184
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setImageblockWidth_height_), width, height);
185
+ }
186
+
187
+ // method: reset
188
+ _MTL_INLINE void MTL::IndirectComputeCommand::reset()
189
+ {
190
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));
191
+ }
192
+
193
+ // method: setThreadgroupMemoryLength:atIndex:
194
+ _MTL_INLINE void MTL::IndirectComputeCommand::setThreadgroupMemoryLength(NS::UInteger length, NS::UInteger index)
195
+ {
196
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setThreadgroupMemoryLength_atIndex_), length, index);
197
+ }
198
+
199
+ // method: setStageInRegion:
200
+ _MTL_INLINE void MTL::IndirectComputeCommand::setStageInRegion(MTL::Region region)
201
+ {
202
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStageInRegion_), region);
203
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLIntersectionFunctionTable.hpp ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLIntersectionFunctionTable.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLIntersectionFunctionTable.hpp"
30
+ #include "MTLResource.hpp"
31
+ #include "MTLTypes.hpp"
32
+
33
+ namespace MTL
34
+ {
35
+ _MTL_OPTIONS(NS::UInteger, IntersectionFunctionSignature) {
36
+ IntersectionFunctionSignatureNone = 0,
37
+ IntersectionFunctionSignatureInstancing = 1,
38
+ IntersectionFunctionSignatureTriangleData = 2,
39
+ IntersectionFunctionSignatureWorldSpaceData = 4,
40
+ IntersectionFunctionSignatureInstanceMotion = 8,
41
+ IntersectionFunctionSignaturePrimitiveMotion = 16,
42
+ IntersectionFunctionSignatureExtendedLimits = 32,
43
+ IntersectionFunctionSignatureMaxLevels = 64,
44
+ IntersectionFunctionSignatureCurveData = 128,
45
+ };
46
+
47
+ class IntersectionFunctionTableDescriptor : public NS::Copying<IntersectionFunctionTableDescriptor>
48
+ {
49
+ public:
50
+ static class IntersectionFunctionTableDescriptor* alloc();
51
+
52
+ class IntersectionFunctionTableDescriptor* init();
53
+
54
+ static class IntersectionFunctionTableDescriptor* intersectionFunctionTableDescriptor();
55
+
56
+ NS::UInteger functionCount() const;
57
+ void setFunctionCount(NS::UInteger functionCount);
58
+ };
59
+
60
+ class IntersectionFunctionTable : public NS::Referencing<IntersectionFunctionTable, Resource>
61
+ {
62
+ public:
63
+ void setBuffer(const class Buffer* buffer, NS::UInteger offset, NS::UInteger index);
64
+
65
+ void setBuffers(const class Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);
66
+
67
+ MTL::ResourceID gpuResourceID() const;
68
+
69
+ void setFunction(const class FunctionHandle* function, NS::UInteger index);
70
+
71
+ void setFunctions(const class FunctionHandle* const functions[], NS::Range range);
72
+
73
+ void setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index);
74
+
75
+ void setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);
76
+
77
+ void setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index);
78
+
79
+ void setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);
80
+
81
+ void setVisibleFunctionTable(const class VisibleFunctionTable* functionTable, NS::UInteger bufferIndex);
82
+
83
+ void setVisibleFunctionTables(const class VisibleFunctionTable* const functionTables[], NS::Range bufferRange);
84
+ };
85
+
86
+ }
87
+
88
+ // static method: alloc
89
+ _MTL_INLINE MTL::IntersectionFunctionTableDescriptor* MTL::IntersectionFunctionTableDescriptor::alloc()
90
+ {
91
+ return NS::Object::alloc<MTL::IntersectionFunctionTableDescriptor>(_MTL_PRIVATE_CLS(MTLIntersectionFunctionTableDescriptor));
92
+ }
93
+
94
+ // method: init
95
+ _MTL_INLINE MTL::IntersectionFunctionTableDescriptor* MTL::IntersectionFunctionTableDescriptor::init()
96
+ {
97
+ return NS::Object::init<MTL::IntersectionFunctionTableDescriptor>();
98
+ }
99
+
100
+ // static method: intersectionFunctionTableDescriptor
101
+ _MTL_INLINE MTL::IntersectionFunctionTableDescriptor* MTL::IntersectionFunctionTableDescriptor::intersectionFunctionTableDescriptor()
102
+ {
103
+ return Object::sendMessage<MTL::IntersectionFunctionTableDescriptor*>(_MTL_PRIVATE_CLS(MTLIntersectionFunctionTableDescriptor), _MTL_PRIVATE_SEL(intersectionFunctionTableDescriptor));
104
+ }
105
+
106
+ // property: functionCount
107
+ _MTL_INLINE NS::UInteger MTL::IntersectionFunctionTableDescriptor::functionCount() const
108
+ {
109
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(functionCount));
110
+ }
111
+
112
+ _MTL_INLINE void MTL::IntersectionFunctionTableDescriptor::setFunctionCount(NS::UInteger functionCount)
113
+ {
114
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionCount_), functionCount);
115
+ }
116
+
117
+ // method: setBuffer:offset:atIndex:
118
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index)
119
+ {
120
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffer_offset_atIndex_), buffer, offset, index);
121
+ }
122
+
123
+ // method: setBuffers:offsets:withRange:
124
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range)
125
+ {
126
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBuffers_offsets_withRange_), buffers, offsets, range);
127
+ }
128
+
129
+ // property: gpuResourceID
130
+ _MTL_INLINE MTL::ResourceID MTL::IntersectionFunctionTable::gpuResourceID() const
131
+ {
132
+ return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID));
133
+ }
134
+
135
+ // method: setFunction:atIndex:
136
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setFunction(const MTL::FunctionHandle* function, NS::UInteger index)
137
+ {
138
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunction_atIndex_), function, index);
139
+ }
140
+
141
+ // method: setFunctions:withRange:
142
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setFunctions(const MTL::FunctionHandle* const functions[], NS::Range range)
143
+ {
144
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_withRange_), functions, range);
145
+ }
146
+
147
+ // method: setOpaqueTriangleIntersectionFunctionWithSignature:atIndex:
148
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index)
149
+ {
150
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueTriangleIntersectionFunctionWithSignature_atIndex_), signature, index);
151
+ }
152
+
153
+ // method: setOpaqueTriangleIntersectionFunctionWithSignature:withRange:
154
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range)
155
+ {
156
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueTriangleIntersectionFunctionWithSignature_withRange_), signature, range);
157
+ }
158
+
159
+ // method: setOpaqueCurveIntersectionFunctionWithSignature:atIndex:
160
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index)
161
+ {
162
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueCurveIntersectionFunctionWithSignature_atIndex_), signature, index);
163
+ }
164
+
165
+ // method: setOpaqueCurveIntersectionFunctionWithSignature:withRange:
166
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range)
167
+ {
168
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOpaqueCurveIntersectionFunctionWithSignature_withRange_), signature, range);
169
+ }
170
+
171
+ // method: setVisibleFunctionTable:atBufferIndex:
172
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setVisibleFunctionTable(const MTL::VisibleFunctionTable* functionTable, NS::UInteger bufferIndex)
173
+ {
174
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTable_atBufferIndex_), functionTable, bufferIndex);
175
+ }
176
+
177
+ // method: setVisibleFunctionTables:withBufferRange:
178
+ _MTL_INLINE void MTL::IntersectionFunctionTable::setVisibleFunctionTables(const MTL::VisibleFunctionTable* const functionTables[], NS::Range bufferRange)
179
+ {
180
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setVisibleFunctionTables_withBufferRange_), functionTables, bufferRange);
181
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLLibrary.hpp ADDED
@@ -0,0 +1,691 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLLibrary.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLArgument.hpp"
30
+ #include "MTLFunctionDescriptor.hpp"
31
+ #include "MTLLibrary.hpp"
32
+ #include <functional>
33
+
34
+ namespace MTL
35
+ {
36
+ _MTL_ENUM(NS::UInteger, PatchType) {
37
+ PatchTypeNone = 0,
38
+ PatchTypeTriangle = 1,
39
+ PatchTypeQuad = 2,
40
+ };
41
+
42
+ class VertexAttribute : public NS::Referencing<VertexAttribute>
43
+ {
44
+ public:
45
+ static class VertexAttribute* alloc();
46
+
47
+ class VertexAttribute* init();
48
+
49
+ NS::String* name() const;
50
+
51
+ NS::UInteger attributeIndex() const;
52
+
53
+ MTL::DataType attributeType() const;
54
+
55
+ bool active() const;
56
+
57
+ bool patchData() const;
58
+
59
+ bool patchControlPointData() const;
60
+ };
61
+
62
+ class Attribute : public NS::Referencing<Attribute>
63
+ {
64
+ public:
65
+ static class Attribute* alloc();
66
+
67
+ class Attribute* init();
68
+
69
+ NS::String* name() const;
70
+
71
+ NS::UInteger attributeIndex() const;
72
+
73
+ MTL::DataType attributeType() const;
74
+
75
+ bool active() const;
76
+
77
+ bool patchData() const;
78
+
79
+ bool patchControlPointData() const;
80
+ };
81
+
82
+ _MTL_ENUM(NS::UInteger, FunctionType) {
83
+ FunctionTypeVertex = 1,
84
+ FunctionTypeFragment = 2,
85
+ FunctionTypeKernel = 3,
86
+ FunctionTypeVisible = 5,
87
+ FunctionTypeIntersection = 6,
88
+ FunctionTypeMesh = 7,
89
+ FunctionTypeObject = 8,
90
+ };
91
+
92
+ class FunctionConstant : public NS::Referencing<FunctionConstant>
93
+ {
94
+ public:
95
+ static class FunctionConstant* alloc();
96
+
97
+ class FunctionConstant* init();
98
+
99
+ NS::String* name() const;
100
+
101
+ MTL::DataType type() const;
102
+
103
+ NS::UInteger index() const;
104
+
105
+ bool required() const;
106
+ };
107
+
108
+ using AutoreleasedArgument = class Argument*;
109
+
110
+ class Function : public NS::Referencing<Function>
111
+ {
112
+ public:
113
+ NS::String* label() const;
114
+ void setLabel(const NS::String* label);
115
+
116
+ class Device* device() const;
117
+
118
+ MTL::FunctionType functionType() const;
119
+
120
+ MTL::PatchType patchType() const;
121
+
122
+ NS::Integer patchControlPointCount() const;
123
+
124
+ NS::Array* vertexAttributes() const;
125
+
126
+ NS::Array* stageInputAttributes() const;
127
+
128
+ NS::String* name() const;
129
+
130
+ NS::Dictionary* functionConstantsDictionary() const;
131
+
132
+ class ArgumentEncoder* newArgumentEncoder(NS::UInteger bufferIndex);
133
+
134
+ class ArgumentEncoder* newArgumentEncoder(NS::UInteger bufferIndex, const MTL::AutoreleasedArgument* reflection);
135
+
136
+ MTL::FunctionOptions options() const;
137
+ };
138
+
139
+ _MTL_ENUM(NS::UInteger, LanguageVersion) {
140
+ LanguageVersion1_0 = 65536,
141
+ LanguageVersion1_1 = 65537,
142
+ LanguageVersion1_2 = 65538,
143
+ LanguageVersion2_0 = 131072,
144
+ LanguageVersion2_1 = 131073,
145
+ LanguageVersion2_2 = 131074,
146
+ LanguageVersion2_3 = 131075,
147
+ LanguageVersion2_4 = 131076,
148
+ LanguageVersion3_0 = 196608,
149
+ };
150
+
151
+ _MTL_ENUM(NS::Integer, LibraryType) {
152
+ LibraryTypeExecutable = 0,
153
+ LibraryTypeDynamic = 1,
154
+ };
155
+
156
+ _MTL_ENUM(NS::Integer, LibraryOptimizationLevel) {
157
+ LibraryOptimizationLevelDefault = 0,
158
+ LibraryOptimizationLevelSize = 1,
159
+ };
160
+
161
+ _MTL_ENUM(NS::Integer, CompileSymbolVisibility) {
162
+ CompileSymbolVisibilityDefault = 0,
163
+ CompileSymbolVisibilityHidden = 1,
164
+ };
165
+
166
+ class CompileOptions : public NS::Copying<CompileOptions>
167
+ {
168
+ public:
169
+ static class CompileOptions* alloc();
170
+
171
+ class CompileOptions* init();
172
+
173
+ NS::Dictionary* preprocessorMacros() const;
174
+ void setPreprocessorMacros(const NS::Dictionary* preprocessorMacros);
175
+
176
+ bool fastMathEnabled() const;
177
+ void setFastMathEnabled(bool fastMathEnabled);
178
+
179
+ MTL::LanguageVersion languageVersion() const;
180
+ void setLanguageVersion(MTL::LanguageVersion languageVersion);
181
+
182
+ MTL::LibraryType libraryType() const;
183
+ void setLibraryType(MTL::LibraryType libraryType);
184
+
185
+ NS::String* installName() const;
186
+ void setInstallName(const NS::String* installName);
187
+
188
+ NS::Array* libraries() const;
189
+ void setLibraries(const NS::Array* libraries);
190
+
191
+ bool preserveInvariance() const;
192
+ void setPreserveInvariance(bool preserveInvariance);
193
+
194
+ MTL::LibraryOptimizationLevel optimizationLevel() const;
195
+ void setOptimizationLevel(MTL::LibraryOptimizationLevel optimizationLevel);
196
+
197
+ MTL::CompileSymbolVisibility compileSymbolVisibility() const;
198
+ void setCompileSymbolVisibility(MTL::CompileSymbolVisibility compileSymbolVisibility);
199
+
200
+ bool allowReferencingUndefinedSymbols() const;
201
+ void setAllowReferencingUndefinedSymbols(bool allowReferencingUndefinedSymbols);
202
+
203
+ NS::UInteger maxTotalThreadsPerThreadgroup() const;
204
+ void setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup);
205
+ };
206
+
207
+ _MTL_ENUM(NS::UInteger, LibraryError) {
208
+ LibraryErrorUnsupported = 1,
209
+ LibraryErrorInternal = 2,
210
+ LibraryErrorCompileFailure = 3,
211
+ LibraryErrorCompileWarning = 4,
212
+ LibraryErrorFunctionNotFound = 5,
213
+ LibraryErrorFileNotFound = 6,
214
+ };
215
+
216
+ class Library : public NS::Referencing<Library>
217
+ {
218
+ public:
219
+ void newFunction(const NS::String* pFunctionName, const class FunctionConstantValues* pConstantValues, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler);
220
+
221
+ void newFunction(const class FunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler);
222
+
223
+ void newIntersectionFunction(const class IntersectionFunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler);
224
+
225
+ NS::String* label() const;
226
+ void setLabel(const NS::String* label);
227
+
228
+ class Device* device() const;
229
+
230
+ class Function* newFunction(const NS::String* functionName);
231
+
232
+ class Function* newFunction(const NS::String* name, const class FunctionConstantValues* constantValues, NS::Error** error);
233
+
234
+ void newFunction(const NS::String* name, const class FunctionConstantValues* constantValues, void (^completionHandler)(MTL::Function*, NS::Error*));
235
+
236
+ void newFunction(const class FunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*));
237
+
238
+ class Function* newFunction(const class FunctionDescriptor* descriptor, NS::Error** error);
239
+
240
+ void newIntersectionFunction(const class IntersectionFunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*));
241
+
242
+ class Function* newIntersectionFunction(const class IntersectionFunctionDescriptor* descriptor, NS::Error** error);
243
+
244
+ NS::Array* functionNames() const;
245
+
246
+ MTL::LibraryType type() const;
247
+
248
+ NS::String* installName() const;
249
+ };
250
+
251
+ }
252
+
253
+ // static method: alloc
254
+ _MTL_INLINE MTL::VertexAttribute* MTL::VertexAttribute::alloc()
255
+ {
256
+ return NS::Object::alloc<MTL::VertexAttribute>(_MTL_PRIVATE_CLS(MTLVertexAttribute));
257
+ }
258
+
259
+ // method: init
260
+ _MTL_INLINE MTL::VertexAttribute* MTL::VertexAttribute::init()
261
+ {
262
+ return NS::Object::init<MTL::VertexAttribute>();
263
+ }
264
+
265
+ // property: name
266
+ _MTL_INLINE NS::String* MTL::VertexAttribute::name() const
267
+ {
268
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
269
+ }
270
+
271
+ // property: attributeIndex
272
+ _MTL_INLINE NS::UInteger MTL::VertexAttribute::attributeIndex() const
273
+ {
274
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(attributeIndex));
275
+ }
276
+
277
+ // property: attributeType
278
+ _MTL_INLINE MTL::DataType MTL::VertexAttribute::attributeType() const
279
+ {
280
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(attributeType));
281
+ }
282
+
283
+ // property: active
284
+ _MTL_INLINE bool MTL::VertexAttribute::active() const
285
+ {
286
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
287
+ }
288
+
289
+ // property: patchData
290
+ _MTL_INLINE bool MTL::VertexAttribute::patchData() const
291
+ {
292
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchData));
293
+ }
294
+
295
+ // property: patchControlPointData
296
+ _MTL_INLINE bool MTL::VertexAttribute::patchControlPointData() const
297
+ {
298
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchControlPointData));
299
+ }
300
+
301
+ // static method: alloc
302
+ _MTL_INLINE MTL::Attribute* MTL::Attribute::alloc()
303
+ {
304
+ return NS::Object::alloc<MTL::Attribute>(_MTL_PRIVATE_CLS(MTLAttribute));
305
+ }
306
+
307
+ // method: init
308
+ _MTL_INLINE MTL::Attribute* MTL::Attribute::init()
309
+ {
310
+ return NS::Object::init<MTL::Attribute>();
311
+ }
312
+
313
+ // property: name
314
+ _MTL_INLINE NS::String* MTL::Attribute::name() const
315
+ {
316
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
317
+ }
318
+
319
+ // property: attributeIndex
320
+ _MTL_INLINE NS::UInteger MTL::Attribute::attributeIndex() const
321
+ {
322
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(attributeIndex));
323
+ }
324
+
325
+ // property: attributeType
326
+ _MTL_INLINE MTL::DataType MTL::Attribute::attributeType() const
327
+ {
328
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(attributeType));
329
+ }
330
+
331
+ // property: active
332
+ _MTL_INLINE bool MTL::Attribute::active() const
333
+ {
334
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isActive));
335
+ }
336
+
337
+ // property: patchData
338
+ _MTL_INLINE bool MTL::Attribute::patchData() const
339
+ {
340
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchData));
341
+ }
342
+
343
+ // property: patchControlPointData
344
+ _MTL_INLINE bool MTL::Attribute::patchControlPointData() const
345
+ {
346
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isPatchControlPointData));
347
+ }
348
+
349
+ // static method: alloc
350
+ _MTL_INLINE MTL::FunctionConstant* MTL::FunctionConstant::alloc()
351
+ {
352
+ return NS::Object::alloc<MTL::FunctionConstant>(_MTL_PRIVATE_CLS(MTLFunctionConstant));
353
+ }
354
+
355
+ // method: init
356
+ _MTL_INLINE MTL::FunctionConstant* MTL::FunctionConstant::init()
357
+ {
358
+ return NS::Object::init<MTL::FunctionConstant>();
359
+ }
360
+
361
+ // property: name
362
+ _MTL_INLINE NS::String* MTL::FunctionConstant::name() const
363
+ {
364
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
365
+ }
366
+
367
+ // property: type
368
+ _MTL_INLINE MTL::DataType MTL::FunctionConstant::type() const
369
+ {
370
+ return Object::sendMessage<MTL::DataType>(this, _MTL_PRIVATE_SEL(type));
371
+ }
372
+
373
+ // property: index
374
+ _MTL_INLINE NS::UInteger MTL::FunctionConstant::index() const
375
+ {
376
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(index));
377
+ }
378
+
379
+ // property: required
380
+ _MTL_INLINE bool MTL::FunctionConstant::required() const
381
+ {
382
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(required));
383
+ }
384
+
385
+ // property: label
386
+ _MTL_INLINE NS::String* MTL::Function::label() const
387
+ {
388
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
389
+ }
390
+
391
+ _MTL_INLINE void MTL::Function::setLabel(const NS::String* label)
392
+ {
393
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
394
+ }
395
+
396
+ // property: device
397
+ _MTL_INLINE MTL::Device* MTL::Function::device() const
398
+ {
399
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
400
+ }
401
+
402
+ // property: functionType
403
+ _MTL_INLINE MTL::FunctionType MTL::Function::functionType() const
404
+ {
405
+ return Object::sendMessage<MTL::FunctionType>(this, _MTL_PRIVATE_SEL(functionType));
406
+ }
407
+
408
+ // property: patchType
409
+ _MTL_INLINE MTL::PatchType MTL::Function::patchType() const
410
+ {
411
+ return Object::sendMessage<MTL::PatchType>(this, _MTL_PRIVATE_SEL(patchType));
412
+ }
413
+
414
+ // property: patchControlPointCount
415
+ _MTL_INLINE NS::Integer MTL::Function::patchControlPointCount() const
416
+ {
417
+ return Object::sendMessage<NS::Integer>(this, _MTL_PRIVATE_SEL(patchControlPointCount));
418
+ }
419
+
420
+ // property: vertexAttributes
421
+ _MTL_INLINE NS::Array* MTL::Function::vertexAttributes() const
422
+ {
423
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(vertexAttributes));
424
+ }
425
+
426
+ // property: stageInputAttributes
427
+ _MTL_INLINE NS::Array* MTL::Function::stageInputAttributes() const
428
+ {
429
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(stageInputAttributes));
430
+ }
431
+
432
+ // property: name
433
+ _MTL_INLINE NS::String* MTL::Function::name() const
434
+ {
435
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name));
436
+ }
437
+
438
+ // property: functionConstantsDictionary
439
+ _MTL_INLINE NS::Dictionary* MTL::Function::functionConstantsDictionary() const
440
+ {
441
+ return Object::sendMessage<NS::Dictionary*>(this, _MTL_PRIVATE_SEL(functionConstantsDictionary));
442
+ }
443
+
444
+ // method: newArgumentEncoderWithBufferIndex:
445
+ _MTL_INLINE MTL::ArgumentEncoder* MTL::Function::newArgumentEncoder(NS::UInteger bufferIndex)
446
+ {
447
+ return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithBufferIndex_), bufferIndex);
448
+ }
449
+
450
+ // method: newArgumentEncoderWithBufferIndex:reflection:
451
+ _MTL_INLINE MTL::ArgumentEncoder* MTL::Function::newArgumentEncoder(NS::UInteger bufferIndex, const MTL::AutoreleasedArgument* reflection)
452
+ {
453
+ return Object::sendMessage<MTL::ArgumentEncoder*>(this, _MTL_PRIVATE_SEL(newArgumentEncoderWithBufferIndex_reflection_), bufferIndex, reflection);
454
+ }
455
+
456
+ // property: options
457
+ _MTL_INLINE MTL::FunctionOptions MTL::Function::options() const
458
+ {
459
+ return Object::sendMessage<MTL::FunctionOptions>(this, _MTL_PRIVATE_SEL(options));
460
+ }
461
+
462
+ // static method: alloc
463
+ _MTL_INLINE MTL::CompileOptions* MTL::CompileOptions::alloc()
464
+ {
465
+ return NS::Object::alloc<MTL::CompileOptions>(_MTL_PRIVATE_CLS(MTLCompileOptions));
466
+ }
467
+
468
+ // method: init
469
+ _MTL_INLINE MTL::CompileOptions* MTL::CompileOptions::init()
470
+ {
471
+ return NS::Object::init<MTL::CompileOptions>();
472
+ }
473
+
474
+ // property: preprocessorMacros
475
+ _MTL_INLINE NS::Dictionary* MTL::CompileOptions::preprocessorMacros() const
476
+ {
477
+ return Object::sendMessage<NS::Dictionary*>(this, _MTL_PRIVATE_SEL(preprocessorMacros));
478
+ }
479
+
480
+ _MTL_INLINE void MTL::CompileOptions::setPreprocessorMacros(const NS::Dictionary* preprocessorMacros)
481
+ {
482
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreprocessorMacros_), preprocessorMacros);
483
+ }
484
+
485
+ // property: fastMathEnabled
486
+ _MTL_INLINE bool MTL::CompileOptions::fastMathEnabled() const
487
+ {
488
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(fastMathEnabled));
489
+ }
490
+
491
+ _MTL_INLINE void MTL::CompileOptions::setFastMathEnabled(bool fastMathEnabled)
492
+ {
493
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFastMathEnabled_), fastMathEnabled);
494
+ }
495
+
496
+ // property: languageVersion
497
+ _MTL_INLINE MTL::LanguageVersion MTL::CompileOptions::languageVersion() const
498
+ {
499
+ return Object::sendMessage<MTL::LanguageVersion>(this, _MTL_PRIVATE_SEL(languageVersion));
500
+ }
501
+
502
+ _MTL_INLINE void MTL::CompileOptions::setLanguageVersion(MTL::LanguageVersion languageVersion)
503
+ {
504
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLanguageVersion_), languageVersion);
505
+ }
506
+
507
+ // property: libraryType
508
+ _MTL_INLINE MTL::LibraryType MTL::CompileOptions::libraryType() const
509
+ {
510
+ return Object::sendMessage<MTL::LibraryType>(this, _MTL_PRIVATE_SEL(libraryType));
511
+ }
512
+
513
+ _MTL_INLINE void MTL::CompileOptions::setLibraryType(MTL::LibraryType libraryType)
514
+ {
515
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLibraryType_), libraryType);
516
+ }
517
+
518
+ // property: installName
519
+ _MTL_INLINE NS::String* MTL::CompileOptions::installName() const
520
+ {
521
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(installName));
522
+ }
523
+
524
+ _MTL_INLINE void MTL::CompileOptions::setInstallName(const NS::String* installName)
525
+ {
526
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInstallName_), installName);
527
+ }
528
+
529
+ // property: libraries
530
+ _MTL_INLINE NS::Array* MTL::CompileOptions::libraries() const
531
+ {
532
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(libraries));
533
+ }
534
+
535
+ _MTL_INLINE void MTL::CompileOptions::setLibraries(const NS::Array* libraries)
536
+ {
537
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLibraries_), libraries);
538
+ }
539
+
540
+ // property: preserveInvariance
541
+ _MTL_INLINE bool MTL::CompileOptions::preserveInvariance() const
542
+ {
543
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(preserveInvariance));
544
+ }
545
+
546
+ _MTL_INLINE void MTL::CompileOptions::setPreserveInvariance(bool preserveInvariance)
547
+ {
548
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPreserveInvariance_), preserveInvariance);
549
+ }
550
+
551
+ // property: optimizationLevel
552
+ _MTL_INLINE MTL::LibraryOptimizationLevel MTL::CompileOptions::optimizationLevel() const
553
+ {
554
+ return Object::sendMessage<MTL::LibraryOptimizationLevel>(this, _MTL_PRIVATE_SEL(optimizationLevel));
555
+ }
556
+
557
+ _MTL_INLINE void MTL::CompileOptions::setOptimizationLevel(MTL::LibraryOptimizationLevel optimizationLevel)
558
+ {
559
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptimizationLevel_), optimizationLevel);
560
+ }
561
+
562
+ // property: compileSymbolVisibility
563
+ _MTL_INLINE MTL::CompileSymbolVisibility MTL::CompileOptions::compileSymbolVisibility() const
564
+ {
565
+ return Object::sendMessage<MTL::CompileSymbolVisibility>(this, _MTL_PRIVATE_SEL(compileSymbolVisibility));
566
+ }
567
+
568
+ _MTL_INLINE void MTL::CompileOptions::setCompileSymbolVisibility(MTL::CompileSymbolVisibility compileSymbolVisibility)
569
+ {
570
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCompileSymbolVisibility_), compileSymbolVisibility);
571
+ }
572
+
573
+ // property: allowReferencingUndefinedSymbols
574
+ _MTL_INLINE bool MTL::CompileOptions::allowReferencingUndefinedSymbols() const
575
+ {
576
+ return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(allowReferencingUndefinedSymbols));
577
+ }
578
+
579
+ _MTL_INLINE void MTL::CompileOptions::setAllowReferencingUndefinedSymbols(bool allowReferencingUndefinedSymbols)
580
+ {
581
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAllowReferencingUndefinedSymbols_), allowReferencingUndefinedSymbols);
582
+ }
583
+
584
+ // property: maxTotalThreadsPerThreadgroup
585
+ _MTL_INLINE NS::UInteger MTL::CompileOptions::maxTotalThreadsPerThreadgroup() const
586
+ {
587
+ return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTotalThreadsPerThreadgroup));
588
+ }
589
+
590
+ _MTL_INLINE void MTL::CompileOptions::setMaxTotalThreadsPerThreadgroup(NS::UInteger maxTotalThreadsPerThreadgroup)
591
+ {
592
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTotalThreadsPerThreadgroup_), maxTotalThreadsPerThreadgroup);
593
+ }
594
+
595
+ _MTL_INLINE void MTL::Library::newFunction(const NS::String* pFunctionName, const FunctionConstantValues* pConstantValues, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler)
596
+ {
597
+ __block std::function<void(Function * pFunction, NS::Error * pError)> blockCompletionHandler = completionHandler;
598
+
599
+ newFunction(pFunctionName, pConstantValues, ^(Function* pFunction, NS::Error* pError) { blockCompletionHandler(pFunction, pError); });
600
+ }
601
+
602
+ _MTL_INLINE void MTL::Library::newFunction(const FunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler)
603
+ {
604
+ __block std::function<void(Function * pFunction, NS::Error * pError)> blockCompletionHandler = completionHandler;
605
+
606
+ newFunction(pDescriptor, ^(Function* pFunction, NS::Error* pError) { blockCompletionHandler(pFunction, pError); });
607
+ }
608
+
609
+ _MTL_INLINE void MTL::Library::newIntersectionFunction(const IntersectionFunctionDescriptor* pDescriptor, const std::function<void(Function* pFunction, NS::Error* pError)>& completionHandler)
610
+ {
611
+ __block std::function<void(Function * pFunction, NS::Error * pError)> blockCompletionHandler = completionHandler;
612
+
613
+ newIntersectionFunction(pDescriptor, ^(Function* pFunction, NS::Error* pError) { blockCompletionHandler(pFunction, pError); });
614
+ }
615
+
616
+ // property: label
617
+ _MTL_INLINE NS::String* MTL::Library::label() const
618
+ {
619
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
620
+ }
621
+
622
+ _MTL_INLINE void MTL::Library::setLabel(const NS::String* label)
623
+ {
624
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
625
+ }
626
+
627
+ // property: device
628
+ _MTL_INLINE MTL::Device* MTL::Library::device() const
629
+ {
630
+ return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
631
+ }
632
+
633
+ // method: newFunctionWithName:
634
+ _MTL_INLINE MTL::Function* MTL::Library::newFunction(const NS::String* functionName)
635
+ {
636
+ return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newFunctionWithName_), functionName);
637
+ }
638
+
639
+ // method: newFunctionWithName:constantValues:error:
640
+ _MTL_INLINE MTL::Function* MTL::Library::newFunction(const NS::String* name, const MTL::FunctionConstantValues* constantValues, NS::Error** error)
641
+ {
642
+ return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newFunctionWithName_constantValues_error_), name, constantValues, error);
643
+ }
644
+
645
+ // method: newFunctionWithName:constantValues:completionHandler:
646
+ _MTL_INLINE void MTL::Library::newFunction(const NS::String* name, const MTL::FunctionConstantValues* constantValues, void (^completionHandler)(MTL::Function*, NS::Error*))
647
+ {
648
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newFunctionWithName_constantValues_completionHandler_), name, constantValues, completionHandler);
649
+ }
650
+
651
+ // method: newFunctionWithDescriptor:completionHandler:
652
+ _MTL_INLINE void MTL::Library::newFunction(const MTL::FunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*))
653
+ {
654
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newFunctionWithDescriptor_completionHandler_), descriptor, completionHandler);
655
+ }
656
+
657
+ // method: newFunctionWithDescriptor:error:
658
+ _MTL_INLINE MTL::Function* MTL::Library::newFunction(const MTL::FunctionDescriptor* descriptor, NS::Error** error)
659
+ {
660
+ return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newFunctionWithDescriptor_error_), descriptor, error);
661
+ }
662
+
663
+ // method: newIntersectionFunctionWithDescriptor:completionHandler:
664
+ _MTL_INLINE void MTL::Library::newIntersectionFunction(const MTL::IntersectionFunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*))
665
+ {
666
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionWithDescriptor_completionHandler_), descriptor, completionHandler);
667
+ }
668
+
669
+ // method: newIntersectionFunctionWithDescriptor:error:
670
+ _MTL_INLINE MTL::Function* MTL::Library::newIntersectionFunction(const MTL::IntersectionFunctionDescriptor* descriptor, NS::Error** error)
671
+ {
672
+ return Object::sendMessage<MTL::Function*>(this, _MTL_PRIVATE_SEL(newIntersectionFunctionWithDescriptor_error_), descriptor, error);
673
+ }
674
+
675
+ // property: functionNames
676
+ _MTL_INLINE NS::Array* MTL::Library::functionNames() const
677
+ {
678
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functionNames));
679
+ }
680
+
681
+ // property: type
682
+ _MTL_INLINE MTL::LibraryType MTL::Library::type() const
683
+ {
684
+ return Object::sendMessage<MTL::LibraryType>(this, _MTL_PRIVATE_SEL(type));
685
+ }
686
+
687
+ // property: installName
688
+ _MTL_INLINE NS::String* MTL::Library::installName() const
689
+ {
690
+ return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(installName));
691
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLLinkedFunctions.hpp ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLLinkedFunctions.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ namespace MTL
30
+ {
31
+ class LinkedFunctions : public NS::Copying<LinkedFunctions>
32
+ {
33
+ public:
34
+ static class LinkedFunctions* alloc();
35
+
36
+ class LinkedFunctions* init();
37
+
38
+ static class LinkedFunctions* linkedFunctions();
39
+
40
+ NS::Array* functions() const;
41
+ void setFunctions(const NS::Array* functions);
42
+
43
+ NS::Array* binaryFunctions() const;
44
+ void setBinaryFunctions(const NS::Array* binaryFunctions);
45
+
46
+ NS::Dictionary* groups() const;
47
+ void setGroups(const NS::Dictionary* groups);
48
+
49
+ NS::Array* privateFunctions() const;
50
+ void setPrivateFunctions(const NS::Array* privateFunctions);
51
+ };
52
+
53
+ }
54
+
55
+ // static method: alloc
56
+ _MTL_INLINE MTL::LinkedFunctions* MTL::LinkedFunctions::alloc()
57
+ {
58
+ return NS::Object::alloc<MTL::LinkedFunctions>(_MTL_PRIVATE_CLS(MTLLinkedFunctions));
59
+ }
60
+
61
+ // method: init
62
+ _MTL_INLINE MTL::LinkedFunctions* MTL::LinkedFunctions::init()
63
+ {
64
+ return NS::Object::init<MTL::LinkedFunctions>();
65
+ }
66
+
67
+ // static method: linkedFunctions
68
+ _MTL_INLINE MTL::LinkedFunctions* MTL::LinkedFunctions::linkedFunctions()
69
+ {
70
+ return Object::sendMessage<MTL::LinkedFunctions*>(_MTL_PRIVATE_CLS(MTLLinkedFunctions), _MTL_PRIVATE_SEL(linkedFunctions));
71
+ }
72
+
73
+ // property: functions
74
+ _MTL_INLINE NS::Array* MTL::LinkedFunctions::functions() const
75
+ {
76
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(functions));
77
+ }
78
+
79
+ _MTL_INLINE void MTL::LinkedFunctions::setFunctions(const NS::Array* functions)
80
+ {
81
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_), functions);
82
+ }
83
+
84
+ // property: binaryFunctions
85
+ _MTL_INLINE NS::Array* MTL::LinkedFunctions::binaryFunctions() const
86
+ {
87
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryFunctions));
88
+ }
89
+
90
+ _MTL_INLINE void MTL::LinkedFunctions::setBinaryFunctions(const NS::Array* binaryFunctions)
91
+ {
92
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryFunctions_), binaryFunctions);
93
+ }
94
+
95
+ // property: groups
96
+ _MTL_INLINE NS::Dictionary* MTL::LinkedFunctions::groups() const
97
+ {
98
+ return Object::sendMessage<NS::Dictionary*>(this, _MTL_PRIVATE_SEL(groups));
99
+ }
100
+
101
+ _MTL_INLINE void MTL::LinkedFunctions::setGroups(const NS::Dictionary* groups)
102
+ {
103
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setGroups_), groups);
104
+ }
105
+
106
+ // property: privateFunctions
107
+ _MTL_INLINE NS::Array* MTL::LinkedFunctions::privateFunctions() const
108
+ {
109
+ return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(privateFunctions));
110
+ }
111
+
112
+ _MTL_INLINE void MTL::LinkedFunctions::setPrivateFunctions(const NS::Array* privateFunctions)
113
+ {
114
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setPrivateFunctions_), privateFunctions);
115
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLParallelRenderCommandEncoder.hpp ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLParallelRenderCommandEncoder.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLCommandEncoder.hpp"
30
+ #include "MTLRenderPass.hpp"
31
+
32
+ namespace MTL
33
+ {
34
+ class ParallelRenderCommandEncoder : public NS::Referencing<ParallelRenderCommandEncoder, CommandEncoder>
35
+ {
36
+ public:
37
+ class RenderCommandEncoder* renderCommandEncoder();
38
+
39
+ void setColorStoreAction(MTL::StoreAction storeAction, NS::UInteger colorAttachmentIndex);
40
+
41
+ void setDepthStoreAction(MTL::StoreAction storeAction);
42
+
43
+ void setStencilStoreAction(MTL::StoreAction storeAction);
44
+
45
+ void setColorStoreActionOptions(MTL::StoreActionOptions storeActionOptions, NS::UInteger colorAttachmentIndex);
46
+
47
+ void setDepthStoreActionOptions(MTL::StoreActionOptions storeActionOptions);
48
+
49
+ void setStencilStoreActionOptions(MTL::StoreActionOptions storeActionOptions);
50
+ };
51
+
52
+ }
53
+
54
+ // method: renderCommandEncoder
55
+ _MTL_INLINE MTL::RenderCommandEncoder* MTL::ParallelRenderCommandEncoder::renderCommandEncoder()
56
+ {
57
+ return Object::sendMessage<MTL::RenderCommandEncoder*>(this, _MTL_PRIVATE_SEL(renderCommandEncoder));
58
+ }
59
+
60
+ // method: setColorStoreAction:atIndex:
61
+ _MTL_INLINE void MTL::ParallelRenderCommandEncoder::setColorStoreAction(MTL::StoreAction storeAction, NS::UInteger colorAttachmentIndex)
62
+ {
63
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorStoreAction_atIndex_), storeAction, colorAttachmentIndex);
64
+ }
65
+
66
+ // method: setDepthStoreAction:
67
+ _MTL_INLINE void MTL::ParallelRenderCommandEncoder::setDepthStoreAction(MTL::StoreAction storeAction)
68
+ {
69
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStoreAction_), storeAction);
70
+ }
71
+
72
+ // method: setStencilStoreAction:
73
+ _MTL_INLINE void MTL::ParallelRenderCommandEncoder::setStencilStoreAction(MTL::StoreAction storeAction)
74
+ {
75
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilStoreAction_), storeAction);
76
+ }
77
+
78
+ // method: setColorStoreActionOptions:atIndex:
79
+ _MTL_INLINE void MTL::ParallelRenderCommandEncoder::setColorStoreActionOptions(MTL::StoreActionOptions storeActionOptions, NS::UInteger colorAttachmentIndex)
80
+ {
81
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setColorStoreActionOptions_atIndex_), storeActionOptions, colorAttachmentIndex);
82
+ }
83
+
84
+ // method: setDepthStoreActionOptions:
85
+ _MTL_INLINE void MTL::ParallelRenderCommandEncoder::setDepthStoreActionOptions(MTL::StoreActionOptions storeActionOptions)
86
+ {
87
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDepthStoreActionOptions_), storeActionOptions);
88
+ }
89
+
90
+ // method: setStencilStoreActionOptions:
91
+ _MTL_INLINE void MTL::ParallelRenderCommandEncoder::setStencilStoreActionOptions(MTL::StoreActionOptions storeActionOptions)
92
+ {
93
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStencilStoreActionOptions_), storeActionOptions);
94
+ }
lib/python3.11/site-packages/mlx/include/metal_cpp/Metal/MTLPipeline.hpp ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Metal/MTLPipeline.hpp
4
+ //
5
+ // Copyright 2020-2023 Apple Inc.
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
+
21
+ #pragma once
22
+
23
+ #include "MTLDefines.hpp"
24
+ #include "MTLHeaderBridge.hpp"
25
+ #include "MTLPrivate.hpp"
26
+
27
+ #include <Foundation/Foundation.hpp>
28
+
29
+ #include "MTLPipeline.hpp"
30
+
31
+ namespace MTL
32
+ {
33
+ _MTL_ENUM(NS::UInteger, Mutability) {
34
+ MutabilityDefault = 0,
35
+ MutabilityMutable = 1,
36
+ MutabilityImmutable = 2,
37
+ };
38
+
39
+ class PipelineBufferDescriptor : public NS::Copying<PipelineBufferDescriptor>
40
+ {
41
+ public:
42
+ static class PipelineBufferDescriptor* alloc();
43
+
44
+ class PipelineBufferDescriptor* init();
45
+
46
+ MTL::Mutability mutability() const;
47
+ void setMutability(MTL::Mutability mutability);
48
+ };
49
+
50
+ class PipelineBufferDescriptorArray : public NS::Referencing<PipelineBufferDescriptorArray>
51
+ {
52
+ public:
53
+ static class PipelineBufferDescriptorArray* alloc();
54
+
55
+ class PipelineBufferDescriptorArray* init();
56
+
57
+ class PipelineBufferDescriptor* object(NS::UInteger bufferIndex);
58
+
59
+ void setObject(const class PipelineBufferDescriptor* buffer, NS::UInteger bufferIndex);
60
+ };
61
+
62
+ }
63
+
64
+ // static method: alloc
65
+ _MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptor::alloc()
66
+ {
67
+ return NS::Object::alloc<MTL::PipelineBufferDescriptor>(_MTL_PRIVATE_CLS(MTLPipelineBufferDescriptor));
68
+ }
69
+
70
+ // method: init
71
+ _MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptor::init()
72
+ {
73
+ return NS::Object::init<MTL::PipelineBufferDescriptor>();
74
+ }
75
+
76
+ // property: mutability
77
+ _MTL_INLINE MTL::Mutability MTL::PipelineBufferDescriptor::mutability() const
78
+ {
79
+ return Object::sendMessage<MTL::Mutability>(this, _MTL_PRIVATE_SEL(mutability));
80
+ }
81
+
82
+ _MTL_INLINE void MTL::PipelineBufferDescriptor::setMutability(MTL::Mutability mutability)
83
+ {
84
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMutability_), mutability);
85
+ }
86
+
87
+ // static method: alloc
88
+ _MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::PipelineBufferDescriptorArray::alloc()
89
+ {
90
+ return NS::Object::alloc<MTL::PipelineBufferDescriptorArray>(_MTL_PRIVATE_CLS(MTLPipelineBufferDescriptorArray));
91
+ }
92
+
93
+ // method: init
94
+ _MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::PipelineBufferDescriptorArray::init()
95
+ {
96
+ return NS::Object::init<MTL::PipelineBufferDescriptorArray>();
97
+ }
98
+
99
+ // method: objectAtIndexedSubscript:
100
+ _MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptorArray::object(NS::UInteger bufferIndex)
101
+ {
102
+ return Object::sendMessage<MTL::PipelineBufferDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), bufferIndex);
103
+ }
104
+
105
+ // method: setObject:atIndexedSubscript:
106
+ _MTL_INLINE void MTL::PipelineBufferDescriptorArray::setObject(const MTL::PipelineBufferDescriptor* buffer, NS::UInteger bufferIndex)
107
+ {
108
+ Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), buffer, bufferIndex);
109
+ }