objc2_metal/generated/MTL4Compiler.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// Groups together properties for creating a compiler context.
12 ///
13 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4compilerdescriptor?language=objc)
14 #[unsafe(super(NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 pub struct MTL4CompilerDescriptor;
17);
18
19extern_conformance!(
20 unsafe impl NSCopying for MTL4CompilerDescriptor {}
21);
22
23unsafe impl CopyingHelper for MTL4CompilerDescriptor {
24 type Result = Self;
25}
26
27extern_conformance!(
28 unsafe impl NSObjectProtocol for MTL4CompilerDescriptor {}
29);
30
31impl MTL4CompilerDescriptor {
32 extern_methods!(
33 /// Assigns an optional descriptor label to the compiler for debugging purposes.
34 #[unsafe(method(label))]
35 #[unsafe(method_family = none)]
36 pub fn label(&self) -> Option<Retained<NSString>>;
37
38 /// Setter for [`label`][Self::label].
39 ///
40 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
41 #[unsafe(method(setLabel:))]
42 #[unsafe(method_family = none)]
43 pub fn setLabel(&self, label: Option<&NSString>);
44
45 #[cfg(feature = "MTL4PipelineDataSetSerializer")]
46 /// Assigns a pipeline data set serializer into which this compiler stores data for all pipelines it creates.
47 #[unsafe(method(pipelineDataSetSerializer))]
48 #[unsafe(method_family = none)]
49 pub fn pipelineDataSetSerializer(
50 &self,
51 ) -> Option<Retained<ProtocolObject<dyn MTL4PipelineDataSetSerializer>>>;
52
53 #[cfg(feature = "MTL4PipelineDataSetSerializer")]
54 /// Setter for [`pipelineDataSetSerializer`][Self::pipelineDataSetSerializer].
55 #[unsafe(method(setPipelineDataSetSerializer:))]
56 #[unsafe(method_family = none)]
57 pub fn setPipelineDataSetSerializer(
58 &self,
59 pipeline_data_set_serializer: Option<
60 &ProtocolObject<dyn MTL4PipelineDataSetSerializer>,
61 >,
62 );
63 );
64}
65
66/// Methods declared on superclass `NSObject`.
67impl MTL4CompilerDescriptor {
68 extern_methods!(
69 #[unsafe(method(init))]
70 #[unsafe(method_family = init)]
71 pub fn init(this: Allocated<Self>) -> Retained<Self>;
72
73 #[unsafe(method(new))]
74 #[unsafe(method_family = new)]
75 pub fn new() -> Retained<Self>;
76 );
77}
78
79impl DefaultRetained for MTL4CompilerDescriptor {
80 #[inline]
81 fn default_retained() -> Retained<Self> {
82 Self::new()
83 }
84}
85
86extern_class!(
87 /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4compilertaskoptions?language=objc)
88 #[unsafe(super(NSObject))]
89 #[derive(Debug, PartialEq, Eq, Hash)]
90 pub struct MTL4CompilerTaskOptions;
91);
92
93extern_conformance!(
94 unsafe impl NSCopying for MTL4CompilerTaskOptions {}
95);
96
97unsafe impl CopyingHelper for MTL4CompilerTaskOptions {
98 type Result = Self;
99}
100
101extern_conformance!(
102 unsafe impl NSObjectProtocol for MTL4CompilerTaskOptions {}
103);
104
105impl MTL4CompilerTaskOptions {
106 extern_methods!(
107 #[cfg(feature = "MTL4Archive")]
108 /// Specifies a set of archive instances this compilation process uses for accelerating the build process.
109 ///
110 /// In case of a match in the archive, the compiler can skip one or more compilation tasks, speeding up the build process.
111 #[unsafe(method(lookupArchives))]
112 #[unsafe(method_family = none)]
113 pub fn lookupArchives(&self) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4Archive>>>>;
114
115 #[cfg(feature = "MTL4Archive")]
116 /// Setter for [`lookupArchives`][Self::lookupArchives].
117 ///
118 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
119 #[unsafe(method(setLookupArchives:))]
120 #[unsafe(method_family = none)]
121 pub fn setLookupArchives(
122 &self,
123 lookup_archives: Option<&NSArray<ProtocolObject<dyn MTL4Archive>>>,
124 );
125 );
126}
127
128/// Methods declared on superclass `NSObject`.
129impl MTL4CompilerTaskOptions {
130 extern_methods!(
131 #[unsafe(method(init))]
132 #[unsafe(method_family = init)]
133 pub fn init(this: Allocated<Self>) -> Retained<Self>;
134
135 #[unsafe(method(new))]
136 #[unsafe(method_family = new)]
137 pub fn new() -> Retained<Self>;
138 );
139}
140
141impl DefaultRetained for MTL4CompilerTaskOptions {
142 #[inline]
143 fn default_retained() -> Retained<Self> {
144 Self::new()
145 }
146}
147
148/// Provides a signature for a callback block that Metal calls when the compiler finishes a build task for a binary function.
149///
150/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4newbinaryfunctioncompletionhandler?language=objc)
151#[cfg(all(feature = "MTL4BinaryFunction", feature = "block2"))]
152pub type MTL4NewBinaryFunctionCompletionHandler =
153 *mut block2::DynBlock<dyn Fn(*mut ProtocolObject<dyn MTL4BinaryFunction>, *mut NSError)>;
154
155/// Provides a signature for a callback block that Metal calls when the compiler finishes a build task for a machine learning pipeline state.
156///
157/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4newmachinelearningpipelinestatecompletionhandler?language=objc)
158#[cfg(all(
159 feature = "MTL4MachineLearningPipeline",
160 feature = "MTLAllocation",
161 feature = "block2"
162))]
163pub type MTL4NewMachineLearningPipelineStateCompletionHandler = *mut block2::DynBlock<
164 dyn Fn(*mut ProtocolObject<dyn MTL4MachineLearningPipelineState>, *mut NSError),
165>;
166
167extern_protocol!(
168 /// A abstraction for a pipeline state and shader function compiler.
169 ///
170 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4compiler?language=objc)
171 pub unsafe trait MTL4Compiler: NSObjectProtocol + Send + Sync {
172 #[cfg(feature = "MTLDevice")]
173 /// Returns the device that this compiler belongs to.
174 #[unsafe(method(device))]
175 #[unsafe(method_family = none)]
176 fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
177
178 /// Returns the optional label you specify at creation time.
179 #[unsafe(method(label))]
180 #[unsafe(method_family = none)]
181 fn label(&self) -> Option<Retained<NSString>>;
182
183 #[cfg(feature = "MTL4PipelineDataSetSerializer")]
184 /// Returns the pipeline data set serializer into which this compiler stores data for all pipelines it creates.
185 #[unsafe(method(pipelineDataSetSerializer))]
186 #[unsafe(method_family = none)]
187 fn pipelineDataSetSerializer(
188 &self,
189 ) -> Option<Retained<ProtocolObject<dyn MTL4PipelineDataSetSerializer>>>;
190
191 #[cfg(all(feature = "MTL4LibraryDescriptor", feature = "MTLLibrary"))]
192 /// Creates a new Metal library synchronously.
193 ///
194 /// - Parameters:
195 /// - descriptor: A description of the library to create.
196 /// - error: An optional parameter into which Metal stores information in case of an error.
197 ///
198 /// - Returns: a Metal library instance upon success, `nil` otherwise.
199 #[unsafe(method(newLibraryWithDescriptor:error:_))]
200 #[unsafe(method_family = new)]
201 fn newLibraryWithDescriptor_error(
202 &self,
203 descriptor: &MTL4LibraryDescriptor,
204 ) -> Result<Retained<ProtocolObject<dyn MTLLibrary>>, Retained<NSError>>;
205
206 #[cfg(all(feature = "MTLDynamicLibrary", feature = "MTLLibrary"))]
207 /// Creates a new dynamic library from a library containing Metal IR code synchronously.
208 ///
209 /// - Parameters:
210 /// - library: A library from which this compiler creates the new a dynamic library
211 /// - error: An optional parameter into which Metal stores information in case of an error.
212 ///
213 /// - Returns: A new dynamic Metal library upon success, `nil` otherwise.
214 #[unsafe(method(newDynamicLibrary:error:_))]
215 #[unsafe(method_family = new)]
216 fn newDynamicLibrary_error(
217 &self,
218 library: &ProtocolObject<dyn MTLLibrary>,
219 ) -> Result<Retained<ProtocolObject<dyn MTLDynamicLibrary>>, Retained<NSError>>;
220
221 #[cfg(feature = "MTLDynamicLibrary")]
222 /// Creates a new dynamic library from the contents of a file at an URL location synchronously.
223 ///
224 /// - Parameters:
225 /// - url: An URL referencing a file whose contents this compiler uses to build a dynamic library.
226 /// - error: An optional parameter into which Metal stores information in case of an error.
227 ///
228 /// - Returns: A new dynamic Metal library upon success, `nil` otherwise.
229 #[unsafe(method(newDynamicLibraryWithURL:error:_))]
230 #[unsafe(method_family = new)]
231 fn newDynamicLibraryWithURL_error(
232 &self,
233 url: &NSURL,
234 ) -> Result<Retained<ProtocolObject<dyn MTLDynamicLibrary>>, Retained<NSError>>;
235
236 #[cfg(all(
237 feature = "MTL4ComputePipeline",
238 feature = "MTL4PipelineState",
239 feature = "MTLAllocation",
240 feature = "MTLComputePipeline"
241 ))]
242 /// Creates a new compute pipeline state object synchronously.
243 ///
244 /// - Parameters:
245 /// - descriptor: A compute pipeline state descriptor describing the pipeline this compiler creates.
246 /// - compilerTaskOptions: A description of the compilation process itself, providing parameters that
247 /// influence execution of the compilation process.
248 /// - error: An optional parameter into which Metal stores information in case of an error.
249 ///
250 /// - Returns: A new compute pipeline state object upon success, `nil` otherwise.
251 #[unsafe(method(newComputePipelineStateWithDescriptor:compilerTaskOptions:error:_))]
252 #[unsafe(method_family = new)]
253 fn newComputePipelineStateWithDescriptor_compilerTaskOptions_error(
254 &self,
255 descriptor: &MTL4ComputePipelineDescriptor,
256 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
257 ) -> Result<Retained<ProtocolObject<dyn MTLComputePipelineState>>, Retained<NSError>>;
258
259 #[cfg(all(
260 feature = "MTL4ComputePipeline",
261 feature = "MTL4LinkingDescriptor",
262 feature = "MTL4PipelineState",
263 feature = "MTLAllocation",
264 feature = "MTLComputePipeline"
265 ))]
266 /// Creates a new compute pipeline state synchronously.
267 ///
268 /// - Parameters:
269 /// - descriptor: A compute pipeline state descriptor describing the pipeline this compiler creates.
270 /// - dynamicLinkingDescriptor: An optional parameter that provides additional configuration for linking the pipeline state object.
271 /// - compilerTaskOptions: A description of the compilation process itself, providing parameters that
272 /// influence execution of the compilation process.
273 /// - error: An optional parameter into which Metal stores information in case of an error.
274 ///
275 /// - Returns: A new compute pipeline state object upon success, `nil` otherwise.
276 #[unsafe(method(newComputePipelineStateWithDescriptor:dynamicLinkingDescriptor:compilerTaskOptions:error:_))]
277 #[unsafe(method_family = new)]
278 fn newComputePipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_error(
279 &self,
280 descriptor: &MTL4ComputePipelineDescriptor,
281 dynamic_linking_descriptor: Option<&MTL4PipelineStageDynamicLinkingDescriptor>,
282 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
283 ) -> Result<Retained<ProtocolObject<dyn MTLComputePipelineState>>, Retained<NSError>>;
284
285 #[cfg(all(
286 feature = "MTL4PipelineState",
287 feature = "MTLAllocation",
288 feature = "MTLRenderPipeline"
289 ))]
290 /// Creates a new render pipeline state synchronously.
291 ///
292 /// Use this method to build any render pipeline type, including render, tile, and mesh render pipeline states.
293 /// The type of the descriptor you pass indicates the pipeline type this method builds.
294 ///
295 /// Passing in a compute pipeline descriptor to the `descriptor` parameter produces an error.
296 ///
297 /// - Parameters:
298 /// - descriptor: A render, tile, or mesh pipeline state descriptor that describes the pipeline to create.
299 /// - compilerTaskOptions: A description of the compilation process itself, providing parameters that
300 /// influence execution of the compilation process.
301 /// - error: An optional parameter into which Metal stores information in case of an error.
302 ///
303 /// - Returns: A new render pipeline state object upon success, `nil` otherwise.
304 #[unsafe(method(newRenderPipelineStateWithDescriptor:compilerTaskOptions:error:_))]
305 #[unsafe(method_family = new)]
306 fn newRenderPipelineStateWithDescriptor_compilerTaskOptions_error(
307 &self,
308 descriptor: &MTL4PipelineDescriptor,
309 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
310 ) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
311
312 #[cfg(all(
313 feature = "MTL4LinkingDescriptor",
314 feature = "MTL4PipelineState",
315 feature = "MTLAllocation",
316 feature = "MTLRenderPipeline"
317 ))]
318 /// Creates a new render pipeline state synchronously.
319 ///
320 /// Use this method to build any render pipeline type, including render, tile, and mesh render pipeline states.
321 /// The type of the descriptor you pass indicates the pipeline type this method builds.
322 ///
323 /// Passing in a compute pipeline descriptor to the `descriptor` parameter produces an error.
324 ///
325 /// - Parameters:
326 /// - descriptor: A render, tile, or mesh pipeline state descriptor that describes the pipeline to create.
327 /// - dynamicLinkingDescriptor: An optional parameter that provides additional configuration for linking the pipeline state object.
328 /// - compilerTaskOptions: A description of the compilation process itself, providing parameters that
329 /// influence execution of the compilation process.
330 /// - error: An optional parameter into which Metal stores information in case of an error.
331 ///
332 /// - Returns: A new render pipeline state object upon success, `nil` otherwise.
333 #[unsafe(method(newRenderPipelineStateWithDescriptor:dynamicLinkingDescriptor:compilerTaskOptions:error:_))]
334 #[unsafe(method_family = new)]
335 fn newRenderPipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_error(
336 &self,
337 descriptor: &MTL4PipelineDescriptor,
338 dynamic_linking_descriptor: Option<&MTL4RenderPipelineDynamicLinkingDescriptor>,
339 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
340 ) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
341
342 #[cfg(all(
343 feature = "MTL4PipelineState",
344 feature = "MTLAllocation",
345 feature = "MTLRenderPipeline"
346 ))]
347 /// Creates a new render pipeline state from another, previously unspecialized, pipeline state.
348 ///
349 /// Metal specializes the pipeline state with new state values the descriptor provides, observing the following rules:
350 /// * The compiler only updates properties that were originally specified as *unspecialized*. It doesn't modify other
351 /// already-specialized properties
352 /// * The compiler sets to their default behavior any unspecialized properties that your passed-in descriptor doesn't specialize
353 ///
354 /// Additionally, there are some cases where the Metal can't specialize a pipeline:
355 /// * If the original pipeline state object doesn't have any unspecialized properties
356 /// * You can't re-specialize a previously specialized pipeline state object
357 ///
358 /// - Parameters:
359 /// - descriptor: A render pipeline state descriptor or any type: default, tile, or mesh render pipeline descriptor.
360 /// - pipeline: A render pipeline state containing unspecialized substate.
361 /// - error: An optional parameter into which Metal stores information in case of an error.
362 ///
363 /// - Returns: a fully-specialized pipeline state object.
364 #[unsafe(method(newRenderPipelineStateBySpecializationWithDescriptor:pipeline:error:_))]
365 #[unsafe(method_family = new)]
366 fn newRenderPipelineStateBySpecializationWithDescriptor_pipeline_error(
367 &self,
368 descriptor: &MTL4PipelineDescriptor,
369 pipeline: &ProtocolObject<dyn MTLRenderPipelineState>,
370 ) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
371
372 #[cfg(all(
373 feature = "MTL4BinaryFunction",
374 feature = "MTL4BinaryFunctionDescriptor"
375 ))]
376 /// Creates a new binary visible or intersection function synchronously.
377 ///
378 /// - Parameters:
379 /// - descriptor: A binary function descriptor to use for creating the binary function.
380 /// - compilerTaskOptions: A descriptor of the compilation itself, providing parameters that
381 /// influence execution of the compilation process.
382 /// - error: An optional parameter into which Metal stores information in case of an error.
383 ///
384 /// - Returns: a new binary function upon success, `nil` otherwise.
385 #[unsafe(method(newBinaryFunctionWithDescriptor:compilerTaskOptions:error:_))]
386 #[unsafe(method_family = new)]
387 fn newBinaryFunctionWithDescriptor_compilerTaskOptions_error(
388 &self,
389 descriptor: &MTL4BinaryFunctionDescriptor,
390 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
391 ) -> Result<Retained<ProtocolObject<dyn MTL4BinaryFunction>>, Retained<NSError>>;
392
393 #[cfg(all(
394 feature = "MTL4CompilerTask",
395 feature = "MTL4LibraryDescriptor",
396 feature = "MTLLibrary",
397 feature = "block2"
398 ))]
399 /// Creates a new Metal library instance asynchronously.
400 ///
401 /// - Parameters:
402 /// - descriptor: A description of the library to create.
403 /// - completionHandler: A block Metal calls when it finishes the build task.
404 ///
405 /// - Returns: a compiler task representing the asynchronous compilation task.
406 ///
407 /// # Safety
408 ///
409 /// `completion_handler` must be a valid pointer.
410 #[unsafe(method(newLibraryWithDescriptor:completionHandler:))]
411 #[unsafe(method_family = new)]
412 unsafe fn newLibraryWithDescriptor_completionHandler(
413 &self,
414 descriptor: &MTL4LibraryDescriptor,
415 completion_handler: MTLNewLibraryCompletionHandler,
416 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
417
418 #[cfg(all(
419 feature = "MTL4CompilerTask",
420 feature = "MTLDynamicLibrary",
421 feature = "MTLLibrary",
422 feature = "block2"
423 ))]
424 /// Creates a new dynamic Metal library instance asynchronously.
425 ///
426 /// - Parameters:
427 /// - library: A library from which this compiler creates the new a dynamic library
428 /// - completionHandler: A block Metal calls when it finishes the build task.
429 ///
430 /// - Returns: A compiler task representing the asynchronous compilation task.
431 ///
432 /// # Safety
433 ///
434 /// `completion_handler` must be a valid pointer.
435 #[unsafe(method(newDynamicLibrary:completionHandler:))]
436 #[unsafe(method_family = new)]
437 unsafe fn newDynamicLibrary_completionHandler(
438 &self,
439 library: &ProtocolObject<dyn MTLLibrary>,
440 completion_handler: MTLNewDynamicLibraryCompletionHandler,
441 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
442
443 #[cfg(all(
444 feature = "MTL4CompilerTask",
445 feature = "MTLDynamicLibrary",
446 feature = "MTLLibrary",
447 feature = "block2"
448 ))]
449 /// Creates a new dynamic library from the contents of a file at an URL location synchronously.
450 ///
451 /// - Parameters:
452 /// - url: An URL referencing a file whose contents this compiler uses to build a dynamic library.
453 /// - completionHandler: A block Metal calls when it finishes the build task.
454 ///
455 /// - Returns: a compiler task representing the asynchronous compilation task.
456 ///
457 /// # Safety
458 ///
459 /// `completion_handler` must be a valid pointer.
460 #[unsafe(method(newDynamicLibraryWithURL:completionHandler:))]
461 #[unsafe(method_family = new)]
462 unsafe fn newDynamicLibraryWithURL_completionHandler(
463 &self,
464 url: &NSURL,
465 completion_handler: MTLNewDynamicLibraryCompletionHandler,
466 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
467
468 #[cfg(all(
469 feature = "MTL4CompilerTask",
470 feature = "MTL4ComputePipeline",
471 feature = "MTL4PipelineState",
472 feature = "MTLAllocation",
473 feature = "MTLComputePipeline",
474 feature = "MTLLibrary",
475 feature = "block2"
476 ))]
477 /// Creates a new compute pipeline state asynchronously.
478 ///
479 /// - Parameters:
480 /// - descriptor: A compute pipeline state descriptor, describing the compute pipeline to create.
481 /// - compilerTaskOptions: A descriptor of the compilation itself, providing parameters that
482 /// influence execution of the compilation process.
483 /// - completionHandler: A block Metal calls when it finishes the build task.
484 ///
485 /// - Returns: a compiler task representing the asynchronous compilation task.
486 ///
487 /// # Safety
488 ///
489 /// `completion_handler` must be a valid pointer.
490 #[unsafe(method(newComputePipelineStateWithDescriptor:compilerTaskOptions:completionHandler:))]
491 #[unsafe(method_family = new)]
492 unsafe fn newComputePipelineStateWithDescriptor_compilerTaskOptions_completionHandler(
493 &self,
494 descriptor: &MTL4ComputePipelineDescriptor,
495 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
496 completion_handler: MTLNewComputePipelineStateCompletionHandler,
497 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
498
499 #[cfg(all(
500 feature = "MTL4CompilerTask",
501 feature = "MTL4ComputePipeline",
502 feature = "MTL4LinkingDescriptor",
503 feature = "MTL4PipelineState",
504 feature = "MTLAllocation",
505 feature = "MTLComputePipeline",
506 feature = "MTLLibrary",
507 feature = "block2"
508 ))]
509 /// Creates a new compute pipeline state asynchronously.
510 ///
511 /// - Parameters:
512 /// - descriptor: A compute pipeline state descriptor, describing the compute pipeline to create.
513 /// - dynamicLinkingDescriptor: An optional parameter that provides additional configuration for linking the pipeline state object.
514 /// - compilerTaskOptions: A description of the compilation process itself, providing parameters that
515 /// influence execution of the compilation process.
516 /// - completionHandler: A block Metal calls when it finishes the build task.
517 ///
518 /// - Returns: a compiler task representing the asynchronous compilation task.
519 ///
520 /// # Safety
521 ///
522 /// `completion_handler` must be a valid pointer.
523 #[unsafe(method(newComputePipelineStateWithDescriptor:dynamicLinkingDescriptor:compilerTaskOptions:completionHandler:))]
524 #[unsafe(method_family = new)]
525 unsafe fn newComputePipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_completionHandler(
526 &self,
527 descriptor: &MTL4ComputePipelineDescriptor,
528 dynamic_linking_descriptor: Option<&MTL4PipelineStageDynamicLinkingDescriptor>,
529 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
530 completion_handler: MTLNewComputePipelineStateCompletionHandler,
531 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
532
533 #[cfg(all(
534 feature = "MTL4CompilerTask",
535 feature = "MTL4PipelineState",
536 feature = "MTLAllocation",
537 feature = "MTLLibrary",
538 feature = "MTLRenderPipeline",
539 feature = "block2"
540 ))]
541 /// Creates a new render pipeline state asynchronously.
542 ///
543 /// Use this method to build any render pipeline type, including render, tile, and mesh render pipeline states.
544 /// The type of the descriptor you pass indicates the pipeline type this method builds.
545 ///
546 /// Passing in a compute pipeline descriptor to the `descriptor` parameter produces an error.
547 ///
548 /// - Parameters:
549 /// - descriptor: A render, tile, or mesh pipeline state descriptor that describes the pipeline to create.
550 /// - compilerTaskOptions: A description of the compilation process itself, providing parameters that
551 /// influence execution of the compilation process.
552 /// - completionHandler: A block Metal calls when it finishes the build task.
553 ///
554 /// - Returns: a compiler task representing the asynchronous compilation task.
555 ///
556 /// # Safety
557 ///
558 /// `completion_handler` must be a valid pointer.
559 #[unsafe(method(newRenderPipelineStateWithDescriptor:compilerTaskOptions:completionHandler:))]
560 #[unsafe(method_family = new)]
561 unsafe fn newRenderPipelineStateWithDescriptor_compilerTaskOptions_completionHandler(
562 &self,
563 descriptor: &MTL4PipelineDescriptor,
564 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
565 completion_handler: MTLNewRenderPipelineStateCompletionHandler,
566 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
567
568 #[cfg(all(
569 feature = "MTL4CompilerTask",
570 feature = "MTL4LinkingDescriptor",
571 feature = "MTL4PipelineState",
572 feature = "MTLAllocation",
573 feature = "MTLLibrary",
574 feature = "MTLRenderPipeline",
575 feature = "block2"
576 ))]
577 /// Creates a new render pipeline state asynchronously.
578 ///
579 /// Use this method to build any render pipeline type, including render, tile, and mesh render pipeline states.
580 /// The type of the descriptor you pass indicates the pipeline type this method builds.
581 ///
582 /// Passing in a compute pipeline descriptor to the `descriptor` parameter produces an error.
583 ///
584 /// - Parameters:
585 /// - descriptor: A render, tile, or mesh pipeline state descriptor that describes the pipeline to create.
586 /// - dynamicLinkingDescriptor: An optional parameter that provides additional configuration for linking the pipeline state object.
587 /// - compilerTaskOptions: A description of the compilation process itself, providing parameters that
588 /// influence execution of the compilation process.
589 /// - completionHandler: A block Metal calls when it finishes the build task.
590 ///
591 /// - Returns: a compiler task representing the asynchronous compilation task.
592 ///
593 /// # Safety
594 ///
595 /// `completion_handler` must be a valid pointer.
596 #[unsafe(method(newRenderPipelineStateWithDescriptor:dynamicLinkingDescriptor:compilerTaskOptions:completionHandler:))]
597 #[unsafe(method_family = new)]
598 unsafe fn newRenderPipelineStateWithDescriptor_dynamicLinkingDescriptor_compilerTaskOptions_completionHandler(
599 &self,
600 descriptor: &MTL4PipelineDescriptor,
601 dynamic_linking_descriptor: Option<&MTL4RenderPipelineDynamicLinkingDescriptor>,
602 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
603 completion_handler: MTLNewRenderPipelineStateCompletionHandler,
604 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
605
606 #[cfg(all(
607 feature = "MTL4CompilerTask",
608 feature = "MTL4PipelineState",
609 feature = "MTLAllocation",
610 feature = "MTLLibrary",
611 feature = "MTLRenderPipeline",
612 feature = "block2"
613 ))]
614 /// Creates a new render pipeline state from another, previously unspecialized, pipeline state
615 ///
616 /// Metal specializes the pipeline state with new state values the descriptor provides, observing the following rules:
617 /// * The compiler only updates properties that were originally specified as *unspecialized*. It doesn't modify other
618 /// already-specialized properties
619 /// * The compiler sets to their default behavior any unspecialized properties that your passed-in descriptor doesn't specialize
620 ///
621 /// Additionally, there are some cases where the Metal can't specialize a pipeline:
622 /// * If the original pipeline state object doesn't have any unspecialized properties
623 /// * You can't re-specialize a previosuly specialized pipeline state object
624 ///
625 /// - Parameters:
626 /// - descriptor: A render pipeline state descriptor or any type: default, tile, or mesh render pipeline descriptor.
627 /// - pipeline: A render pipeline state containing unspecialized substate.
628 /// - completionHandler: A block Metal calls when it finishes the build task.
629 ///
630 /// - Returns: a compiler task representing the asynchronous compilation task.
631 ///
632 /// # Safety
633 ///
634 /// `completion_handler` must be a valid pointer.
635 #[unsafe(method(newRenderPipelineStateBySpecializationWithDescriptor:pipeline:completionHandler:))]
636 #[unsafe(method_family = new)]
637 unsafe fn newRenderPipelineStateBySpecializationWithDescriptor_pipeline_completionHandler(
638 &self,
639 descriptor: &MTL4PipelineDescriptor,
640 pipeline: &ProtocolObject<dyn MTLRenderPipelineState>,
641 completion_handler: MTLNewRenderPipelineStateCompletionHandler,
642 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
643
644 #[cfg(all(
645 feature = "MTL4BinaryFunction",
646 feature = "MTL4BinaryFunctionDescriptor",
647 feature = "MTL4CompilerTask",
648 feature = "block2"
649 ))]
650 /// Creates a new binary visible/intersection function asynchronously.
651 /// - Parameters:
652 /// - descriptor: a binary function descriptor used to create the binary function.
653 /// - compilerTaskOptions: a descriptor of the compilation itself, providing parameters to
654 /// influence execution of this compilation, but not the resulting object.
655 /// - completionHandler: a callback used on task completion.
656 /// - Returns: a compiler task indicating the asynchronous compilation job.
657 ///
658 /// # Safety
659 ///
660 /// `completion_handler` must be a valid pointer.
661 #[unsafe(method(newBinaryFunctionWithDescriptor:compilerTaskOptions:completionHandler:))]
662 #[unsafe(method_family = new)]
663 unsafe fn newBinaryFunctionWithDescriptor_compilerTaskOptions_completionHandler(
664 &self,
665 descriptor: &MTL4BinaryFunctionDescriptor,
666 compiler_task_options: Option<&MTL4CompilerTaskOptions>,
667 completion_handler: MTL4NewBinaryFunctionCompletionHandler,
668 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
669
670 #[cfg(all(
671 feature = "MTL4MachineLearningPipeline",
672 feature = "MTL4PipelineState",
673 feature = "MTLAllocation"
674 ))]
675 /// Creates a new ML pipeline state with descriptor.
676 ///
677 /// - Parameters:
678 /// - descriptor: A machine learning pipeline state descriptor to use for creating the new pipeline state.
679 /// - error: An optional parameter into which Metal stores information in case of an error.
680 ///
681 /// - Returns: A machine learning pipeline state if operation is successful, otherwise `nil`.
682 #[unsafe(method(newMachineLearningPipelineStateWithDescriptor:error:_))]
683 #[unsafe(method_family = new)]
684 fn newMachineLearningPipelineStateWithDescriptor_error(
685 &self,
686 descriptor: &MTL4MachineLearningPipelineDescriptor,
687 ) -> Result<Retained<ProtocolObject<dyn MTL4MachineLearningPipelineState>>, Retained<NSError>>;
688
689 #[cfg(all(
690 feature = "MTL4CompilerTask",
691 feature = "MTL4MachineLearningPipeline",
692 feature = "MTL4PipelineState",
693 feature = "MTLAllocation",
694 feature = "block2"
695 ))]
696 /// Creates a new machine learning pipeline state asynchronously.
697 ///
698 /// - Parameters:
699 /// - descriptor: A machine learning pipeline state descriptor to use for creating the new pipeline state.
700 /// - completionHandler: A block Metal calls when it finishes the build task.
701 ///
702 /// - Returns: a compiler task representing the asynchronous compilation task.
703 ///
704 /// # Safety
705 ///
706 /// `completion_handler` must be a valid pointer.
707 #[unsafe(method(newMachineLearningPipelineStateWithDescriptor:completionHandler:))]
708 #[unsafe(method_family = new)]
709 unsafe fn newMachineLearningPipelineStateWithDescriptor_completionHandler(
710 &self,
711 descriptor: &MTL4MachineLearningPipelineDescriptor,
712 completion_handler: MTL4NewMachineLearningPipelineStateCompletionHandler,
713 ) -> Retained<ProtocolObject<dyn MTL4CompilerTask>>;
714 }
715);