objc2_metal/generated/
MTLComputePipeline.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 pub struct MTLComputePipelineReflection;
15);
16
17unsafe impl Send for MTLComputePipelineReflection {}
18
19unsafe impl Sync for MTLComputePipelineReflection {}
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for MTLComputePipelineReflection {}
23);
24
25impl MTLComputePipelineReflection {
26 extern_methods!(
27 #[cfg(feature = "MTLArgument")]
28 #[unsafe(method(bindings))]
29 #[unsafe(method_family = none)]
30 pub fn bindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
31
32 #[cfg(feature = "MTLArgument")]
33 #[deprecated]
34 #[unsafe(method(arguments))]
35 #[unsafe(method_family = none)]
36 pub fn arguments(&self) -> Retained<NSArray<MTLArgument>>;
37 );
38}
39
40impl MTLComputePipelineReflection {
42 extern_methods!(
43 #[unsafe(method(init))]
44 #[unsafe(method_family = init)]
45 pub fn init(this: Allocated<Self>) -> Retained<Self>;
46
47 #[unsafe(method(new))]
48 #[unsafe(method_family = new)]
49 pub fn new() -> Retained<Self>;
50 );
51}
52
53impl DefaultRetained for MTLComputePipelineReflection {
54 #[inline]
55 fn default_retained() -> Retained<Self> {
56 Self::new()
57 }
58}
59
60extern_class!(
61 #[unsafe(super(NSObject))]
63 #[derive(Debug, PartialEq, Eq, Hash)]
64 pub struct MTLComputePipelineDescriptor;
65);
66
67extern_conformance!(
68 unsafe impl NSCopying for MTLComputePipelineDescriptor {}
69);
70
71unsafe impl CopyingHelper for MTLComputePipelineDescriptor {
72 type Result = Self;
73}
74
75extern_conformance!(
76 unsafe impl NSObjectProtocol for MTLComputePipelineDescriptor {}
77);
78
79impl MTLComputePipelineDescriptor {
80 extern_methods!(
81 #[unsafe(method(label))]
83 #[unsafe(method_family = none)]
84 pub fn label(&self) -> Option<Retained<NSString>>;
85
86 #[unsafe(method(setLabel:))]
90 #[unsafe(method_family = none)]
91 pub fn setLabel(&self, label: Option<&NSString>);
92
93 #[cfg(feature = "MTLLibrary")]
94 #[unsafe(method(computeFunction))]
96 #[unsafe(method_family = none)]
97 pub fn computeFunction(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
98
99 #[cfg(feature = "MTLLibrary")]
100 #[unsafe(method(setComputeFunction:))]
102 #[unsafe(method_family = none)]
103 pub fn setComputeFunction(
104 &self,
105 compute_function: Option<&ProtocolObject<dyn MTLFunction>>,
106 );
107
108 #[unsafe(method(threadGroupSizeIsMultipleOfThreadExecutionWidth))]
110 #[unsafe(method_family = none)]
111 pub fn threadGroupSizeIsMultipleOfThreadExecutionWidth(&self) -> bool;
112
113 #[unsafe(method(setThreadGroupSizeIsMultipleOfThreadExecutionWidth:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn setThreadGroupSizeIsMultipleOfThreadExecutionWidth(
117 &self,
118 thread_group_size_is_multiple_of_thread_execution_width: bool,
119 );
120
121 #[unsafe(method(maxTotalThreadsPerThreadgroup))]
123 #[unsafe(method_family = none)]
124 pub fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
125
126 #[unsafe(method(setMaxTotalThreadsPerThreadgroup:))]
128 #[unsafe(method_family = none)]
129 pub fn setMaxTotalThreadsPerThreadgroup(
130 &self,
131 max_total_threads_per_threadgroup: NSUInteger,
132 );
133
134 #[cfg(feature = "MTLStageInputOutputDescriptor")]
135 #[unsafe(method(stageInputDescriptor))]
137 #[unsafe(method_family = none)]
138 pub fn stageInputDescriptor(&self) -> Option<Retained<MTLStageInputOutputDescriptor>>;
139
140 #[cfg(feature = "MTLStageInputOutputDescriptor")]
141 #[unsafe(method(setStageInputDescriptor:))]
145 #[unsafe(method_family = none)]
146 pub fn setStageInputDescriptor(
147 &self,
148 stage_input_descriptor: Option<&MTLStageInputOutputDescriptor>,
149 );
150
151 #[cfg(feature = "MTLPipeline")]
152 #[unsafe(method(buffers))]
154 #[unsafe(method_family = none)]
155 pub fn buffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
156
157 #[unsafe(method(supportIndirectCommandBuffers))]
159 #[unsafe(method_family = none)]
160 pub fn supportIndirectCommandBuffers(&self) -> bool;
161
162 #[unsafe(method(setSupportIndirectCommandBuffers:))]
164 #[unsafe(method_family = none)]
165 pub fn setSupportIndirectCommandBuffers(&self, support_indirect_command_buffers: bool);
166
167 #[cfg(feature = "MTLDynamicLibrary")]
168 #[deprecated]
176 #[unsafe(method(insertLibraries))]
177 #[unsafe(method_family = none)]
178 pub fn insertLibraries(
179 &self,
180 ) -> Option<Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>>;
181
182 #[cfg(feature = "MTLDynamicLibrary")]
183 #[deprecated]
187 #[unsafe(method(setInsertLibraries:))]
188 #[unsafe(method_family = none)]
189 pub fn setInsertLibraries(
190 &self,
191 insert_libraries: Option<&NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>,
192 );
193
194 #[cfg(feature = "MTLDynamicLibrary")]
195 #[unsafe(method(preloadedLibraries))]
203 #[unsafe(method_family = none)]
204 pub fn preloadedLibraries(
205 &self,
206 ) -> Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>;
207
208 #[cfg(feature = "MTLDynamicLibrary")]
209 #[unsafe(method(setPreloadedLibraries:))]
213 #[unsafe(method_family = none)]
214 pub fn setPreloadedLibraries(
215 &self,
216 preloaded_libraries: &NSArray<ProtocolObject<dyn MTLDynamicLibrary>>,
217 );
218
219 #[cfg(feature = "MTLBinaryArchive")]
220 #[unsafe(method(binaryArchives))]
226 #[unsafe(method_family = none)]
227 pub fn binaryArchives(
228 &self,
229 ) -> Option<Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>>;
230
231 #[cfg(feature = "MTLBinaryArchive")]
232 #[unsafe(method(setBinaryArchives:))]
236 #[unsafe(method_family = none)]
237 pub fn setBinaryArchives(
238 &self,
239 binary_archives: Option<&NSArray<ProtocolObject<dyn MTLBinaryArchive>>>,
240 );
241
242 #[unsafe(method(reset))]
244 #[unsafe(method_family = none)]
245 pub fn reset(&self);
246
247 #[cfg(feature = "MTLLinkedFunctions")]
248 #[unsafe(method(linkedFunctions))]
252 #[unsafe(method_family = none)]
253 pub fn linkedFunctions(&self) -> Option<Retained<MTLLinkedFunctions>>;
254
255 #[cfg(feature = "MTLLinkedFunctions")]
256 #[unsafe(method(setLinkedFunctions:))]
260 #[unsafe(method_family = none)]
261 pub fn setLinkedFunctions(&self, linked_functions: Option<&MTLLinkedFunctions>);
262
263 #[unsafe(method(supportAddingBinaryFunctions))]
265 #[unsafe(method_family = none)]
266 pub fn supportAddingBinaryFunctions(&self) -> bool;
267
268 #[unsafe(method(setSupportAddingBinaryFunctions:))]
270 #[unsafe(method_family = none)]
271 pub fn setSupportAddingBinaryFunctions(&self, support_adding_binary_functions: bool);
272
273 #[unsafe(method(maxCallStackDepth))]
275 #[unsafe(method_family = none)]
276 pub fn maxCallStackDepth(&self) -> NSUInteger;
277
278 #[unsafe(method(setMaxCallStackDepth:))]
280 #[unsafe(method_family = none)]
281 pub fn setMaxCallStackDepth(&self, max_call_stack_depth: NSUInteger);
282
283 #[cfg(feature = "MTLPipeline")]
284 #[unsafe(method(shaderValidation))]
288 #[unsafe(method_family = none)]
289 pub fn shaderValidation(&self) -> MTLShaderValidation;
290
291 #[cfg(feature = "MTLPipeline")]
292 #[unsafe(method(setShaderValidation:))]
294 #[unsafe(method_family = none)]
295 pub fn setShaderValidation(&self, shader_validation: MTLShaderValidation);
296
297 #[cfg(feature = "MTLTypes")]
298 #[unsafe(method(requiredThreadsPerThreadgroup))]
302 #[unsafe(method_family = none)]
303 pub fn requiredThreadsPerThreadgroup(&self) -> MTLSize;
304
305 #[cfg(feature = "MTLTypes")]
306 #[unsafe(method(setRequiredThreadsPerThreadgroup:))]
308 #[unsafe(method_family = none)]
309 pub fn setRequiredThreadsPerThreadgroup(&self, required_threads_per_threadgroup: MTLSize);
310 );
311}
312
313impl MTLComputePipelineDescriptor {
315 extern_methods!(
316 #[unsafe(method(init))]
317 #[unsafe(method_family = init)]
318 pub fn init(this: Allocated<Self>) -> Retained<Self>;
319
320 #[unsafe(method(new))]
321 #[unsafe(method_family = new)]
322 pub fn new() -> Retained<Self>;
323 );
324}
325
326impl DefaultRetained for MTLComputePipelineDescriptor {
327 #[inline]
328 fn default_retained() -> Retained<Self> {
329 Self::new()
330 }
331}
332
333extern_protocol!(
334 #[cfg(feature = "MTLAllocation")]
340 pub unsafe trait MTLComputePipelineState:
341 MTLAllocation + NSObjectProtocol + Send + Sync
342 {
343 #[unsafe(method(label))]
344 #[unsafe(method_family = none)]
345 fn label(&self) -> Option<Retained<NSString>>;
346
347 #[unsafe(method(reflection))]
351 #[unsafe(method_family = none)]
352 fn reflection(&self) -> Option<Retained<MTLComputePipelineReflection>>;
353
354 #[cfg(feature = "MTLFunctionHandle")]
355 #[unsafe(method(functionHandleWithName:))]
363 #[unsafe(method_family = none)]
364 fn functionHandleWithName(
365 &self,
366 name: &NSString,
367 ) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
368
369 #[cfg(all(feature = "MTL4BinaryFunction", feature = "MTLFunctionHandle"))]
370 #[unsafe(method(functionHandleWithBinaryFunction:))]
378 #[unsafe(method_family = none)]
379 fn functionHandleWithBinaryFunction(
380 &self,
381 function: &ProtocolObject<dyn MTL4BinaryFunction>,
382 ) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
383
384 #[cfg(feature = "MTL4BinaryFunction")]
385 #[unsafe(method(newComputePipelineStateWithBinaryFunctions:error:_))]
393 #[unsafe(method_family = new)]
394 fn newComputePipelineStateWithBinaryFunctions_error(
395 &self,
396 additional_binary_functions: &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
397 ) -> Result<Retained<ProtocolObject<dyn MTLComputePipelineState>>, Retained<NSError>>;
398
399 #[cfg(feature = "MTLDevice")]
400 #[unsafe(method(device))]
402 #[unsafe(method_family = none)]
403 fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
404
405 #[unsafe(method(maxTotalThreadsPerThreadgroup))]
407 #[unsafe(method_family = none)]
408 fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
409
410 #[unsafe(method(threadExecutionWidth))]
412 #[unsafe(method_family = none)]
413 fn threadExecutionWidth(&self) -> NSUInteger;
414
415 #[unsafe(method(staticThreadgroupMemoryLength))]
417 #[unsafe(method_family = none)]
418 fn staticThreadgroupMemoryLength(&self) -> NSUInteger;
419
420 #[cfg(feature = "MTLTypes")]
421 #[unsafe(method(imageblockMemoryLengthForDimensions:))]
423 #[unsafe(method_family = none)]
424 unsafe fn imageblockMemoryLengthForDimensions(
425 &self,
426 imageblock_dimensions: MTLSize,
427 ) -> NSUInteger;
428
429 #[unsafe(method(supportIndirectCommandBuffers))]
431 #[unsafe(method_family = none)]
432 fn supportIndirectCommandBuffers(&self) -> bool;
433
434 #[cfg(feature = "MTLTypes")]
435 #[unsafe(method(gpuResourceID))]
437 #[unsafe(method_family = none)]
438 fn gpuResourceID(&self) -> MTLResourceID;
439
440 #[cfg(all(feature = "MTLFunctionHandle", feature = "MTLLibrary"))]
441 #[unsafe(method(functionHandleWithFunction:))]
443 #[unsafe(method_family = none)]
444 fn functionHandleWithFunction(
445 &self,
446 function: &ProtocolObject<dyn MTLFunction>,
447 ) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
448
449 #[cfg(feature = "MTLLibrary")]
450 #[unsafe(method(newComputePipelineStateWithAdditionalBinaryFunctions:error:_))]
452 #[unsafe(method_family = new)]
453 fn newComputePipelineStateWithAdditionalBinaryFunctions_error(
454 &self,
455 functions: &NSArray<ProtocolObject<dyn MTLFunction>>,
456 ) -> Result<Retained<ProtocolObject<dyn MTLComputePipelineState>>, Retained<NSError>>;
457
458 #[cfg(all(feature = "MTLResource", feature = "MTLVisibleFunctionTable"))]
459 #[unsafe(method(newVisibleFunctionTableWithDescriptor:))]
461 #[unsafe(method_family = new)]
462 fn newVisibleFunctionTableWithDescriptor(
463 &self,
464 descriptor: &MTLVisibleFunctionTableDescriptor,
465 ) -> Option<Retained<ProtocolObject<dyn MTLVisibleFunctionTable>>>;
466
467 #[cfg(all(feature = "MTLIntersectionFunctionTable", feature = "MTLResource"))]
468 #[unsafe(method(newIntersectionFunctionTableWithDescriptor:))]
470 #[unsafe(method_family = new)]
471 fn newIntersectionFunctionTableWithDescriptor(
472 &self,
473 descriptor: &MTLIntersectionFunctionTableDescriptor,
474 ) -> Option<Retained<ProtocolObject<dyn MTLIntersectionFunctionTable>>>;
475
476 #[cfg(feature = "MTLPipeline")]
477 #[unsafe(method(shaderValidation))]
485 #[unsafe(method_family = none)]
486 unsafe fn shaderValidation(&self) -> MTLShaderValidation;
487
488 #[cfg(feature = "MTLTypes")]
489 #[unsafe(method(requiredThreadsPerThreadgroup))]
491 #[unsafe(method_family = none)]
492 fn requiredThreadsPerThreadgroup(&self) -> MTLSize;
493 }
494);