objc2_metal/generated/
MTLPipeline.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/// Specifies whether a buffer will be modified between the time it is bound and a compute
11/// or render pipeline is executed in a draw or dispatch.
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlmutability?language=objc)
14// NS_ENUM
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct MTLMutability(pub NSUInteger);
18impl MTLMutability {
19    #[doc(alias = "MTLMutabilityDefault")]
20    pub const Default: Self = Self(0);
21    #[doc(alias = "MTLMutabilityMutable")]
22    pub const Mutable: Self = Self(1);
23    #[doc(alias = "MTLMutabilityImmutable")]
24    pub const Immutable: Self = Self(2);
25}
26
27unsafe impl Encode for MTLMutability {
28    const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for MTLMutability {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlshadervalidation?language=objc)
36// NS_ENUM
37#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct MTLShaderValidation(pub NSInteger);
40impl MTLShaderValidation {
41    #[doc(alias = "MTLShaderValidationDefault")]
42    pub const Default: Self = Self(0);
43    #[doc(alias = "MTLShaderValidationEnabled")]
44    pub const Enabled: Self = Self(1);
45    #[doc(alias = "MTLShaderValidationDisabled")]
46    pub const Disabled: Self = Self(2);
47}
48
49unsafe impl Encode for MTLShaderValidation {
50    const ENCODING: Encoding = NSInteger::ENCODING;
51}
52
53unsafe impl RefEncode for MTLShaderValidation {
54    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
55}
56
57extern_class!(
58    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlpipelinebufferdescriptor?language=objc)
59    #[unsafe(super(NSObject))]
60    #[derive(Debug, PartialEq, Eq, Hash)]
61    pub struct MTLPipelineBufferDescriptor;
62);
63
64extern_conformance!(
65    unsafe impl NSCopying for MTLPipelineBufferDescriptor {}
66);
67
68unsafe impl CopyingHelper for MTLPipelineBufferDescriptor {
69    type Result = Self;
70}
71
72extern_conformance!(
73    unsafe impl NSObjectProtocol for MTLPipelineBufferDescriptor {}
74);
75
76impl MTLPipelineBufferDescriptor {
77    extern_methods!(
78        /// Buffer mutability. Defaults to MTLMutabilityDefault: mutable for standard buffers, immutable for argument buffers
79        #[unsafe(method(mutability))]
80        #[unsafe(method_family = none)]
81        pub fn mutability(&self) -> MTLMutability;
82
83        /// Setter for [`mutability`][Self::mutability].
84        #[unsafe(method(setMutability:))]
85        #[unsafe(method_family = none)]
86        pub fn setMutability(&self, mutability: MTLMutability);
87    );
88}
89
90/// Methods declared on superclass `NSObject`.
91impl MTLPipelineBufferDescriptor {
92    extern_methods!(
93        #[unsafe(method(init))]
94        #[unsafe(method_family = init)]
95        pub fn init(this: Allocated<Self>) -> Retained<Self>;
96
97        #[unsafe(method(new))]
98        #[unsafe(method_family = new)]
99        pub fn new() -> Retained<Self>;
100    );
101}
102
103impl DefaultRetained for MTLPipelineBufferDescriptor {
104    #[inline]
105    fn default_retained() -> Retained<Self> {
106        Self::new()
107    }
108}
109
110extern_class!(
111    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlpipelinebufferdescriptorarray?language=objc)
112    #[unsafe(super(NSObject))]
113    #[derive(Debug, PartialEq, Eq, Hash)]
114    pub struct MTLPipelineBufferDescriptorArray;
115);
116
117extern_conformance!(
118    unsafe impl NSObjectProtocol for MTLPipelineBufferDescriptorArray {}
119);
120
121impl MTLPipelineBufferDescriptorArray {
122    extern_methods!(
123        /// # Safety
124        ///
125        /// `bufferIndex` might not be bounds-checked.
126        #[unsafe(method(objectAtIndexedSubscript:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn objectAtIndexedSubscript(
129            &self,
130            buffer_index: NSUInteger,
131        ) -> Retained<MTLPipelineBufferDescriptor>;
132
133        /// # Safety
134        ///
135        /// `bufferIndex` might not be bounds-checked.
136        #[unsafe(method(setObject:atIndexedSubscript:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setObject_atIndexedSubscript(
139            &self,
140            buffer: Option<&MTLPipelineBufferDescriptor>,
141            buffer_index: NSUInteger,
142        );
143    );
144}
145
146/// Methods declared on superclass `NSObject`.
147impl MTLPipelineBufferDescriptorArray {
148    extern_methods!(
149        #[unsafe(method(init))]
150        #[unsafe(method_family = init)]
151        pub fn init(this: Allocated<Self>) -> Retained<Self>;
152
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub fn new() -> Retained<Self>;
156    );
157}
158
159impl DefaultRetained for MTLPipelineBufferDescriptorArray {
160    #[inline]
161    fn default_retained() -> Retained<Self> {
162        Self::new()
163    }
164}