objc2_metal/generated/
MTLComputePass.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
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptor?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct MTLComputePassSampleBufferAttachmentDescriptor;
15);
16
17extern_conformance!(
18    unsafe impl NSCopying for MTLComputePassSampleBufferAttachmentDescriptor {}
19);
20
21unsafe impl CopyingHelper for MTLComputePassSampleBufferAttachmentDescriptor {
22    type Result = Self;
23}
24
25extern_conformance!(
26    unsafe impl NSObjectProtocol for MTLComputePassSampleBufferAttachmentDescriptor {}
27);
28
29impl MTLComputePassSampleBufferAttachmentDescriptor {
30    extern_methods!(
31        #[cfg(feature = "MTLCounters")]
32        /// The sample buffer to store samples for the compute-pass defined samples.
33        /// If sampleBuffer is non-nil, the sample indices will be used to store samples into
34        /// the sample buffer.  If no sample buffer is provided, no samples will be taken.
35        /// If any of the sample indices are specified as MTLCounterDontSample, no sample
36        /// will be taken for that action.
37        #[unsafe(method(sampleBuffer))]
38        #[unsafe(method_family = none)]
39        pub fn sampleBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>>;
40
41        #[cfg(feature = "MTLCounters")]
42        /// Setter for [`sampleBuffer`][Self::sampleBuffer].
43        #[unsafe(method(setSampleBuffer:))]
44        #[unsafe(method_family = none)]
45        pub fn setSampleBuffer(
46            &self,
47            sample_buffer: Option<&ProtocolObject<dyn MTLCounterSampleBuffer>>,
48        );
49
50        /// The sample index to use to store the sample taken at the start of
51        /// command encoder processing.  Setting the value to MTLCounterDontSample will cause
52        /// this sample to be omitted.
53        ///
54        /// On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
55        /// this sample index is invalid and must be set to MTLCounterDontSample or creation of a compute pass will fail.
56        #[unsafe(method(startOfEncoderSampleIndex))]
57        #[unsafe(method_family = none)]
58        pub fn startOfEncoderSampleIndex(&self) -> NSUInteger;
59
60        /// Setter for [`startOfEncoderSampleIndex`][Self::startOfEncoderSampleIndex].
61        ///
62        /// # Safety
63        ///
64        /// This might not be bounds-checked.
65        #[unsafe(method(setStartOfEncoderSampleIndex:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setStartOfEncoderSampleIndex(
68            &self,
69            start_of_encoder_sample_index: NSUInteger,
70        );
71
72        /// The sample index to use to store the sample taken at the end of
73        /// command encoder processing.  Setting the value to MTLCounterDontSample will cause
74        /// this sample to be omitted.
75        ///
76        /// On devices where MTLCounterSamplingPointAtStageBoundary is unsupported,
77        /// this sample index is invalid and must be set to MTLCounterDontSample or creation of a compute pass will fail.
78        #[unsafe(method(endOfEncoderSampleIndex))]
79        #[unsafe(method_family = none)]
80        pub fn endOfEncoderSampleIndex(&self) -> NSUInteger;
81
82        /// Setter for [`endOfEncoderSampleIndex`][Self::endOfEncoderSampleIndex].
83        ///
84        /// # Safety
85        ///
86        /// This might not be bounds-checked.
87        #[unsafe(method(setEndOfEncoderSampleIndex:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setEndOfEncoderSampleIndex(&self, end_of_encoder_sample_index: NSUInteger);
90    );
91}
92
93/// Methods declared on superclass `NSObject`.
94impl MTLComputePassSampleBufferAttachmentDescriptor {
95    extern_methods!(
96        #[unsafe(method(init))]
97        #[unsafe(method_family = init)]
98        pub fn init(this: Allocated<Self>) -> Retained<Self>;
99
100        #[unsafe(method(new))]
101        #[unsafe(method_family = new)]
102        pub fn new() -> Retained<Self>;
103    );
104}
105
106impl DefaultRetained for MTLComputePassSampleBufferAttachmentDescriptor {
107    #[inline]
108    fn default_retained() -> Retained<Self> {
109        Self::new()
110    }
111}
112
113extern_class!(
114    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcomputepasssamplebufferattachmentdescriptorarray?language=objc)
115    #[unsafe(super(NSObject))]
116    #[derive(Debug, PartialEq, Eq, Hash)]
117    pub struct MTLComputePassSampleBufferAttachmentDescriptorArray;
118);
119
120extern_conformance!(
121    unsafe impl NSObjectProtocol for MTLComputePassSampleBufferAttachmentDescriptorArray {}
122);
123
124impl MTLComputePassSampleBufferAttachmentDescriptorArray {
125    extern_methods!(
126        /// # Safety
127        ///
128        /// `attachmentIndex` might not be bounds-checked.
129        #[unsafe(method(objectAtIndexedSubscript:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn objectAtIndexedSubscript(
132            &self,
133            attachment_index: NSUInteger,
134        ) -> Retained<MTLComputePassSampleBufferAttachmentDescriptor>;
135
136        /// # Safety
137        ///
138        /// `attachmentIndex` might not be bounds-checked.
139        #[unsafe(method(setObject:atIndexedSubscript:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn setObject_atIndexedSubscript(
142            &self,
143            attachment: Option<&MTLComputePassSampleBufferAttachmentDescriptor>,
144            attachment_index: NSUInteger,
145        );
146    );
147}
148
149/// Methods declared on superclass `NSObject`.
150impl MTLComputePassSampleBufferAttachmentDescriptorArray {
151    extern_methods!(
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub fn new() -> Retained<Self>;
159    );
160}
161
162impl DefaultRetained for MTLComputePassSampleBufferAttachmentDescriptorArray {
163    #[inline]
164    fn default_retained() -> Retained<Self> {
165        Self::new()
166    }
167}
168
169extern_class!(
170    /// MTLComputePassDescriptor represents a collection of attachments to be used to create a concrete compute command encoder
171    ///
172    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcomputepassdescriptor?language=objc)
173    #[unsafe(super(NSObject))]
174    #[derive(Debug, PartialEq, Eq, Hash)]
175    pub struct MTLComputePassDescriptor;
176);
177
178extern_conformance!(
179    unsafe impl NSCopying for MTLComputePassDescriptor {}
180);
181
182unsafe impl CopyingHelper for MTLComputePassDescriptor {
183    type Result = Self;
184}
185
186extern_conformance!(
187    unsafe impl NSObjectProtocol for MTLComputePassDescriptor {}
188);
189
190impl MTLComputePassDescriptor {
191    extern_methods!(
192        /// Create an autoreleased default frame buffer descriptor
193        #[unsafe(method(computePassDescriptor))]
194        #[unsafe(method_family = none)]
195        pub fn computePassDescriptor() -> Retained<MTLComputePassDescriptor>;
196
197        #[cfg(feature = "MTLCommandBuffer")]
198        /// The dispatch type of the compute command encoder.
199        #[unsafe(method(dispatchType))]
200        #[unsafe(method_family = none)]
201        pub fn dispatchType(&self) -> MTLDispatchType;
202
203        #[cfg(feature = "MTLCommandBuffer")]
204        /// Setter for [`dispatchType`][Self::dispatchType].
205        #[unsafe(method(setDispatchType:))]
206        #[unsafe(method_family = none)]
207        pub fn setDispatchType(&self, dispatch_type: MTLDispatchType);
208
209        /// An array of sample buffers and associated sample indices.
210        #[unsafe(method(sampleBufferAttachments))]
211        #[unsafe(method_family = none)]
212        pub fn sampleBufferAttachments(
213            &self,
214        ) -> Retained<MTLComputePassSampleBufferAttachmentDescriptorArray>;
215    );
216}
217
218/// Methods declared on superclass `NSObject`.
219impl MTLComputePassDescriptor {
220    extern_methods!(
221        #[unsafe(method(init))]
222        #[unsafe(method_family = init)]
223        pub fn init(this: Allocated<Self>) -> Retained<Self>;
224
225        #[unsafe(method(new))]
226        #[unsafe(method_family = new)]
227        pub fn new() -> Retained<Self>;
228    );
229}
230
231impl DefaultRetained for MTLComputePassDescriptor {
232    #[inline]
233    fn default_retained() -> Retained<Self> {
234        Self::new()
235    }
236}