icrate/generated/Metal/
MTLLibrary.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use crate::common::*;
4use crate::Foundation::*;
5use crate::Metal::*;
6
7ns_enum!(
8    #[underlying(NSUInteger)]
9    pub enum MTLPatchType {
10        MTLPatchTypeNone = 0,
11        MTLPatchTypeTriangle = 1,
12        MTLPatchTypeQuad = 2,
13    }
14);
15
16extern_class!(
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    #[cfg(feature = "Metal_MTLVertexAttribute")]
19    pub struct MTLVertexAttribute;
20
21    #[cfg(feature = "Metal_MTLVertexAttribute")]
22    unsafe impl ClassType for MTLVertexAttribute {
23        type Super = NSObject;
24        type Mutability = InteriorMutable;
25    }
26);
27
28#[cfg(feature = "Metal_MTLVertexAttribute")]
29unsafe impl NSObjectProtocol for MTLVertexAttribute {}
30
31extern_methods!(
32    #[cfg(feature = "Metal_MTLVertexAttribute")]
33    unsafe impl MTLVertexAttribute {
34        #[cfg(feature = "Foundation_NSString")]
35        #[method_id(@__retain_semantics Other name)]
36        pub fn name(&self) -> Id<NSString>;
37
38        #[method(attributeIndex)]
39        pub fn attributeIndex(&self) -> NSUInteger;
40
41        #[method(attributeType)]
42        pub fn attributeType(&self) -> MTLDataType;
43
44        #[method(isActive)]
45        pub fn isActive(&self) -> bool;
46
47        #[method(isPatchData)]
48        pub fn isPatchData(&self) -> bool;
49
50        #[method(isPatchControlPointData)]
51        pub fn isPatchControlPointData(&self) -> bool;
52    }
53);
54
55extern_methods!(
56    /// Methods declared on superclass `NSObject`
57    #[cfg(feature = "Metal_MTLVertexAttribute")]
58    unsafe impl MTLVertexAttribute {
59        #[method_id(@__retain_semantics Init init)]
60        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
61
62        #[method_id(@__retain_semantics New new)]
63        pub unsafe fn new() -> Id<Self>;
64    }
65);
66
67extern_class!(
68    #[derive(Debug, PartialEq, Eq, Hash)]
69    #[cfg(feature = "Metal_MTLAttribute")]
70    pub struct MTLAttribute;
71
72    #[cfg(feature = "Metal_MTLAttribute")]
73    unsafe impl ClassType for MTLAttribute {
74        type Super = NSObject;
75        type Mutability = InteriorMutable;
76    }
77);
78
79#[cfg(feature = "Metal_MTLAttribute")]
80unsafe impl NSObjectProtocol for MTLAttribute {}
81
82extern_methods!(
83    #[cfg(feature = "Metal_MTLAttribute")]
84    unsafe impl MTLAttribute {
85        #[cfg(feature = "Foundation_NSString")]
86        #[method_id(@__retain_semantics Other name)]
87        pub fn name(&self) -> Id<NSString>;
88
89        #[method(attributeIndex)]
90        pub fn attributeIndex(&self) -> NSUInteger;
91
92        #[method(attributeType)]
93        pub fn attributeType(&self) -> MTLDataType;
94
95        #[method(isActive)]
96        pub fn isActive(&self) -> bool;
97
98        #[method(isPatchData)]
99        pub fn isPatchData(&self) -> bool;
100
101        #[method(isPatchControlPointData)]
102        pub fn isPatchControlPointData(&self) -> bool;
103    }
104);
105
106extern_methods!(
107    /// Methods declared on superclass `NSObject`
108    #[cfg(feature = "Metal_MTLAttribute")]
109    unsafe impl MTLAttribute {
110        #[method_id(@__retain_semantics Init init)]
111        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
112
113        #[method_id(@__retain_semantics New new)]
114        pub unsafe fn new() -> Id<Self>;
115    }
116);
117
118ns_enum!(
119    #[underlying(NSUInteger)]
120    pub enum MTLFunctionType {
121        MTLFunctionTypeVertex = 1,
122        MTLFunctionTypeFragment = 2,
123        MTLFunctionTypeKernel = 3,
124        MTLFunctionTypeVisible = 5,
125        MTLFunctionTypeIntersection = 6,
126        MTLFunctionTypeMesh = 7,
127        MTLFunctionTypeObject = 8,
128    }
129);
130
131extern_class!(
132    #[derive(Debug, PartialEq, Eq, Hash)]
133    #[cfg(feature = "Metal_MTLFunctionConstant")]
134    pub struct MTLFunctionConstant;
135
136    #[cfg(feature = "Metal_MTLFunctionConstant")]
137    unsafe impl ClassType for MTLFunctionConstant {
138        type Super = NSObject;
139        type Mutability = InteriorMutable;
140    }
141);
142
143#[cfg(feature = "Metal_MTLFunctionConstant")]
144unsafe impl NSObjectProtocol for MTLFunctionConstant {}
145
146extern_methods!(
147    #[cfg(feature = "Metal_MTLFunctionConstant")]
148    unsafe impl MTLFunctionConstant {
149        #[cfg(feature = "Foundation_NSString")]
150        #[method_id(@__retain_semantics Other name)]
151        pub fn name(&self) -> Id<NSString>;
152
153        #[method(type)]
154        pub unsafe fn r#type(&self) -> MTLDataType;
155
156        #[method(index)]
157        pub fn index(&self) -> NSUInteger;
158
159        #[method(required)]
160        pub fn required(&self) -> bool;
161    }
162);
163
164extern_methods!(
165    /// Methods declared on superclass `NSObject`
166    #[cfg(feature = "Metal_MTLFunctionConstant")]
167    unsafe impl MTLFunctionConstant {
168        #[method_id(@__retain_semantics Init init)]
169        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
170
171        #[method_id(@__retain_semantics New new)]
172        pub unsafe fn new() -> Id<Self>;
173    }
174);
175
176extern_protocol!(
177    pub unsafe trait MTLFunction: NSObjectProtocol {
178        #[cfg(feature = "Foundation_NSString")]
179        #[method_id(@__retain_semantics Other label)]
180        fn label(&self) -> Option<Id<NSString>>;
181
182        #[cfg(feature = "Foundation_NSString")]
183        #[method(setLabel:)]
184        fn setLabel(&self, label: Option<&NSString>);
185
186        #[method_id(@__retain_semantics Other device)]
187        fn device(&self) -> Id<ProtocolObject<dyn MTLDevice>>;
188
189        #[method(functionType)]
190        fn functionType(&self) -> MTLFunctionType;
191
192        #[method(patchType)]
193        fn patchType(&self) -> MTLPatchType;
194
195        #[method(patchControlPointCount)]
196        fn patchControlPointCount(&self) -> NSInteger;
197
198        #[cfg(all(feature = "Foundation_NSArray", feature = "Metal_MTLVertexAttribute"))]
199        #[method_id(@__retain_semantics Other vertexAttributes)]
200        fn vertexAttributes(&self) -> Option<Id<NSArray<MTLVertexAttribute>>>;
201
202        #[cfg(all(feature = "Foundation_NSArray", feature = "Metal_MTLAttribute"))]
203        #[method_id(@__retain_semantics Other stageInputAttributes)]
204        fn stageInputAttributes(&self) -> Option<Id<NSArray<MTLAttribute>>>;
205
206        #[cfg(feature = "Foundation_NSString")]
207        #[method_id(@__retain_semantics Other name)]
208        fn name(&self) -> Id<NSString>;
209
210        #[cfg(all(
211            feature = "Foundation_NSDictionary",
212            feature = "Foundation_NSString",
213            feature = "Metal_MTLFunctionConstant"
214        ))]
215        #[method_id(@__retain_semantics Other functionConstantsDictionary)]
216        fn functionConstantsDictionary(&self) -> Id<NSDictionary<NSString, MTLFunctionConstant>>;
217
218        #[method_id(@__retain_semantics New newArgumentEncoderWithBufferIndex:)]
219        unsafe fn newArgumentEncoderWithBufferIndex(
220            &self,
221            buffer_index: NSUInteger,
222        ) -> Id<ProtocolObject<dyn MTLArgumentEncoder>>;
223
224        #[method(options)]
225        fn options(&self) -> MTLFunctionOptions;
226    }
227
228    unsafe impl ProtocolType for dyn MTLFunction {}
229);
230
231ns_enum!(
232    #[underlying(NSUInteger)]
233    pub enum MTLLanguageVersion {
234        #[deprecated = "Use a newer language standard"]
235        MTLLanguageVersion1_0 = 1 << 16,
236        MTLLanguageVersion1_1 = (1 << 16) + 1,
237        MTLLanguageVersion1_2 = (1 << 16) + 2,
238        MTLLanguageVersion2_0 = 2 << 16,
239        MTLLanguageVersion2_1 = (2 << 16) + 1,
240        MTLLanguageVersion2_2 = (2 << 16) + 2,
241        MTLLanguageVersion2_3 = (2 << 16) + 3,
242        MTLLanguageVersion2_4 = (2 << 16) + 4,
243        MTLLanguageVersion3_0 = (3 << 16) + 0,
244        MTLLanguageVersion3_1 = (3 << 16) + 1,
245    }
246);
247
248ns_enum!(
249    #[underlying(NSInteger)]
250    pub enum MTLLibraryType {
251        MTLLibraryTypeExecutable = 0,
252        MTLLibraryTypeDynamic = 1,
253    }
254);
255
256ns_enum!(
257    #[underlying(NSInteger)]
258    pub enum MTLLibraryOptimizationLevel {
259        MTLLibraryOptimizationLevelDefault = 0,
260        MTLLibraryOptimizationLevelSize = 1,
261    }
262);
263
264ns_enum!(
265    #[underlying(NSInteger)]
266    pub enum MTLCompileSymbolVisibility {
267        MTLCompileSymbolVisibilityDefault = 0,
268        MTLCompileSymbolVisibilityHidden = 1,
269    }
270);
271
272extern_class!(
273    #[derive(Debug, PartialEq, Eq, Hash)]
274    #[cfg(feature = "Metal_MTLCompileOptions")]
275    pub struct MTLCompileOptions;
276
277    #[cfg(feature = "Metal_MTLCompileOptions")]
278    unsafe impl ClassType for MTLCompileOptions {
279        type Super = NSObject;
280        type Mutability = InteriorMutable;
281    }
282);
283
284#[cfg(feature = "Metal_MTLCompileOptions")]
285unsafe impl NSCopying for MTLCompileOptions {}
286
287#[cfg(feature = "Metal_MTLCompileOptions")]
288unsafe impl NSObjectProtocol for MTLCompileOptions {}
289
290extern_methods!(
291    #[cfg(feature = "Metal_MTLCompileOptions")]
292    unsafe impl MTLCompileOptions {
293        #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
294        #[method_id(@__retain_semantics Other preprocessorMacros)]
295        pub fn preprocessorMacros(&self) -> Option<Id<NSDictionary<NSString, NSObject>>>;
296
297        #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
298        #[method(setPreprocessorMacros:)]
299        pub unsafe fn setPreprocessorMacros(
300            &self,
301            preprocessor_macros: Option<&NSDictionary<NSString, NSObject>>,
302        );
303
304        #[method(fastMathEnabled)]
305        pub fn fastMathEnabled(&self) -> bool;
306
307        #[method(setFastMathEnabled:)]
308        pub fn setFastMathEnabled(&self, fast_math_enabled: bool);
309
310        #[method(languageVersion)]
311        pub fn languageVersion(&self) -> MTLLanguageVersion;
312
313        #[method(setLanguageVersion:)]
314        pub fn setLanguageVersion(&self, language_version: MTLLanguageVersion);
315
316        #[method(libraryType)]
317        pub fn libraryType(&self) -> MTLLibraryType;
318
319        #[method(setLibraryType:)]
320        pub fn setLibraryType(&self, library_type: MTLLibraryType);
321
322        #[cfg(feature = "Foundation_NSString")]
323        #[method_id(@__retain_semantics Other installName)]
324        pub fn installName(&self) -> Option<Id<NSString>>;
325
326        #[cfg(feature = "Foundation_NSString")]
327        #[method(setInstallName:)]
328        pub unsafe fn setInstallName(&self, install_name: Option<&NSString>);
329
330        #[cfg(feature = "Foundation_NSArray")]
331        #[method_id(@__retain_semantics Other libraries)]
332        pub fn libraries(&self) -> Option<Id<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>>;
333
334        #[cfg(feature = "Foundation_NSArray")]
335        #[method(setLibraries:)]
336        pub fn setLibraries(
337            &self,
338            libraries: Option<&NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>,
339        );
340
341        #[method(preserveInvariance)]
342        pub fn preserveInvariance(&self) -> bool;
343
344        #[method(setPreserveInvariance:)]
345        pub fn setPreserveInvariance(&self, preserve_invariance: bool);
346
347        #[method(optimizationLevel)]
348        pub unsafe fn optimizationLevel(&self) -> MTLLibraryOptimizationLevel;
349
350        #[method(setOptimizationLevel:)]
351        pub unsafe fn setOptimizationLevel(&self, optimization_level: MTLLibraryOptimizationLevel);
352
353        #[method(compileSymbolVisibility)]
354        pub unsafe fn compileSymbolVisibility(&self) -> MTLCompileSymbolVisibility;
355
356        #[method(setCompileSymbolVisibility:)]
357        pub unsafe fn setCompileSymbolVisibility(
358            &self,
359            compile_symbol_visibility: MTLCompileSymbolVisibility,
360        );
361
362        #[method(allowReferencingUndefinedSymbols)]
363        pub unsafe fn allowReferencingUndefinedSymbols(&self) -> bool;
364
365        #[method(setAllowReferencingUndefinedSymbols:)]
366        pub unsafe fn setAllowReferencingUndefinedSymbols(
367            &self,
368            allow_referencing_undefined_symbols: bool,
369        );
370
371        #[method(maxTotalThreadsPerThreadgroup)]
372        pub unsafe fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
373
374        #[method(setMaxTotalThreadsPerThreadgroup:)]
375        pub unsafe fn setMaxTotalThreadsPerThreadgroup(
376            &self,
377            max_total_threads_per_threadgroup: NSUInteger,
378        );
379    }
380);
381
382extern_methods!(
383    /// Methods declared on superclass `NSObject`
384    #[cfg(feature = "Metal_MTLCompileOptions")]
385    unsafe impl MTLCompileOptions {
386        #[method_id(@__retain_semantics Init init)]
387        pub fn init(this: Allocated<Self>) -> Id<Self>;
388
389        #[method_id(@__retain_semantics New new)]
390        pub fn new() -> Id<Self>;
391    }
392);
393
394#[cfg(feature = "Metal_MTLCompileOptions")]
395impl DefaultId for MTLCompileOptions {
396    #[inline]
397    fn default_id() -> Id<Self> {
398        Self::new()
399    }
400}
401
402extern_static!(MTLLibraryErrorDomain: &'static NSErrorDomain);
403
404ns_enum!(
405    #[underlying(NSUInteger)]
406    pub enum MTLLibraryError {
407        MTLLibraryErrorUnsupported = 1,
408        MTLLibraryErrorInternal = 2,
409        MTLLibraryErrorCompileFailure = 3,
410        MTLLibraryErrorCompileWarning = 4,
411        MTLLibraryErrorFunctionNotFound = 5,
412        MTLLibraryErrorFileNotFound = 6,
413    }
414);
415
416extern_protocol!(
417    pub unsafe trait MTLLibrary: NSObjectProtocol {
418        #[cfg(feature = "Foundation_NSString")]
419        #[method_id(@__retain_semantics Other label)]
420        fn label(&self) -> Option<Id<NSString>>;
421
422        #[cfg(feature = "Foundation_NSString")]
423        #[method(setLabel:)]
424        fn setLabel(&self, label: Option<&NSString>);
425
426        #[method_id(@__retain_semantics Other device)]
427        fn device(&self) -> Id<ProtocolObject<dyn MTLDevice>>;
428
429        #[cfg(feature = "Foundation_NSString")]
430        #[method_id(@__retain_semantics New newFunctionWithName:)]
431        fn newFunctionWithName(
432            &self,
433            function_name: &NSString,
434        ) -> Option<Id<ProtocolObject<dyn MTLFunction>>>;
435
436        #[cfg(all(
437            feature = "Foundation_NSError",
438            feature = "Foundation_NSString",
439            feature = "Metal_MTLFunctionConstantValues"
440        ))]
441        #[method_id(@__retain_semantics New newFunctionWithName:constantValues:error:_)]
442        fn newFunctionWithName_constantValues_error(
443            &self,
444            name: &NSString,
445            constant_values: &MTLFunctionConstantValues,
446        ) -> Result<Id<ProtocolObject<dyn MTLFunction>>, Id<NSError>>;
447
448        #[cfg(all(
449            feature = "Foundation_NSError",
450            feature = "Foundation_NSString",
451            feature = "Metal_MTLFunctionConstantValues"
452        ))]
453        #[method(newFunctionWithName:constantValues:completionHandler:)]
454        unsafe fn newFunctionWithName_constantValues_completionHandler(
455            &self,
456            name: &NSString,
457            constant_values: &MTLFunctionConstantValues,
458            completion_handler: &Block<(*mut ProtocolObject<dyn MTLFunction>, *mut NSError), ()>,
459        );
460
461        #[cfg(all(
462            feature = "Foundation_NSError",
463            feature = "Metal_MTLFunctionDescriptor"
464        ))]
465        #[method(newFunctionWithDescriptor:completionHandler:)]
466        unsafe fn newFunctionWithDescriptor_completionHandler(
467            &self,
468            descriptor: &MTLFunctionDescriptor,
469            completion_handler: &Block<(*mut ProtocolObject<dyn MTLFunction>, *mut NSError), ()>,
470        );
471
472        #[cfg(all(
473            feature = "Foundation_NSError",
474            feature = "Metal_MTLFunctionDescriptor"
475        ))]
476        #[method_id(@__retain_semantics New newFunctionWithDescriptor:error:_)]
477        fn newFunctionWithDescriptor_error(
478            &self,
479            descriptor: &MTLFunctionDescriptor,
480        ) -> Result<Id<ProtocolObject<dyn MTLFunction>>, Id<NSError>>;
481
482        #[cfg(all(
483            feature = "Foundation_NSError",
484            feature = "Metal_MTLIntersectionFunctionDescriptor"
485        ))]
486        #[method(newIntersectionFunctionWithDescriptor:completionHandler:)]
487        unsafe fn newIntersectionFunctionWithDescriptor_completionHandler(
488            &self,
489            descriptor: &MTLIntersectionFunctionDescriptor,
490            completion_handler: &Block<(*mut ProtocolObject<dyn MTLFunction>, *mut NSError), ()>,
491        );
492
493        #[cfg(all(
494            feature = "Foundation_NSError",
495            feature = "Metal_MTLIntersectionFunctionDescriptor"
496        ))]
497        #[method_id(@__retain_semantics New newIntersectionFunctionWithDescriptor:error:_)]
498        fn newIntersectionFunctionWithDescriptor_error(
499            &self,
500            descriptor: &MTLIntersectionFunctionDescriptor,
501        ) -> Result<Id<ProtocolObject<dyn MTLFunction>>, Id<NSError>>;
502
503        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
504        #[method_id(@__retain_semantics Other functionNames)]
505        fn functionNames(&self) -> Id<NSArray<NSString>>;
506
507        #[method(type)]
508        unsafe fn r#type(&self) -> MTLLibraryType;
509
510        #[cfg(feature = "Foundation_NSString")]
511        #[method_id(@__retain_semantics Other installName)]
512        fn installName(&self) -> Option<Id<NSString>>;
513    }
514
515    unsafe impl ProtocolType for dyn MTLLibrary {}
516);