objc2_metal/generated/MTL4ArgumentTable.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 /// Groups parameters for the creation of a Metal argument table.
12 ///
13 /// Argument tables provide resource bindings to your Metal pipeline states.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4argumenttabledescriptor?language=objc)
16 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct MTL4ArgumentTableDescriptor;
19);
20
21extern_conformance!(
22 unsafe impl NSCopying for MTL4ArgumentTableDescriptor {}
23);
24
25unsafe impl CopyingHelper for MTL4ArgumentTableDescriptor {
26 type Result = Self;
27}
28
29extern_conformance!(
30 unsafe impl NSObjectProtocol for MTL4ArgumentTableDescriptor {}
31);
32
33impl MTL4ArgumentTableDescriptor {
34 extern_methods!(
35 /// Determines the number of buffer-binding slots for the argument table.
36 ///
37 /// The maximum value of this parameter is 31.
38 #[unsafe(method(maxBufferBindCount))]
39 #[unsafe(method_family = none)]
40 pub fn maxBufferBindCount(&self) -> NSUInteger;
41
42 /// Setter for [`maxBufferBindCount`][Self::maxBufferBindCount].
43 #[unsafe(method(setMaxBufferBindCount:))]
44 #[unsafe(method_family = none)]
45 pub fn setMaxBufferBindCount(&self, max_buffer_bind_count: NSUInteger);
46
47 /// Determines the number of texture-binding slots for the argument table.
48 ///
49 /// The maximum value of this parameter is 128.
50 #[unsafe(method(maxTextureBindCount))]
51 #[unsafe(method_family = none)]
52 pub fn maxTextureBindCount(&self) -> NSUInteger;
53
54 /// Setter for [`maxTextureBindCount`][Self::maxTextureBindCount].
55 #[unsafe(method(setMaxTextureBindCount:))]
56 #[unsafe(method_family = none)]
57 pub fn setMaxTextureBindCount(&self, max_texture_bind_count: NSUInteger);
58
59 /// Determines the number of sampler state-binding slots for the argument table.
60 ///
61 /// The maximum value of this parameter is 16.
62 #[unsafe(method(maxSamplerStateBindCount))]
63 #[unsafe(method_family = none)]
64 pub fn maxSamplerStateBindCount(&self) -> NSUInteger;
65
66 /// Setter for [`maxSamplerStateBindCount`][Self::maxSamplerStateBindCount].
67 #[unsafe(method(setMaxSamplerStateBindCount:))]
68 #[unsafe(method_family = none)]
69 pub fn setMaxSamplerStateBindCount(&self, max_sampler_state_bind_count: NSUInteger);
70
71 /// Configures whether Metal initializes the bindings to nil values upon creation of argument table.
72 ///
73 /// The default value of this property is
74 /// <doc
75 /// ://com.apple.documentation/documentation/swift/false>.
76 #[unsafe(method(initializeBindings))]
77 #[unsafe(method_family = none)]
78 pub fn initializeBindings(&self) -> bool;
79
80 /// Setter for [`initializeBindings`][Self::initializeBindings].
81 #[unsafe(method(setInitializeBindings:))]
82 #[unsafe(method_family = none)]
83 pub fn setInitializeBindings(&self, initialize_bindings: bool);
84
85 /// Controls whether Metal should reserve memory for attribute strides in the argument table.
86 ///
87 /// Set this value to true if you intend to provide dynamic attribute strides when binding vertex
88 /// array buffers to the argument table by calling ``MTL4ArgumentTable/setAddress:attributeStride:atIndex:``
89 ///
90 /// The default value of this property is
91 /// <doc
92 /// ://com.apple.documentation/documentation/swift/false>.
93 #[unsafe(method(supportAttributeStrides))]
94 #[unsafe(method_family = none)]
95 pub fn supportAttributeStrides(&self) -> bool;
96
97 /// Setter for [`supportAttributeStrides`][Self::supportAttributeStrides].
98 #[unsafe(method(setSupportAttributeStrides:))]
99 #[unsafe(method_family = none)]
100 pub fn setSupportAttributeStrides(&self, support_attribute_strides: bool);
101
102 /// Assigns an optional label with the argument table for debug purposes.
103 #[unsafe(method(label))]
104 #[unsafe(method_family = none)]
105 pub fn label(&self) -> Option<Retained<NSString>>;
106
107 /// Setter for [`label`][Self::label].
108 ///
109 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
110 #[unsafe(method(setLabel:))]
111 #[unsafe(method_family = none)]
112 pub fn setLabel(&self, label: Option<&NSString>);
113 );
114}
115
116/// Methods declared on superclass `NSObject`.
117impl MTL4ArgumentTableDescriptor {
118 extern_methods!(
119 #[unsafe(method(init))]
120 #[unsafe(method_family = init)]
121 pub fn init(this: Allocated<Self>) -> Retained<Self>;
122
123 #[unsafe(method(new))]
124 #[unsafe(method_family = new)]
125 pub fn new() -> Retained<Self>;
126 );
127}
128
129impl DefaultRetained for MTL4ArgumentTableDescriptor {
130 #[inline]
131 fn default_retained() -> Retained<Self> {
132 Self::new()
133 }
134}
135
136extern_protocol!(
137 /// Provides a mechanism to manage and provide resource bindings for buffers, textures, sampler states and other Metal resources.
138 ///
139 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4argumenttable?language=objc)
140 pub unsafe trait MTL4ArgumentTable: NSObjectProtocol {
141 #[cfg(feature = "MTLGPUAddress")]
142 /// Binds a GPU address to a buffer binding slot.
143 ///
144 /// - Parameters:
145 /// - gpuAddress: The GPU address of a ``MTLBuffer`` to set.
146 /// - bindingIndex: a valid binding index in the buffer binding range.
147 /// It is an error for this value to match or exceed the value of property
148 /// ``MTL4ArgumentTableDescriptor/maxBufferBindCount`` on the descriptor
149 /// from which you created this argument table.
150 ///
151 /// # Safety
152 ///
153 /// `bindingIndex` might not be bounds-checked.
154 #[unsafe(method(setAddress:atIndex:))]
155 #[unsafe(method_family = none)]
156 unsafe fn setAddress_atIndex(&self, gpu_address: MTLGPUAddress, binding_index: NSUInteger);
157
158 #[cfg(feature = "MTLGPUAddress")]
159 /// Binds a GPU address to a buffer binding slot, providing a dynamic vertex stride.
160 ///
161 /// This method requires that the value of property ``MTL4ArgumentTableDescriptor/supportAttributeStrides`` on the
162 /// descriptor from which you created this argument table is true.
163 ///
164 /// - Parameters:
165 /// - gpuAddress: The GPU address of a ``MTLBuffer`` to set.
166 /// - stride: The stride between attributes in the buffer.
167 /// - bindingIndex: a valid binding index in the buffer binding range.
168 /// It is an error for this value to match or exceed the value of property
169 /// ``MTL4ArgumentTableDescriptor/maxBufferBindCount`` on the descriptor
170 /// from which you created this argument table.
171 ///
172 /// # Safety
173 ///
174 /// - `stride` might not be bounds-checked.
175 /// - `bindingIndex` might not be bounds-checked.
176 #[unsafe(method(setAddress:attributeStride:atIndex:))]
177 #[unsafe(method_family = none)]
178 unsafe fn setAddress_attributeStride_atIndex(
179 &self,
180 gpu_address: MTLGPUAddress,
181 stride: NSUInteger,
182 binding_index: NSUInteger,
183 );
184
185 #[cfg(feature = "MTLTypes")]
186 /// Binds a resource to a buffer binding slot.
187 ///
188 /// - Parameters:
189 /// - resourceID: The ``MTLResourceID`` of the Metal resource to bind.
190 /// - bindingIndex: a valid binding index in the buffer binding range.
191 /// It is an error for this value to match or exceed the value of property
192 /// ``MTL4ArgumentTableDescriptor/maxBufferBindCount`` on the descriptor
193 /// from which you created this argument table.
194 ///
195 /// # Safety
196 ///
197 /// `bindingIndex` might not be bounds-checked.
198 #[unsafe(method(setResource:atBufferIndex:))]
199 #[unsafe(method_family = none)]
200 unsafe fn setResource_atBufferIndex(
201 &self,
202 resource_id: MTLResourceID,
203 binding_index: NSUInteger,
204 );
205
206 #[cfg(feature = "MTLTypes")]
207 /// Binds a texture to a texture binding slot.
208 ///
209 /// - Parameters:
210 /// - resourceID: The ``MTLResourceID`` of the ``MTLTexture`` instance to bind.
211 /// - bindingIndex: a valid binding index in the texture binding range.
212 /// It is an error for this value to match or exceed the value of property
213 /// ``MTL4ArgumentTableDescriptor/maxTextureBindCount`` on the descriptor
214 /// from which you created this argument table.
215 ///
216 /// # Safety
217 ///
218 /// `bindingIndex` might not be bounds-checked.
219 #[unsafe(method(setTexture:atIndex:))]
220 #[unsafe(method_family = none)]
221 unsafe fn setTexture_atIndex(&self, resource_id: MTLResourceID, binding_index: NSUInteger);
222
223 #[cfg(feature = "MTLTypes")]
224 /// Binds a sampler state to a sampler state binding slot.
225 ///
226 /// - Parameters:
227 /// - resourceID: The ``MTLResourceID`` of the ``MTLSamplerState`` instance to bind.
228 /// - bindingIndex: a valid binding index in the sampler binding range.
229 /// It is an error for this value to match or exceed the value of property
230 /// ``MTL4ArgumentTableDescriptor/maxSamplerStateBindCount`` on the descriptor
231 /// from which you created this argument table.
232 ///
233 /// # Safety
234 ///
235 /// `bindingIndex` might not be bounds-checked.
236 #[unsafe(method(setSamplerState:atIndex:))]
237 #[unsafe(method_family = none)]
238 unsafe fn setSamplerState_atIndex(
239 &self,
240 resource_id: MTLResourceID,
241 binding_index: NSUInteger,
242 );
243
244 #[cfg(feature = "MTLDevice")]
245 /// The device from which you created this argument table.
246 #[unsafe(method(device))]
247 #[unsafe(method_family = none)]
248 fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
249
250 /// Assigns an optional label with this argument table for debugging purposes.
251 ///
252 /// You set this label by setting property ``MTL4ArgumentTableDescriptor/label`` on the descriptor object, prior to
253 /// creating this table instance.
254 #[unsafe(method(label))]
255 #[unsafe(method_family = none)]
256 fn label(&self) -> Option<Retained<NSString>>;
257 }
258);