objc2_metal/generated/
MTLArgument.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlindextype?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct MTLIndexType(pub NSUInteger);
14impl MTLIndexType {
15    #[doc(alias = "MTLIndexTypeUInt16")]
16    pub const UInt16: Self = Self(0);
17    #[doc(alias = "MTLIndexTypeUInt32")]
18    pub const UInt32: Self = Self(1);
19}
20
21unsafe impl Encode for MTLIndexType {
22    const ENCODING: Encoding = NSUInteger::ENCODING;
23}
24
25unsafe impl RefEncode for MTLIndexType {
26    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
27}
28
29/// The type of a resource binding.
30///
31///
32/// This binding represents a buffer.
33///
34///
35/// This binding represents threadgroup memory.
36///
37///
38/// This binding represents a texture.
39///
40///
41/// This binding represents a sampler.
42///
43///
44/// This binding represents an image block data.
45///
46///
47/// This binding represents an image block.
48///
49///
50/// This binding represents a visible function table object.
51///
52///
53/// This binding represents a primitive acceleration structure object.
54///
55///
56/// This binding represents an instance acceleration structure object.
57///
58///
59/// This binding represents an intersection function table object.
60///
61///
62/// This binding represents an object payload.
63///
64///
65/// This binding represents a tensor object.
66///
67/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlbindingtype?language=objc)
68// NS_ENUM
69#[repr(transparent)]
70#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
71pub struct MTLBindingType(pub NSInteger);
72impl MTLBindingType {
73    #[doc(alias = "MTLBindingTypeBuffer")]
74    pub const Buffer: Self = Self(0);
75    #[doc(alias = "MTLBindingTypeThreadgroupMemory")]
76    pub const ThreadgroupMemory: Self = Self(1);
77    #[doc(alias = "MTLBindingTypeTexture")]
78    pub const Texture: Self = Self(2);
79    #[doc(alias = "MTLBindingTypeSampler")]
80    pub const Sampler: Self = Self(3);
81    #[doc(alias = "MTLBindingTypeImageblockData")]
82    pub const ImageblockData: Self = Self(16);
83    #[doc(alias = "MTLBindingTypeImageblock")]
84    pub const Imageblock: Self = Self(17);
85    #[doc(alias = "MTLBindingTypeVisibleFunctionTable")]
86    pub const VisibleFunctionTable: Self = Self(24);
87    #[doc(alias = "MTLBindingTypePrimitiveAccelerationStructure")]
88    pub const PrimitiveAccelerationStructure: Self = Self(25);
89    #[doc(alias = "MTLBindingTypeInstanceAccelerationStructure")]
90    pub const InstanceAccelerationStructure: Self = Self(26);
91    #[doc(alias = "MTLBindingTypeIntersectionFunctionTable")]
92    pub const IntersectionFunctionTable: Self = Self(27);
93    #[doc(alias = "MTLBindingTypeObjectPayload")]
94    pub const ObjectPayload: Self = Self(34);
95    #[doc(alias = "MTLBindingTypeTensor")]
96    pub const Tensor: Self = Self(37);
97}
98
99unsafe impl Encode for MTLBindingType {
100    const ENCODING: Encoding = NSInteger::ENCODING;
101}
102
103unsafe impl RefEncode for MTLBindingType {
104    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
105}
106
107/// The type for an input to a MTLRenderPipelineState or a MTLComputePipelineState
108///
109///
110/// This input is a MTLBuffer
111///
112///
113/// This input is a pointer to the threadgroup memory.
114///
115///
116/// This input is a MTLTexture.
117///
118///
119/// This input is a sampler.
120///
121/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlargumenttype?language=objc)
122// NS_ENUM
123#[deprecated]
124#[repr(transparent)]
125#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
126pub struct MTLArgumentType(pub NSUInteger);
127impl MTLArgumentType {
128    #[doc(alias = "MTLArgumentTypeBuffer")]
129    #[deprecated]
130    pub const Buffer: Self = Self(0);
131    #[doc(alias = "MTLArgumentTypeThreadgroupMemory")]
132    #[deprecated]
133    pub const ThreadgroupMemory: Self = Self(1);
134    #[doc(alias = "MTLArgumentTypeTexture")]
135    #[deprecated]
136    pub const Texture: Self = Self(2);
137    #[doc(alias = "MTLArgumentTypeSampler")]
138    #[deprecated]
139    pub const Sampler: Self = Self(3);
140    #[doc(alias = "MTLArgumentTypeImageblockData")]
141    pub const ImageblockData: Self = Self(16);
142    #[doc(alias = "MTLArgumentTypeImageblock")]
143    pub const Imageblock: Self = Self(17);
144    #[doc(alias = "MTLArgumentTypeVisibleFunctionTable")]
145    pub const VisibleFunctionTable: Self = Self(24);
146    #[doc(alias = "MTLArgumentTypePrimitiveAccelerationStructure")]
147    pub const PrimitiveAccelerationStructure: Self = Self(25);
148    #[doc(alias = "MTLArgumentTypeInstanceAccelerationStructure")]
149    pub const InstanceAccelerationStructure: Self = Self(26);
150    #[doc(alias = "MTLArgumentTypeIntersectionFunctionTable")]
151    pub const IntersectionFunctionTable: Self = Self(27);
152}
153
154unsafe impl Encode for MTLArgumentType {
155    const ENCODING: Encoding = NSUInteger::ENCODING;
156}
157
158unsafe impl RefEncode for MTLArgumentType {
159    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
160}
161
162/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlbindingaccess?language=objc)
163// NS_ENUM
164#[repr(transparent)]
165#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
166pub struct MTLBindingAccess(pub NSUInteger);
167impl MTLBindingAccess {
168    #[doc(alias = "MTLBindingAccessReadOnly")]
169    pub const ReadOnly: Self = Self(0);
170    #[doc(alias = "MTLBindingAccessReadWrite")]
171    pub const ReadWrite: Self = Self(1);
172    #[doc(alias = "MTLBindingAccessWriteOnly")]
173    pub const WriteOnly: Self = Self(2);
174    #[deprecated]
175    pub const MTLArgumentAccessReadOnly: Self = Self(MTLBindingAccess::ReadOnly.0);
176    #[deprecated]
177    pub const MTLArgumentAccessReadWrite: Self = Self(MTLBindingAccess::ReadWrite.0);
178    #[deprecated]
179    pub const MTLArgumentAccessWriteOnly: Self = Self(MTLBindingAccess::WriteOnly.0);
180}
181
182unsafe impl Encode for MTLBindingAccess {
183    const ENCODING: Encoding = NSUInteger::ENCODING;
184}
185
186unsafe impl RefEncode for MTLBindingAccess {
187    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
188}
189
190/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlargumentaccess?language=objc)
191#[deprecated]
192pub type MTLArgumentAccess = MTLBindingAccess;
193
194extern_class!(
195    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltype?language=objc)
196    #[unsafe(super(NSObject))]
197    #[derive(Debug, PartialEq, Eq, Hash)]
198    pub struct MTLType;
199);
200
201extern_conformance!(
202    unsafe impl NSObjectProtocol for MTLType {}
203);
204
205impl MTLType {
206    extern_methods!(
207        #[cfg(feature = "MTLDataType")]
208        #[unsafe(method(dataType))]
209        #[unsafe(method_family = none)]
210        pub fn dataType(&self) -> MTLDataType;
211    );
212}
213
214/// Methods declared on superclass `NSObject`.
215impl MTLType {
216    extern_methods!(
217        #[unsafe(method(init))]
218        #[unsafe(method_family = init)]
219        pub fn init(this: Allocated<Self>) -> Retained<Self>;
220
221        #[unsafe(method(new))]
222        #[unsafe(method_family = new)]
223        pub fn new() -> Retained<Self>;
224    );
225}
226
227impl DefaultRetained for MTLType {
228    #[inline]
229    fn default_retained() -> Retained<Self> {
230        Self::new()
231    }
232}
233
234extern_class!(
235    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlstructmember?language=objc)
236    #[unsafe(super(NSObject))]
237    #[derive(Debug, PartialEq, Eq, Hash)]
238    pub struct MTLStructMember;
239);
240
241extern_conformance!(
242    unsafe impl NSObjectProtocol for MTLStructMember {}
243);
244
245impl MTLStructMember {
246    extern_methods!(
247        #[unsafe(method(name))]
248        #[unsafe(method_family = none)]
249        pub fn name(&self) -> Retained<NSString>;
250
251        #[unsafe(method(offset))]
252        #[unsafe(method_family = none)]
253        pub fn offset(&self) -> NSUInteger;
254
255        #[cfg(feature = "MTLDataType")]
256        #[unsafe(method(dataType))]
257        #[unsafe(method_family = none)]
258        pub fn dataType(&self) -> MTLDataType;
259
260        #[unsafe(method(structType))]
261        #[unsafe(method_family = none)]
262        pub fn structType(&self) -> Option<Retained<MTLStructType>>;
263
264        #[unsafe(method(arrayType))]
265        #[unsafe(method_family = none)]
266        pub fn arrayType(&self) -> Option<Retained<MTLArrayType>>;
267
268        #[unsafe(method(textureReferenceType))]
269        #[unsafe(method_family = none)]
270        pub fn textureReferenceType(&self) -> Option<Retained<MTLTextureReferenceType>>;
271
272        #[unsafe(method(pointerType))]
273        #[unsafe(method_family = none)]
274        pub fn pointerType(&self) -> Option<Retained<MTLPointerType>>;
275
276        /// Provides a description of the underlying tensor type when this struct member holds a tensor.
277        ///
278        /// - Returns: A description of the tensor type that this struct member holds, or `nil` if this struct member doesn't hold a tensor.
279        #[unsafe(method(tensorReferenceType))]
280        #[unsafe(method_family = none)]
281        pub fn tensorReferenceType(&self) -> Option<Retained<MTLTensorReferenceType>>;
282
283        #[unsafe(method(argumentIndex))]
284        #[unsafe(method_family = none)]
285        pub fn argumentIndex(&self) -> NSUInteger;
286    );
287}
288
289/// Methods declared on superclass `NSObject`.
290impl MTLStructMember {
291    extern_methods!(
292        #[unsafe(method(init))]
293        #[unsafe(method_family = init)]
294        pub fn init(this: Allocated<Self>) -> Retained<Self>;
295
296        #[unsafe(method(new))]
297        #[unsafe(method_family = new)]
298        pub fn new() -> Retained<Self>;
299    );
300}
301
302impl DefaultRetained for MTLStructMember {
303    #[inline]
304    fn default_retained() -> Retained<Self> {
305        Self::new()
306    }
307}
308
309extern_class!(
310    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlstructtype?language=objc)
311    #[unsafe(super(MTLType, NSObject))]
312    #[derive(Debug, PartialEq, Eq, Hash)]
313    pub struct MTLStructType;
314);
315
316extern_conformance!(
317    unsafe impl NSObjectProtocol for MTLStructType {}
318);
319
320impl MTLStructType {
321    extern_methods!(
322        #[unsafe(method(members))]
323        #[unsafe(method_family = none)]
324        pub fn members(&self) -> Retained<NSArray<MTLStructMember>>;
325
326        #[unsafe(method(memberByName:))]
327        #[unsafe(method_family = none)]
328        pub fn memberByName(&self, name: &NSString) -> Option<Retained<MTLStructMember>>;
329    );
330}
331
332/// Methods declared on superclass `NSObject`.
333impl MTLStructType {
334    extern_methods!(
335        #[unsafe(method(init))]
336        #[unsafe(method_family = init)]
337        pub fn init(this: Allocated<Self>) -> Retained<Self>;
338
339        #[unsafe(method(new))]
340        #[unsafe(method_family = new)]
341        pub fn new() -> Retained<Self>;
342    );
343}
344
345impl DefaultRetained for MTLStructType {
346    #[inline]
347    fn default_retained() -> Retained<Self> {
348        Self::new()
349    }
350}
351
352extern_class!(
353    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlarraytype?language=objc)
354    #[unsafe(super(MTLType, NSObject))]
355    #[derive(Debug, PartialEq, Eq, Hash)]
356    pub struct MTLArrayType;
357);
358
359extern_conformance!(
360    unsafe impl NSObjectProtocol for MTLArrayType {}
361);
362
363impl MTLArrayType {
364    extern_methods!(
365        #[cfg(feature = "MTLDataType")]
366        #[unsafe(method(elementType))]
367        #[unsafe(method_family = none)]
368        pub fn elementType(&self) -> MTLDataType;
369
370        #[unsafe(method(arrayLength))]
371        #[unsafe(method_family = none)]
372        pub fn arrayLength(&self) -> NSUInteger;
373
374        #[unsafe(method(stride))]
375        #[unsafe(method_family = none)]
376        pub fn stride(&self) -> NSUInteger;
377
378        #[unsafe(method(argumentIndexStride))]
379        #[unsafe(method_family = none)]
380        pub fn argumentIndexStride(&self) -> NSUInteger;
381
382        #[unsafe(method(elementStructType))]
383        #[unsafe(method_family = none)]
384        pub fn elementStructType(&self) -> Option<Retained<MTLStructType>>;
385
386        #[unsafe(method(elementArrayType))]
387        #[unsafe(method_family = none)]
388        pub fn elementArrayType(&self) -> Option<Retained<MTLArrayType>>;
389
390        #[unsafe(method(elementTextureReferenceType))]
391        #[unsafe(method_family = none)]
392        pub fn elementTextureReferenceType(&self) -> Option<Retained<MTLTextureReferenceType>>;
393
394        #[unsafe(method(elementPointerType))]
395        #[unsafe(method_family = none)]
396        pub fn elementPointerType(&self) -> Option<Retained<MTLPointerType>>;
397
398        /// Provides a description of the underlying tensor type when this array holds tensors as its elements.
399        ///
400        /// - Returns: A description of the tensor type that this array holds, or `nil` if this struct member doesn't hold a tensor.
401        #[unsafe(method(elementTensorReferenceType))]
402        #[unsafe(method_family = none)]
403        pub fn elementTensorReferenceType(&self) -> Option<Retained<MTLTensorReferenceType>>;
404    );
405}
406
407/// Methods declared on superclass `NSObject`.
408impl MTLArrayType {
409    extern_methods!(
410        #[unsafe(method(init))]
411        #[unsafe(method_family = init)]
412        pub fn init(this: Allocated<Self>) -> Retained<Self>;
413
414        #[unsafe(method(new))]
415        #[unsafe(method_family = new)]
416        pub fn new() -> Retained<Self>;
417    );
418}
419
420impl DefaultRetained for MTLArrayType {
421    #[inline]
422    fn default_retained() -> Retained<Self> {
423        Self::new()
424    }
425}
426
427extern_class!(
428    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlpointertype?language=objc)
429    #[unsafe(super(MTLType, NSObject))]
430    #[derive(Debug, PartialEq, Eq, Hash)]
431    pub struct MTLPointerType;
432);
433
434extern_conformance!(
435    unsafe impl NSObjectProtocol for MTLPointerType {}
436);
437
438impl MTLPointerType {
439    extern_methods!(
440        #[cfg(feature = "MTLDataType")]
441        #[unsafe(method(elementType))]
442        #[unsafe(method_family = none)]
443        pub fn elementType(&self) -> MTLDataType;
444
445        #[unsafe(method(access))]
446        #[unsafe(method_family = none)]
447        pub fn access(&self) -> MTLBindingAccess;
448
449        #[unsafe(method(alignment))]
450        #[unsafe(method_family = none)]
451        pub fn alignment(&self) -> NSUInteger;
452
453        #[unsafe(method(dataSize))]
454        #[unsafe(method_family = none)]
455        pub fn dataSize(&self) -> NSUInteger;
456
457        #[unsafe(method(elementIsArgumentBuffer))]
458        #[unsafe(method_family = none)]
459        pub fn elementIsArgumentBuffer(&self) -> bool;
460
461        #[unsafe(method(elementStructType))]
462        #[unsafe(method_family = none)]
463        pub fn elementStructType(&self) -> Option<Retained<MTLStructType>>;
464
465        #[unsafe(method(elementArrayType))]
466        #[unsafe(method_family = none)]
467        pub fn elementArrayType(&self) -> Option<Retained<MTLArrayType>>;
468    );
469}
470
471/// Methods declared on superclass `NSObject`.
472impl MTLPointerType {
473    extern_methods!(
474        #[unsafe(method(init))]
475        #[unsafe(method_family = init)]
476        pub fn init(this: Allocated<Self>) -> Retained<Self>;
477
478        #[unsafe(method(new))]
479        #[unsafe(method_family = new)]
480        pub fn new() -> Retained<Self>;
481    );
482}
483
484impl DefaultRetained for MTLPointerType {
485    #[inline]
486    fn default_retained() -> Retained<Self> {
487        Self::new()
488    }
489}
490
491extern_class!(
492    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltexturereferencetype?language=objc)
493    #[unsafe(super(MTLType, NSObject))]
494    #[derive(Debug, PartialEq, Eq, Hash)]
495    pub struct MTLTextureReferenceType;
496);
497
498extern_conformance!(
499    unsafe impl NSObjectProtocol for MTLTextureReferenceType {}
500);
501
502impl MTLTextureReferenceType {
503    extern_methods!(
504        #[cfg(feature = "MTLDataType")]
505        #[unsafe(method(textureDataType))]
506        #[unsafe(method_family = none)]
507        pub fn textureDataType(&self) -> MTLDataType;
508
509        #[cfg(feature = "MTLTexture")]
510        #[unsafe(method(textureType))]
511        #[unsafe(method_family = none)]
512        pub fn textureType(&self) -> MTLTextureType;
513
514        #[unsafe(method(access))]
515        #[unsafe(method_family = none)]
516        pub fn access(&self) -> MTLBindingAccess;
517
518        #[unsafe(method(isDepthTexture))]
519        #[unsafe(method_family = none)]
520        pub fn isDepthTexture(&self) -> bool;
521    );
522}
523
524/// Methods declared on superclass `NSObject`.
525impl MTLTextureReferenceType {
526    extern_methods!(
527        #[unsafe(method(init))]
528        #[unsafe(method_family = init)]
529        pub fn init(this: Allocated<Self>) -> Retained<Self>;
530
531        #[unsafe(method(new))]
532        #[unsafe(method_family = new)]
533        pub fn new() -> Retained<Self>;
534    );
535}
536
537impl DefaultRetained for MTLTextureReferenceType {
538    #[inline]
539    fn default_retained() -> Retained<Self> {
540        Self::new()
541    }
542}
543
544extern_class!(
545    /// An object that represents a tensor in the shading language in a struct or array.
546    ///
547    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtltensorreferencetype?language=objc)
548    #[unsafe(super(MTLType, NSObject))]
549    #[derive(Debug, PartialEq, Eq, Hash)]
550    pub struct MTLTensorReferenceType;
551);
552
553extern_conformance!(
554    unsafe impl NSObjectProtocol for MTLTensorReferenceType {}
555);
556
557impl MTLTensorReferenceType {
558    extern_methods!(
559        #[cfg(feature = "MTLTensor")]
560        /// The underlying data format of the tensor.
561        #[unsafe(method(tensorDataType))]
562        #[unsafe(method_family = none)]
563        pub fn tensorDataType(&self) -> MTLTensorDataType;
564
565        #[cfg(feature = "MTLDataType")]
566        /// The data format you use for indexing into the tensor.
567        #[unsafe(method(indexType))]
568        #[unsafe(method_family = none)]
569        pub fn indexType(&self) -> MTLDataType;
570
571        #[cfg(feature = "MTLTensor")]
572        /// The array of sizes, in elements, one for each dimension of this tensor.
573        ///
574        /// Because shader-bound tensors have dynamic extents, the ``MTLTensorExtents/rank`` of `dimensions` corresponds to the rank the shader function specifies, and ``MTLTensorExtents/extentsAtDimensionIndex:`` always returns a value of -1.
575        #[unsafe(method(dimensions))]
576        #[unsafe(method_family = none)]
577        pub fn dimensions(&self) -> Option<Retained<MTLTensorExtents>>;
578
579        /// A value that represents the read/write permissions of the tensor.
580        #[unsafe(method(access))]
581        #[unsafe(method_family = none)]
582        pub fn access(&self) -> MTLBindingAccess;
583    );
584}
585
586/// Methods declared on superclass `NSObject`.
587impl MTLTensorReferenceType {
588    extern_methods!(
589        #[unsafe(method(init))]
590        #[unsafe(method_family = init)]
591        pub fn init(this: Allocated<Self>) -> Retained<Self>;
592
593        #[unsafe(method(new))]
594        #[unsafe(method_family = new)]
595        pub fn new() -> Retained<Self>;
596    );
597}
598
599impl DefaultRetained for MTLTensorReferenceType {
600    #[inline]
601    fn default_retained() -> Retained<Self> {
602        Self::new()
603    }
604}
605
606extern_class!(
607    /// MTLArgument
608    ///
609    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlargument?language=objc)
610    #[unsafe(super(NSObject))]
611    #[derive(Debug, PartialEq, Eq, Hash)]
612    #[deprecated]
613    pub struct MTLArgument;
614);
615
616unsafe impl Send for MTLArgument {}
617
618unsafe impl Sync for MTLArgument {}
619
620extern_conformance!(
621    unsafe impl NSObjectProtocol for MTLArgument {}
622);
623
624impl MTLArgument {
625    extern_methods!(
626        #[deprecated]
627        #[unsafe(method(name))]
628        #[unsafe(method_family = none)]
629        pub fn name(&self) -> Retained<NSString>;
630
631        #[deprecated]
632        #[unsafe(method(type))]
633        #[unsafe(method_family = none)]
634        pub fn r#type(&self) -> MTLArgumentType;
635
636        #[deprecated]
637        #[unsafe(method(access))]
638        #[unsafe(method_family = none)]
639        pub fn access(&self) -> MTLBindingAccess;
640
641        #[deprecated]
642        #[unsafe(method(index))]
643        #[unsafe(method_family = none)]
644        pub fn index(&self) -> NSUInteger;
645
646        #[deprecated]
647        #[unsafe(method(isActive))]
648        #[unsafe(method_family = none)]
649        pub fn isActive(&self) -> bool;
650
651        #[deprecated]
652        #[unsafe(method(bufferAlignment))]
653        #[unsafe(method_family = none)]
654        pub fn bufferAlignment(&self) -> NSUInteger;
655
656        #[deprecated]
657        #[unsafe(method(bufferDataSize))]
658        #[unsafe(method_family = none)]
659        pub fn bufferDataSize(&self) -> NSUInteger;
660
661        #[cfg(feature = "MTLDataType")]
662        #[deprecated]
663        #[unsafe(method(bufferDataType))]
664        #[unsafe(method_family = none)]
665        pub fn bufferDataType(&self) -> MTLDataType;
666
667        #[deprecated]
668        #[unsafe(method(bufferStructType))]
669        #[unsafe(method_family = none)]
670        pub fn bufferStructType(&self) -> Option<Retained<MTLStructType>>;
671
672        #[unsafe(method(bufferPointerType))]
673        #[unsafe(method_family = none)]
674        pub fn bufferPointerType(&self) -> Option<Retained<MTLPointerType>>;
675
676        #[deprecated]
677        #[unsafe(method(threadgroupMemoryAlignment))]
678        #[unsafe(method_family = none)]
679        pub fn threadgroupMemoryAlignment(&self) -> NSUInteger;
680
681        #[deprecated]
682        #[unsafe(method(threadgroupMemoryDataSize))]
683        #[unsafe(method_family = none)]
684        pub fn threadgroupMemoryDataSize(&self) -> NSUInteger;
685
686        #[cfg(feature = "MTLTexture")]
687        #[deprecated]
688        #[unsafe(method(textureType))]
689        #[unsafe(method_family = none)]
690        pub fn textureType(&self) -> MTLTextureType;
691
692        #[cfg(feature = "MTLDataType")]
693        #[deprecated]
694        #[unsafe(method(textureDataType))]
695        #[unsafe(method_family = none)]
696        pub fn textureDataType(&self) -> MTLDataType;
697
698        #[unsafe(method(isDepthTexture))]
699        #[unsafe(method_family = none)]
700        pub fn isDepthTexture(&self) -> bool;
701
702        #[unsafe(method(arrayLength))]
703        #[unsafe(method_family = none)]
704        pub fn arrayLength(&self) -> NSUInteger;
705    );
706}
707
708/// Methods declared on superclass `NSObject`.
709impl MTLArgument {
710    extern_methods!(
711        #[unsafe(method(init))]
712        #[unsafe(method_family = init)]
713        pub fn init(this: Allocated<Self>) -> Retained<Self>;
714
715        #[unsafe(method(new))]
716        #[unsafe(method_family = new)]
717        pub fn new() -> Retained<Self>;
718    );
719}
720
721impl DefaultRetained for MTLArgument {
722    #[inline]
723    fn default_retained() -> Retained<Self> {
724        Self::new()
725    }
726}
727
728extern_protocol!(
729    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlbinding?language=objc)
730    pub unsafe trait MTLBinding: NSObjectProtocol + Send + Sync {
731        #[unsafe(method(name))]
732        #[unsafe(method_family = none)]
733        fn name(&self) -> Retained<NSString>;
734
735        #[unsafe(method(type))]
736        #[unsafe(method_family = none)]
737        fn r#type(&self) -> MTLBindingType;
738
739        #[unsafe(method(access))]
740        #[unsafe(method_family = none)]
741        fn access(&self) -> MTLBindingAccess;
742
743        #[unsafe(method(index))]
744        #[unsafe(method_family = none)]
745        fn index(&self) -> NSUInteger;
746
747        #[unsafe(method(isUsed))]
748        #[unsafe(method_family = none)]
749        fn isUsed(&self) -> bool;
750
751        #[unsafe(method(isArgument))]
752        #[unsafe(method_family = none)]
753        fn isArgument(&self) -> bool;
754    }
755);
756
757extern_protocol!(
758    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlbufferbinding?language=objc)
759    pub unsafe trait MTLBufferBinding: MTLBinding {
760        #[unsafe(method(bufferAlignment))]
761        #[unsafe(method_family = none)]
762        fn bufferAlignment(&self) -> NSUInteger;
763
764        #[unsafe(method(bufferDataSize))]
765        #[unsafe(method_family = none)]
766        fn bufferDataSize(&self) -> NSUInteger;
767
768        #[cfg(feature = "MTLDataType")]
769        #[unsafe(method(bufferDataType))]
770        #[unsafe(method_family = none)]
771        fn bufferDataType(&self) -> MTLDataType;
772
773        #[unsafe(method(bufferStructType))]
774        #[unsafe(method_family = none)]
775        fn bufferStructType(&self) -> Option<Retained<MTLStructType>>;
776
777        #[unsafe(method(bufferPointerType))]
778        #[unsafe(method_family = none)]
779        fn bufferPointerType(&self) -> Option<Retained<MTLPointerType>>;
780    }
781);
782
783extern_protocol!(
784    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlthreadgroupbinding?language=objc)
785    pub unsafe trait MTLThreadgroupBinding: MTLBinding {
786        #[unsafe(method(threadgroupMemoryAlignment))]
787        #[unsafe(method_family = none)]
788        fn threadgroupMemoryAlignment(&self) -> NSUInteger;
789
790        #[unsafe(method(threadgroupMemoryDataSize))]
791        #[unsafe(method_family = none)]
792        fn threadgroupMemoryDataSize(&self) -> NSUInteger;
793    }
794);
795
796extern_protocol!(
797    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltexturebinding?language=objc)
798    pub unsafe trait MTLTextureBinding: MTLBinding {
799        #[cfg(feature = "MTLTexture")]
800        #[unsafe(method(textureType))]
801        #[unsafe(method_family = none)]
802        fn textureType(&self) -> MTLTextureType;
803
804        #[cfg(feature = "MTLDataType")]
805        #[unsafe(method(textureDataType))]
806        #[unsafe(method_family = none)]
807        fn textureDataType(&self) -> MTLDataType;
808
809        #[unsafe(method(isDepthTexture))]
810        #[unsafe(method_family = none)]
811        fn isDepthTexture(&self) -> bool;
812
813        #[unsafe(method(arrayLength))]
814        #[unsafe(method_family = none)]
815        fn arrayLength(&self) -> NSUInteger;
816    }
817);
818
819extern_protocol!(
820    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlobjectpayloadbinding?language=objc)
821    pub unsafe trait MTLObjectPayloadBinding: MTLBinding {
822        #[unsafe(method(objectPayloadAlignment))]
823        #[unsafe(method_family = none)]
824        fn objectPayloadAlignment(&self) -> NSUInteger;
825
826        #[unsafe(method(objectPayloadDataSize))]
827        #[unsafe(method_family = none)]
828        fn objectPayloadDataSize(&self) -> NSUInteger;
829    }
830);
831
832extern_protocol!(
833    /// An object that represents a tensor bound to a graphics or compute function or a machine learning function.
834    ///
835    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtltensorbinding?language=objc)
836    pub unsafe trait MTLTensorBinding: MTLBinding {
837        #[cfg(feature = "MTLTensor")]
838        /// The underlying data format of this tensor.
839        #[unsafe(method(tensorDataType))]
840        #[unsafe(method_family = none)]
841        fn tensorDataType(&self) -> MTLTensorDataType;
842
843        #[cfg(feature = "MTLDataType")]
844        /// The data format you use for indexing into the tensor.
845        #[unsafe(method(indexType))]
846        #[unsafe(method_family = none)]
847        fn indexType(&self) -> MTLDataType;
848
849        #[cfg(feature = "MTLTensor")]
850        /// The array of sizes, in elements, one for each dimension of this tensor.
851        ///
852        /// Because shader-bound tensors have dynamic extents, if this tensor is shader bound, the ``MTLTensorExtents/rank`` of `dimensions` corresponds to the rank the shader function specifies, and ``MTLTensorExtents/extentsAtDimensionIndex:`` always returns a value of -1.
853        /// In the case of functions used with machine learning pipelines, `dimensions` corresponds to the default shape, if you provide one. Otherwise, it's `nil` in the case of an undefined shape.
854        #[unsafe(method(dimensions))]
855        #[unsafe(method_family = none)]
856        fn dimensions(&self) -> Option<Retained<MTLTensorExtents>>;
857    }
858);