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