objc2_metal/generated/
MTLCommandQueue.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_protocol!(
11    /// A serial queue of command buffers to be executed by the device.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcommandqueue?language=objc)
14    pub unsafe trait MTLCommandQueue: NSObjectProtocol + Send + Sync {
15        /// A string to help identify this object
16        #[unsafe(method(label))]
17        #[unsafe(method_family = none)]
18        fn label(&self) -> Option<Retained<NSString>>;
19
20        /// Setter for [`label`][Self::label].
21        ///
22        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
23        #[unsafe(method(setLabel:))]
24        #[unsafe(method_family = none)]
25        fn setLabel(&self, label: Option<&NSString>);
26
27        #[cfg(feature = "MTLDevice")]
28        /// The device this queue will submit to
29        #[unsafe(method(device))]
30        #[unsafe(method_family = none)]
31        fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
32
33        #[cfg(feature = "MTLCommandBuffer")]
34        /// Returns a new autoreleased command buffer used to encode work into this queue that
35        /// maintains strong references to resources used within the command buffer.
36        #[unsafe(method(commandBuffer))]
37        #[unsafe(method_family = none)]
38        fn commandBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>;
39
40        #[cfg(feature = "MTLCommandBuffer")]
41        /// Parameter `descriptor`: The requested properties of the command buffer.
42        ///
43        /// Returns a new autoreleased command buffer used to encode work into this queue.
44        #[unsafe(method(commandBufferWithDescriptor:))]
45        #[unsafe(method_family = none)]
46        fn commandBufferWithDescriptor(
47            &self,
48            descriptor: &MTLCommandBufferDescriptor,
49        ) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>;
50
51        #[cfg(feature = "MTLCommandBuffer")]
52        /// Returns a new autoreleased command buffer used to encode work into this queue that
53        /// does not maintain strong references to resources used within the command buffer.
54        #[unsafe(method(commandBufferWithUnretainedReferences))]
55        #[unsafe(method_family = none)]
56        fn commandBufferWithUnretainedReferences(
57            &self,
58        ) -> Option<Retained<ProtocolObject<dyn MTLCommandBuffer>>>;
59
60        /// Inform Xcode about when debug capture should start and stop.
61        #[deprecated = "Use MTLCaptureScope instead"]
62        #[unsafe(method(insertDebugCaptureBoundary))]
63        #[unsafe(method_family = none)]
64        fn insertDebugCaptureBoundary(&self);
65
66        #[cfg(feature = "MTLResidencySet")]
67        /// Marks the residency set as part of the command queue execution. This ensures that the residency set is resident during execution of all the command buffers within the queue.
68        #[unsafe(method(addResidencySet:))]
69        #[unsafe(method_family = none)]
70        fn addResidencySet(&self, residency_set: &ProtocolObject<dyn MTLResidencySet>);
71
72        #[cfg(feature = "MTLResidencySet")]
73        /// Marks the residency sets as part of the command queue execution. This ensures that the residency sets are resident during execution of all the command buffers within the queue.
74        ///
75        /// # Safety
76        ///
77        /// - `residency_sets` must be a valid pointer.
78        /// - `count` might not be bounds-checked.
79        #[unsafe(method(addResidencySets:count:))]
80        #[unsafe(method_family = none)]
81        unsafe fn addResidencySets_count(
82            &self,
83            residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>,
84            count: NSUInteger,
85        );
86
87        #[cfg(feature = "MTLResidencySet")]
88        /// Removes the residency set from the command queue execution. This ensures that only the remaining residency sets are resident during execution of all the command buffers within the queue.
89        #[unsafe(method(removeResidencySet:))]
90        #[unsafe(method_family = none)]
91        fn removeResidencySet(&self, residency_set: &ProtocolObject<dyn MTLResidencySet>);
92
93        #[cfg(feature = "MTLResidencySet")]
94        /// Removes the residency sets from the command queue execution. This ensures that only the remaining residency sets are resident during execution of all the command buffers within the queue.
95        ///
96        /// # Safety
97        ///
98        /// - `residency_sets` must be a valid pointer.
99        /// - `count` might not be bounds-checked.
100        #[unsafe(method(removeResidencySets:count:))]
101        #[unsafe(method_family = none)]
102        unsafe fn removeResidencySets_count(
103            &self,
104            residency_sets: NonNull<NonNull<ProtocolObject<dyn MTLResidencySet>>>,
105            count: NSUInteger,
106        );
107    }
108);
109
110extern_class!(
111    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcommandqueuedescriptor?language=objc)
112    #[unsafe(super(NSObject))]
113    #[derive(Debug, PartialEq, Eq, Hash)]
114    pub struct MTLCommandQueueDescriptor;
115);
116
117extern_conformance!(
118    unsafe impl NSCopying for MTLCommandQueueDescriptor {}
119);
120
121unsafe impl CopyingHelper for MTLCommandQueueDescriptor {
122    type Result = Self;
123}
124
125extern_conformance!(
126    unsafe impl NSObjectProtocol for MTLCommandQueueDescriptor {}
127);
128
129impl MTLCommandQueueDescriptor {
130    extern_methods!(
131        /// @
132        /// Specify upper bound on uncompleted command buffers that may be enqueued on this queue
133        #[unsafe(method(maxCommandBufferCount))]
134        #[unsafe(method_family = none)]
135        pub fn maxCommandBufferCount(&self) -> NSUInteger;
136
137        /// Setter for [`maxCommandBufferCount`][Self::maxCommandBufferCount].
138        ///
139        /// # Safety
140        ///
141        /// This might not be bounds-checked.
142        #[unsafe(method(setMaxCommandBufferCount:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setMaxCommandBufferCount(&self, max_command_buffer_count: NSUInteger);
145
146        #[cfg(feature = "MTLLogState")]
147        /// @
148        /// Specify the MTLLogState to enable shader logging
149        #[unsafe(method(logState))]
150        #[unsafe(method_family = none)]
151        pub fn logState(&self) -> Option<Retained<ProtocolObject<dyn MTLLogState>>>;
152
153        #[cfg(feature = "MTLLogState")]
154        /// Setter for [`logState`][Self::logState].
155        #[unsafe(method(setLogState:))]
156        #[unsafe(method_family = none)]
157        pub fn setLogState(&self, log_state: Option<&ProtocolObject<dyn MTLLogState>>);
158    );
159}
160
161/// Methods declared on superclass `NSObject`.
162impl MTLCommandQueueDescriptor {
163    extern_methods!(
164        #[unsafe(method(init))]
165        #[unsafe(method_family = init)]
166        pub fn init(this: Allocated<Self>) -> Retained<Self>;
167
168        #[unsafe(method(new))]
169        #[unsafe(method_family = new)]
170        pub fn new() -> Retained<Self>;
171    );
172}
173
174impl DefaultRetained for MTLCommandQueueDescriptor {
175    #[inline]
176    fn default_retained() -> Retained<Self> {
177        Self::new()
178    }
179}