objc2_metal/generated/
MTL4PipelineState.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/// Option mask for requesting reflection information at pipeline build time.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4shaderreflection?language=objc)
13// NS_OPTIONS
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct MTL4ShaderReflection(pub NSUInteger);
17bitflags::bitflags! {
18    impl MTL4ShaderReflection: NSUInteger {
19/// Requests no information.
20        #[doc(alias = "MTL4ShaderReflectionNone")]
21        const None = 0;
22/// Requests reflection information for bindings.
23        #[doc(alias = "MTL4ShaderReflectionBindingInfo")]
24        const BindingInfo = 1<<0;
25/// Requests reflection information for buffer types.
26        #[doc(alias = "MTL4ShaderReflectionBufferTypeInfo")]
27        const BufferTypeInfo = 1<<1;
28    }
29}
30
31unsafe impl Encode for MTL4ShaderReflection {
32    const ENCODING: Encoding = NSUInteger::ENCODING;
33}
34
35unsafe impl RefEncode for MTL4ShaderReflection {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39/// Enumeration for controlling alpha-to-one state of a pipeline state object.
40///
41/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4alphatoonestate?language=objc)
42// NS_ENUM
43#[repr(transparent)]
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct MTL4AlphaToOneState(pub NSInteger);
46impl MTL4AlphaToOneState {
47    /// Disables alpha-to-one.
48    #[doc(alias = "MTL4AlphaToOneStateDisabled")]
49    pub const Disabled: Self = Self(0);
50    /// Enables alpha-to-one.
51    #[doc(alias = "MTL4AlphaToOneStateEnabled")]
52    pub const Enabled: Self = Self(1);
53}
54
55unsafe impl Encode for MTL4AlphaToOneState {
56    const ENCODING: Encoding = NSInteger::ENCODING;
57}
58
59unsafe impl RefEncode for MTL4AlphaToOneState {
60    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63/// Enumeration for controlling alpha-to-coverage state of a pipeline state object.
64///
65/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4alphatocoveragestate?language=objc)
66// NS_ENUM
67#[repr(transparent)]
68#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
69pub struct MTL4AlphaToCoverageState(pub NSInteger);
70impl MTL4AlphaToCoverageState {
71    /// Disables alpha-to-coverage.
72    #[doc(alias = "MTL4AlphaToCoverageStateDisabled")]
73    pub const Disabled: Self = Self(0);
74    /// Enables alpha-to-coverage.
75    #[doc(alias = "MTL4AlphaToCoverageStateEnabled")]
76    pub const Enabled: Self = Self(1);
77}
78
79unsafe impl Encode for MTL4AlphaToCoverageState {
80    const ENCODING: Encoding = NSInteger::ENCODING;
81}
82
83unsafe impl RefEncode for MTL4AlphaToCoverageState {
84    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
85}
86
87/// Enumeration for controlling the blend state of a pipeline state object.
88///
89/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4blendstate?language=objc)
90// NS_ENUM
91#[repr(transparent)]
92#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
93pub struct MTL4BlendState(pub NSInteger);
94impl MTL4BlendState {
95    /// Disables blending.
96    #[doc(alias = "MTL4BlendStateDisabled")]
97    pub const Disabled: Self = Self(0);
98    /// Enables blending.
99    #[doc(alias = "MTL4BlendStateEnabled")]
100    pub const Enabled: Self = Self(1);
101    /// Defers determining the blending stage.
102    ///
103    /// Behaves as ``MTL4BlendStateDisabled`` until you specialize this pipeline value.
104    #[doc(alias = "MTL4BlendStateUnspecialized")]
105    pub const Unspecialized: Self = Self(2);
106}
107
108unsafe impl Encode for MTL4BlendState {
109    const ENCODING: Encoding = NSInteger::ENCODING;
110}
111
112unsafe impl RefEncode for MTL4BlendState {
113    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
114}
115
116/// Enumeration for controlling support for ``MTLIndirectCommandBuffer``.
117///
118/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4indirectcommandbuffersupportstate?language=objc)
119// NS_ENUM
120#[repr(transparent)]
121#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
122pub struct MTL4IndirectCommandBufferSupportState(pub NSInteger);
123impl MTL4IndirectCommandBufferSupportState {
124    /// Disables support for indirect command buffers.
125    #[doc(alias = "MTL4IndirectCommandBufferSupportStateDisabled")]
126    pub const Disabled: Self = Self(0);
127    /// Enables support for indirect command buffers.
128    #[doc(alias = "MTL4IndirectCommandBufferSupportStateEnabled")]
129    pub const Enabled: Self = Self(1);
130}
131
132unsafe impl Encode for MTL4IndirectCommandBufferSupportState {
133    const ENCODING: Encoding = NSInteger::ENCODING;
134}
135
136unsafe impl RefEncode for MTL4IndirectCommandBufferSupportState {
137    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
138}
139
140extern_class!(
141    /// Provides options controlling how to compile a pipeline state.
142    ///
143    /// You provide these options through the ``MTL4PipelineDescriptor`` class at compilation time.
144    ///
145    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4pipelineoptions?language=objc)
146    #[unsafe(super(NSObject))]
147    #[derive(Debug, PartialEq, Eq, Hash)]
148    pub struct MTL4PipelineOptions;
149);
150
151extern_conformance!(
152    unsafe impl NSCopying for MTL4PipelineOptions {}
153);
154
155unsafe impl CopyingHelper for MTL4PipelineOptions {
156    type Result = Self;
157}
158
159extern_conformance!(
160    unsafe impl NSObjectProtocol for MTL4PipelineOptions {}
161);
162
163impl MTL4PipelineOptions {
164    extern_methods!(
165        #[cfg(feature = "MTLPipeline")]
166        /// Controls whether to enable or disable Metal Shader Validation for the pipeline.
167        #[unsafe(method(shaderValidation))]
168        #[unsafe(method_family = none)]
169        pub fn shaderValidation(&self) -> MTLShaderValidation;
170
171        #[cfg(feature = "MTLPipeline")]
172        /// Setter for [`shaderValidation`][Self::shaderValidation].
173        #[unsafe(method(setShaderValidation:))]
174        #[unsafe(method_family = none)]
175        pub fn setShaderValidation(&self, shader_validation: MTLShaderValidation);
176
177        /// Controls whether to include Metal shader reflection in this pipeline.
178        #[unsafe(method(shaderReflection))]
179        #[unsafe(method_family = none)]
180        pub fn shaderReflection(&self) -> MTL4ShaderReflection;
181
182        /// Setter for [`shaderReflection`][Self::shaderReflection].
183        #[unsafe(method(setShaderReflection:))]
184        #[unsafe(method_family = none)]
185        pub fn setShaderReflection(&self, shader_reflection: MTL4ShaderReflection);
186    );
187}
188
189/// Methods declared on superclass `NSObject`.
190impl MTL4PipelineOptions {
191    extern_methods!(
192        #[unsafe(method(init))]
193        #[unsafe(method_family = init)]
194        pub fn init(this: Allocated<Self>) -> Retained<Self>;
195
196        #[unsafe(method(new))]
197        #[unsafe(method_family = new)]
198        pub fn new() -> Retained<Self>;
199    );
200}
201
202impl DefaultRetained for MTL4PipelineOptions {
203    #[inline]
204    fn default_retained() -> Retained<Self> {
205        Self::new()
206    }
207}
208
209extern_class!(
210    /// Base type for descriptors you use for building pipeline state objects.
211    ///
212    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4pipelinedescriptor?language=objc)
213    #[unsafe(super(NSObject))]
214    #[derive(Debug, PartialEq, Eq, Hash)]
215    pub struct MTL4PipelineDescriptor;
216);
217
218extern_conformance!(
219    unsafe impl NSCopying for MTL4PipelineDescriptor {}
220);
221
222unsafe impl CopyingHelper for MTL4PipelineDescriptor {
223    type Result = Self;
224}
225
226extern_conformance!(
227    unsafe impl NSObjectProtocol for MTL4PipelineDescriptor {}
228);
229
230impl MTL4PipelineDescriptor {
231    extern_methods!(
232        /// Assigns an optional string that uniquely identifies a pipeline descriptor.
233        ///
234        /// After you provide this label, you can use it to look up a pipeline state object by name in a binary archive.
235        #[unsafe(method(label))]
236        #[unsafe(method_family = none)]
237        pub fn label(&self) -> Option<Retained<NSString>>;
238
239        /// Setter for [`label`][Self::label].
240        ///
241        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
242        #[unsafe(method(setLabel:))]
243        #[unsafe(method_family = none)]
244        pub fn setLabel(&self, label: Option<&NSString>);
245
246        /// Provides compile-time options when you build the pipeline.
247        #[unsafe(method(options))]
248        #[unsafe(method_family = none)]
249        pub fn options(&self) -> Option<Retained<MTL4PipelineOptions>>;
250
251        /// Setter for [`options`][Self::options].
252        #[unsafe(method(setOptions:))]
253        #[unsafe(method_family = none)]
254        pub fn setOptions(&self, options: Option<&MTL4PipelineOptions>);
255    );
256}
257
258/// Methods declared on superclass `NSObject`.
259impl MTL4PipelineDescriptor {
260    extern_methods!(
261        #[unsafe(method(init))]
262        #[unsafe(method_family = init)]
263        pub fn init(this: Allocated<Self>) -> Retained<Self>;
264
265        #[unsafe(method(new))]
266        #[unsafe(method_family = new)]
267        pub fn new() -> Retained<Self>;
268    );
269}
270
271impl DefaultRetained for MTL4PipelineDescriptor {
272    #[inline]
273    fn default_retained() -> Retained<Self> {
274        Self::new()
275    }
276}