objc2_metal/generated/
MTLFunctionStitching.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
10/// A bitfield of options to create a stitched library
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlstitchedlibraryoptions?language=objc)
13// NS_OPTIONS
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct MTLStitchedLibraryOptions(pub NSUInteger);
17bitflags::bitflags! {
18    impl MTLStitchedLibraryOptions: NSUInteger {
19        #[doc(alias = "MTLStitchedLibraryOptionNone")]
20        const None = 0;
21/// Library creation fails (i.e nil is returned) if:
22/// - A lookup binary archive has been specified
23/// - The library has not been found in the archive
24        #[doc(alias = "MTLStitchedLibraryOptionFailOnBinaryArchiveMiss")]
25        const FailOnBinaryArchiveMiss = 1<<0;
26/// stores and tracks this library in a Metal Pipelines Script
27/// This flag is optional and only supported in the context of binary archives.
28///
29/// This flag is required for inspecting and consuming binary archives with stitched libraries via the metal-source tool. It is not required for recompilation, nor for storing stitched libraries in binary archives. Set this flag only if you intend to use metal-source on a serialized binary archive.
30        #[doc(alias = "MTLStitchedLibraryOptionStoreLibraryInMetalPipelinesScript")]
31        const StoreLibraryInMetalPipelinesScript = 1<<1;
32    }
33}
34
35unsafe impl Encode for MTLStitchedLibraryOptions {
36    const ENCODING: Encoding = NSUInteger::ENCODING;
37}
38
39unsafe impl RefEncode for MTLStitchedLibraryOptions {
40    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43extern_protocol!(
44    /// An attribute to be applied to the produced stitched function.
45    ///
46    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlfunctionstitchingattribute?language=objc)
47    pub unsafe trait MTLFunctionStitchingAttribute: NSObjectProtocol {}
48);
49
50extern_class!(
51    /// Applies the `__attribute__((always_inline))` attribute to the produced stitched function.
52    ///
53    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlfunctionstitchingattributealwaysinline?language=objc)
54    #[unsafe(super(NSObject))]
55    #[derive(Debug, PartialEq, Eq, Hash)]
56    pub struct MTLFunctionStitchingAttributeAlwaysInline;
57);
58
59extern_conformance!(
60    unsafe impl MTLFunctionStitchingAttribute for MTLFunctionStitchingAttributeAlwaysInline {}
61);
62
63extern_conformance!(
64    unsafe impl NSObjectProtocol for MTLFunctionStitchingAttributeAlwaysInline {}
65);
66
67impl MTLFunctionStitchingAttributeAlwaysInline {
68    extern_methods!();
69}
70
71/// Methods declared on superclass `NSObject`.
72impl MTLFunctionStitchingAttributeAlwaysInline {
73    extern_methods!(
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub fn new() -> Retained<Self>;
81    );
82}
83
84impl DefaultRetained for MTLFunctionStitchingAttributeAlwaysInline {
85    #[inline]
86    fn default_retained() -> Retained<Self> {
87        Self::new()
88    }
89}
90
91extern_protocol!(
92    /// A node used in a graph for stitching.
93    ///
94    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlfunctionstitchingnode?language=objc)
95    pub unsafe trait MTLFunctionStitchingNode: NSObjectProtocol + NSCopying {}
96);
97
98extern_class!(
99    /// An indexed input node of the produced stitched function.
100    ///
101    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlfunctionstitchinginputnode?language=objc)
102    #[unsafe(super(NSObject))]
103    #[derive(Debug, PartialEq, Eq, Hash)]
104    pub struct MTLFunctionStitchingInputNode;
105);
106
107extern_conformance!(
108    unsafe impl MTLFunctionStitchingNode for MTLFunctionStitchingInputNode {}
109);
110
111extern_conformance!(
112    unsafe impl NSCopying for MTLFunctionStitchingInputNode {}
113);
114
115unsafe impl CopyingHelper for MTLFunctionStitchingInputNode {
116    type Result = Self;
117}
118
119extern_conformance!(
120    unsafe impl NSObjectProtocol for MTLFunctionStitchingInputNode {}
121);
122
123impl MTLFunctionStitchingInputNode {
124    extern_methods!(
125        #[unsafe(method(argumentIndex))]
126        #[unsafe(method_family = none)]
127        pub fn argumentIndex(&self) -> NSUInteger;
128
129        /// Setter for [`argumentIndex`][Self::argumentIndex].
130        ///
131        /// # Safety
132        ///
133        /// This might not be bounds-checked.
134        #[unsafe(method(setArgumentIndex:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setArgumentIndex(&self, argument_index: NSUInteger);
137
138        /// # Safety
139        ///
140        /// This might not be bounds-checked.
141        #[unsafe(method(initWithArgumentIndex:))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn initWithArgumentIndex(
144            this: Allocated<Self>,
145            argument: NSUInteger,
146        ) -> Retained<Self>;
147    );
148}
149
150/// Methods declared on superclass `NSObject`.
151impl MTLFunctionStitchingInputNode {
152    extern_methods!(
153        #[unsafe(method(init))]
154        #[unsafe(method_family = init)]
155        pub fn init(this: Allocated<Self>) -> Retained<Self>;
156
157        #[unsafe(method(new))]
158        #[unsafe(method_family = new)]
159        pub fn new() -> Retained<Self>;
160    );
161}
162
163impl DefaultRetained for MTLFunctionStitchingInputNode {
164    #[inline]
165    fn default_retained() -> Retained<Self> {
166        Self::new()
167    }
168}
169
170extern_class!(
171    /// A function node that calls the specified function with arguments and ordering determined by data and control dependencies.
172    ///
173    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlfunctionstitchingfunctionnode?language=objc)
174    #[unsafe(super(NSObject))]
175    #[derive(Debug, PartialEq, Eq, Hash)]
176    pub struct MTLFunctionStitchingFunctionNode;
177);
178
179extern_conformance!(
180    unsafe impl MTLFunctionStitchingNode for MTLFunctionStitchingFunctionNode {}
181);
182
183extern_conformance!(
184    unsafe impl NSCopying for MTLFunctionStitchingFunctionNode {}
185);
186
187unsafe impl CopyingHelper for MTLFunctionStitchingFunctionNode {
188    type Result = Self;
189}
190
191extern_conformance!(
192    unsafe impl NSObjectProtocol for MTLFunctionStitchingFunctionNode {}
193);
194
195impl MTLFunctionStitchingFunctionNode {
196    extern_methods!(
197        #[unsafe(method(name))]
198        #[unsafe(method_family = none)]
199        pub fn name(&self) -> Retained<NSString>;
200
201        /// Setter for [`name`][Self::name].
202        ///
203        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
204        #[unsafe(method(setName:))]
205        #[unsafe(method_family = none)]
206        pub fn setName(&self, name: &NSString);
207
208        #[unsafe(method(arguments))]
209        #[unsafe(method_family = none)]
210        pub fn arguments(&self) -> Retained<NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>>;
211
212        /// Setter for [`arguments`][Self::arguments].
213        ///
214        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
215        #[unsafe(method(setArguments:))]
216        #[unsafe(method_family = none)]
217        pub fn setArguments(
218            &self,
219            arguments: &NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>,
220        );
221
222        #[unsafe(method(controlDependencies))]
223        #[unsafe(method_family = none)]
224        pub fn controlDependencies(&self) -> Retained<NSArray<MTLFunctionStitchingFunctionNode>>;
225
226        /// Setter for [`controlDependencies`][Self::controlDependencies].
227        ///
228        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
229        #[unsafe(method(setControlDependencies:))]
230        #[unsafe(method_family = none)]
231        pub fn setControlDependencies(
232            &self,
233            control_dependencies: &NSArray<MTLFunctionStitchingFunctionNode>,
234        );
235
236        #[unsafe(method(initWithName:arguments:controlDependencies:))]
237        #[unsafe(method_family = init)]
238        pub fn initWithName_arguments_controlDependencies(
239            this: Allocated<Self>,
240            name: &NSString,
241            arguments: &NSArray<ProtocolObject<dyn MTLFunctionStitchingNode>>,
242            control_dependencies: &NSArray<MTLFunctionStitchingFunctionNode>,
243        ) -> Retained<Self>;
244    );
245}
246
247/// Methods declared on superclass `NSObject`.
248impl MTLFunctionStitchingFunctionNode {
249    extern_methods!(
250        #[unsafe(method(init))]
251        #[unsafe(method_family = init)]
252        pub fn init(this: Allocated<Self>) -> Retained<Self>;
253
254        #[unsafe(method(new))]
255        #[unsafe(method_family = new)]
256        pub fn new() -> Retained<Self>;
257    );
258}
259
260impl DefaultRetained for MTLFunctionStitchingFunctionNode {
261    #[inline]
262    fn default_retained() -> Retained<Self> {
263        Self::new()
264    }
265}
266
267extern_class!(
268    /// A function graph that describes a directed acyclic graph.
269    ///
270    /// The return value of the output node will be used as the return value for the final stitched graph.
271    ///
272    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlfunctionstitchinggraph?language=objc)
273    #[unsafe(super(NSObject))]
274    #[derive(Debug, PartialEq, Eq, Hash)]
275    pub struct MTLFunctionStitchingGraph;
276);
277
278extern_conformance!(
279    unsafe impl NSCopying for MTLFunctionStitchingGraph {}
280);
281
282unsafe impl CopyingHelper for MTLFunctionStitchingGraph {
283    type Result = Self;
284}
285
286extern_conformance!(
287    unsafe impl NSObjectProtocol for MTLFunctionStitchingGraph {}
288);
289
290impl MTLFunctionStitchingGraph {
291    extern_methods!(
292        #[unsafe(method(functionName))]
293        #[unsafe(method_family = none)]
294        pub fn functionName(&self) -> Retained<NSString>;
295
296        /// Setter for [`functionName`][Self::functionName].
297        ///
298        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
299        #[unsafe(method(setFunctionName:))]
300        #[unsafe(method_family = none)]
301        pub fn setFunctionName(&self, function_name: &NSString);
302
303        #[unsafe(method(nodes))]
304        #[unsafe(method_family = none)]
305        pub fn nodes(&self) -> Retained<NSArray<MTLFunctionStitchingFunctionNode>>;
306
307        /// Setter for [`nodes`][Self::nodes].
308        ///
309        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
310        #[unsafe(method(setNodes:))]
311        #[unsafe(method_family = none)]
312        pub fn setNodes(&self, nodes: &NSArray<MTLFunctionStitchingFunctionNode>);
313
314        #[unsafe(method(outputNode))]
315        #[unsafe(method_family = none)]
316        pub fn outputNode(&self) -> Option<Retained<MTLFunctionStitchingFunctionNode>>;
317
318        /// Setter for [`outputNode`][Self::outputNode].
319        #[unsafe(method(setOutputNode:))]
320        #[unsafe(method_family = none)]
321        pub fn setOutputNode(&self, output_node: Option<&MTLFunctionStitchingFunctionNode>);
322
323        #[unsafe(method(attributes))]
324        #[unsafe(method_family = none)]
325        pub fn attributes(
326            &self,
327        ) -> Retained<NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>>;
328
329        /// Setter for [`attributes`][Self::attributes].
330        ///
331        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
332        #[unsafe(method(setAttributes:))]
333        #[unsafe(method_family = none)]
334        pub fn setAttributes(
335            &self,
336            attributes: &NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>,
337        );
338
339        #[unsafe(method(initWithFunctionName:nodes:outputNode:attributes:))]
340        #[unsafe(method_family = init)]
341        pub fn initWithFunctionName_nodes_outputNode_attributes(
342            this: Allocated<Self>,
343            function_name: &NSString,
344            nodes: &NSArray<MTLFunctionStitchingFunctionNode>,
345            output_node: Option<&MTLFunctionStitchingFunctionNode>,
346            attributes: &NSArray<ProtocolObject<dyn MTLFunctionStitchingAttribute>>,
347        ) -> Retained<Self>;
348    );
349}
350
351/// Methods declared on superclass `NSObject`.
352impl MTLFunctionStitchingGraph {
353    extern_methods!(
354        #[unsafe(method(init))]
355        #[unsafe(method_family = init)]
356        pub fn init(this: Allocated<Self>) -> Retained<Self>;
357
358        #[unsafe(method(new))]
359        #[unsafe(method_family = new)]
360        pub fn new() -> Retained<Self>;
361    );
362}
363
364impl DefaultRetained for MTLFunctionStitchingGraph {
365    #[inline]
366    fn default_retained() -> Retained<Self> {
367        Self::new()
368    }
369}
370
371extern_class!(
372    /// A container for the graphs and functions needed to create the stitched functions described by the graphs.
373    ///
374    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlstitchedlibrarydescriptor?language=objc)
375    #[unsafe(super(NSObject))]
376    #[derive(Debug, PartialEq, Eq, Hash)]
377    pub struct MTLStitchedLibraryDescriptor;
378);
379
380extern_conformance!(
381    unsafe impl NSCopying for MTLStitchedLibraryDescriptor {}
382);
383
384unsafe impl CopyingHelper for MTLStitchedLibraryDescriptor {
385    type Result = Self;
386}
387
388extern_conformance!(
389    unsafe impl NSObjectProtocol for MTLStitchedLibraryDescriptor {}
390);
391
392impl MTLStitchedLibraryDescriptor {
393    extern_methods!(
394        #[unsafe(method(functionGraphs))]
395        #[unsafe(method_family = none)]
396        pub fn functionGraphs(&self) -> Retained<NSArray<MTLFunctionStitchingGraph>>;
397
398        /// Setter for [`functionGraphs`][Self::functionGraphs].
399        ///
400        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
401        #[unsafe(method(setFunctionGraphs:))]
402        #[unsafe(method_family = none)]
403        pub fn setFunctionGraphs(&self, function_graphs: &NSArray<MTLFunctionStitchingGraph>);
404
405        #[cfg(feature = "MTLLibrary")]
406        #[unsafe(method(functions))]
407        #[unsafe(method_family = none)]
408        pub fn functions(&self) -> Retained<NSArray<ProtocolObject<dyn MTLFunction>>>;
409
410        #[cfg(feature = "MTLLibrary")]
411        /// Setter for [`functions`][Self::functions].
412        ///
413        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
414        ///
415        /// # Safety
416        ///
417        /// - `functions` generic must be safe to call.
418        /// - `functions` generic must have the correct argument and return types.
419        #[unsafe(method(setFunctions:))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn setFunctions(&self, functions: &NSArray<ProtocolObject<dyn MTLFunction>>);
422
423        #[cfg(feature = "MTLBinaryArchive")]
424        /// The array of archives to be searched.
425        ///
426        /// Binary archives to be searched for precompiled stitched libraries during the compilation of this library.
427        #[unsafe(method(binaryArchives))]
428        #[unsafe(method_family = none)]
429        pub fn binaryArchives(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>;
430
431        #[cfg(feature = "MTLBinaryArchive")]
432        /// Setter for [`binaryArchives`][Self::binaryArchives].
433        ///
434        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
435        #[unsafe(method(setBinaryArchives:))]
436        #[unsafe(method_family = none)]
437        pub fn setBinaryArchives(
438            &self,
439            binary_archives: &NSArray<ProtocolObject<dyn MTLBinaryArchive>>,
440        );
441
442        /// The options to use for this new MTLLibrary.
443        #[unsafe(method(options))]
444        #[unsafe(method_family = none)]
445        pub fn options(&self) -> MTLStitchedLibraryOptions;
446
447        /// Setter for [`options`][Self::options].
448        #[unsafe(method(setOptions:))]
449        #[unsafe(method_family = none)]
450        pub fn setOptions(&self, options: MTLStitchedLibraryOptions);
451    );
452}
453
454/// Methods declared on superclass `NSObject`.
455impl MTLStitchedLibraryDescriptor {
456    extern_methods!(
457        #[unsafe(method(init))]
458        #[unsafe(method_family = init)]
459        pub fn init(this: Allocated<Self>) -> Retained<Self>;
460
461        #[unsafe(method(new))]
462        #[unsafe(method_family = new)]
463        pub fn new() -> Retained<Self>;
464    );
465}
466
467impl DefaultRetained for MTLStitchedLibraryDescriptor {
468    #[inline]
469    fn default_retained() -> Retained<Self> {
470        Self::new()
471    }
472}