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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
//! 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_class!(
/// Groups parameters for the creation of a Metal argument table.
///
/// Argument tables provide resource bindings to your Metal pipeline states.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4argumenttabledescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTL4ArgumentTableDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTL4ArgumentTableDescriptor {}
);
unsafe impl CopyingHelper for MTL4ArgumentTableDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTL4ArgumentTableDescriptor {}
);
impl MTL4ArgumentTableDescriptor {
extern_methods!(
/// Determines the number of buffer-binding slots for the argument table.
///
/// The maximum value of this parameter is 31.
#[unsafe(method(maxBufferBindCount))]
#[unsafe(method_family = none)]
pub fn maxBufferBindCount(&self) -> NSUInteger;
/// Setter for [`maxBufferBindCount`][Self::maxBufferBindCount].
#[unsafe(method(setMaxBufferBindCount:))]
#[unsafe(method_family = none)]
pub fn setMaxBufferBindCount(&self, max_buffer_bind_count: NSUInteger);
/// Determines the number of texture-binding slots for the argument table.
///
/// The maximum value of this parameter is 128.
#[unsafe(method(maxTextureBindCount))]
#[unsafe(method_family = none)]
pub fn maxTextureBindCount(&self) -> NSUInteger;
/// Setter for [`maxTextureBindCount`][Self::maxTextureBindCount].
#[unsafe(method(setMaxTextureBindCount:))]
#[unsafe(method_family = none)]
pub fn setMaxTextureBindCount(&self, max_texture_bind_count: NSUInteger);
/// Determines the number of sampler state-binding slots for the argument table.
///
/// The maximum value of this parameter is 16.
#[unsafe(method(maxSamplerStateBindCount))]
#[unsafe(method_family = none)]
pub fn maxSamplerStateBindCount(&self) -> NSUInteger;
/// Setter for [`maxSamplerStateBindCount`][Self::maxSamplerStateBindCount].
#[unsafe(method(setMaxSamplerStateBindCount:))]
#[unsafe(method_family = none)]
pub fn setMaxSamplerStateBindCount(&self, max_sampler_state_bind_count: NSUInteger);
/// Configures whether Metal initializes the bindings to nil values upon creation of argument table.
///
/// The default value of this property is
/// <doc
/// ://com.apple.documentation/documentation/swift/false>.
#[unsafe(method(initializeBindings))]
#[unsafe(method_family = none)]
pub fn initializeBindings(&self) -> bool;
/// Setter for [`initializeBindings`][Self::initializeBindings].
#[unsafe(method(setInitializeBindings:))]
#[unsafe(method_family = none)]
pub fn setInitializeBindings(&self, initialize_bindings: bool);
/// Controls whether Metal should reserve memory for attribute strides in the argument table.
///
/// Set this value to true if you intend to provide dynamic attribute strides when binding vertex
/// array buffers to the argument table by calling ``MTL4ArgumentTable/setAddress:attributeStride:atIndex:``
///
/// The default value of this property is
/// <doc
/// ://com.apple.documentation/documentation/swift/false>.
#[unsafe(method(supportAttributeStrides))]
#[unsafe(method_family = none)]
pub fn supportAttributeStrides(&self) -> bool;
/// Setter for [`supportAttributeStrides`][Self::supportAttributeStrides].
#[unsafe(method(setSupportAttributeStrides:))]
#[unsafe(method_family = none)]
pub fn setSupportAttributeStrides(&self, support_attribute_strides: bool);
/// Assigns an optional label with the argument table for debug purposes.
#[unsafe(method(label))]
#[unsafe(method_family = none)]
pub 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)]
pub fn setLabel(&self, label: Option<&NSString>);
);
}
/// Methods declared on superclass `NSObject`.
impl MTL4ArgumentTableDescriptor {
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 MTL4ArgumentTableDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
/// Provides a mechanism to manage and provide resource bindings for buffers, textures, sampler states and other Metal resources.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4argumenttable?language=objc)
pub unsafe trait MTL4ArgumentTable: NSObjectProtocol {
#[cfg(feature = "MTLGPUAddress")]
/// Binds a GPU address to a buffer binding slot.
///
/// - Parameters:
/// - gpuAddress: The GPU address of a ``MTLBuffer`` to set.
/// - bindingIndex: a valid binding index in the buffer binding range.
/// It is an error for this value to match or exceed the value of property
/// ``MTL4ArgumentTableDescriptor/maxBufferBindCount`` on the descriptor
/// from which you created this argument table.
///
/// # Safety
///
/// `bindingIndex` might not be bounds-checked.
#[unsafe(method(setAddress:atIndex:))]
#[unsafe(method_family = none)]
unsafe fn setAddress_atIndex(&self, gpu_address: MTLGPUAddress, binding_index: NSUInteger);
#[cfg(feature = "MTLGPUAddress")]
/// Binds a GPU address to a buffer binding slot, providing a dynamic vertex stride.
///
/// This method requires that the value of property ``MTL4ArgumentTableDescriptor/supportAttributeStrides`` on the
/// descriptor from which you created this argument table is true.
///
/// - Parameters:
/// - gpuAddress: The GPU address of a ``MTLBuffer`` to set.
/// - stride: The stride between attributes in the buffer.
/// - bindingIndex: a valid binding index in the buffer binding range.
/// It is an error for this value to match or exceed the value of property
/// ``MTL4ArgumentTableDescriptor/maxBufferBindCount`` on the descriptor
/// from which you created this argument table.
///
/// # Safety
///
/// - `stride` might not be bounds-checked.
/// - `bindingIndex` might not be bounds-checked.
#[unsafe(method(setAddress:attributeStride:atIndex:))]
#[unsafe(method_family = none)]
unsafe fn setAddress_attributeStride_atIndex(
&self,
gpu_address: MTLGPUAddress,
stride: NSUInteger,
binding_index: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
/// Binds a resource to a buffer binding slot.
///
/// - Parameters:
/// - resourceID: The ``MTLResourceID`` of the Metal resource to bind.
/// - bindingIndex: a valid binding index in the buffer binding range.
/// It is an error for this value to match or exceed the value of property
/// ``MTL4ArgumentTableDescriptor/maxBufferBindCount`` on the descriptor
/// from which you created this argument table.
///
/// # Safety
///
/// `bindingIndex` might not be bounds-checked.
#[unsafe(method(setResource:atBufferIndex:))]
#[unsafe(method_family = none)]
unsafe fn setResource_atBufferIndex(
&self,
resource_id: MTLResourceID,
binding_index: NSUInteger,
);
#[cfg(feature = "MTLTypes")]
/// Binds a texture to a texture binding slot.
///
/// - Parameters:
/// - resourceID: The ``MTLResourceID`` of the ``MTLTexture`` instance to bind.
/// - bindingIndex: a valid binding index in the texture binding range.
/// It is an error for this value to match or exceed the value of property
/// ``MTL4ArgumentTableDescriptor/maxTextureBindCount`` on the descriptor
/// from which you created this argument table.
///
/// # Safety
///
/// `bindingIndex` might not be bounds-checked.
#[unsafe(method(setTexture:atIndex:))]
#[unsafe(method_family = none)]
unsafe fn setTexture_atIndex(&self, resource_id: MTLResourceID, binding_index: NSUInteger);
#[cfg(feature = "MTLTypes")]
/// Binds a sampler state to a sampler state binding slot.
///
/// - Parameters:
/// - resourceID: The ``MTLResourceID`` of the ``MTLSamplerState`` instance to bind.
/// - bindingIndex: a valid binding index in the sampler binding range.
/// It is an error for this value to match or exceed the value of property
/// ``MTL4ArgumentTableDescriptor/maxSamplerStateBindCount`` on the descriptor
/// from which you created this argument table.
///
/// # Safety
///
/// `bindingIndex` might not be bounds-checked.
#[unsafe(method(setSamplerState:atIndex:))]
#[unsafe(method_family = none)]
unsafe fn setSamplerState_atIndex(
&self,
resource_id: MTLResourceID,
binding_index: NSUInteger,
);
#[cfg(feature = "MTLDevice")]
/// The device from which you created this argument table.
#[unsafe(method(device))]
#[unsafe(method_family = none)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
/// Assigns an optional label with this argument table for debugging purposes.
///
/// You set this label by setting property ``MTL4ArgumentTableDescriptor/label`` on the descriptor object, prior to
/// creating this table instance.
#[unsafe(method(label))]
#[unsafe(method_family = none)]
fn label(&self) -> Option<Retained<NSString>>;
}
);