1use crate::common::*;
4use crate::Foundation::*;
5use crate::Metal::*;
6
7ns_enum!(
8 #[underlying(NSUInteger)]
9 pub enum MTLVertexFormat {
10 MTLVertexFormatInvalid = 0,
11 MTLVertexFormatUChar2 = 1,
12 MTLVertexFormatUChar3 = 2,
13 MTLVertexFormatUChar4 = 3,
14 MTLVertexFormatChar2 = 4,
15 MTLVertexFormatChar3 = 5,
16 MTLVertexFormatChar4 = 6,
17 MTLVertexFormatUChar2Normalized = 7,
18 MTLVertexFormatUChar3Normalized = 8,
19 MTLVertexFormatUChar4Normalized = 9,
20 MTLVertexFormatChar2Normalized = 10,
21 MTLVertexFormatChar3Normalized = 11,
22 MTLVertexFormatChar4Normalized = 12,
23 MTLVertexFormatUShort2 = 13,
24 MTLVertexFormatUShort3 = 14,
25 MTLVertexFormatUShort4 = 15,
26 MTLVertexFormatShort2 = 16,
27 MTLVertexFormatShort3 = 17,
28 MTLVertexFormatShort4 = 18,
29 MTLVertexFormatUShort2Normalized = 19,
30 MTLVertexFormatUShort3Normalized = 20,
31 MTLVertexFormatUShort4Normalized = 21,
32 MTLVertexFormatShort2Normalized = 22,
33 MTLVertexFormatShort3Normalized = 23,
34 MTLVertexFormatShort4Normalized = 24,
35 MTLVertexFormatHalf2 = 25,
36 MTLVertexFormatHalf3 = 26,
37 MTLVertexFormatHalf4 = 27,
38 MTLVertexFormatFloat = 28,
39 MTLVertexFormatFloat2 = 29,
40 MTLVertexFormatFloat3 = 30,
41 MTLVertexFormatFloat4 = 31,
42 MTLVertexFormatInt = 32,
43 MTLVertexFormatInt2 = 33,
44 MTLVertexFormatInt3 = 34,
45 MTLVertexFormatInt4 = 35,
46 MTLVertexFormatUInt = 36,
47 MTLVertexFormatUInt2 = 37,
48 MTLVertexFormatUInt3 = 38,
49 MTLVertexFormatUInt4 = 39,
50 MTLVertexFormatInt1010102Normalized = 40,
51 MTLVertexFormatUInt1010102Normalized = 41,
52 MTLVertexFormatUChar4Normalized_BGRA = 42,
53 MTLVertexFormatUChar = 45,
54 MTLVertexFormatChar = 46,
55 MTLVertexFormatUCharNormalized = 47,
56 MTLVertexFormatCharNormalized = 48,
57 MTLVertexFormatUShort = 49,
58 MTLVertexFormatShort = 50,
59 MTLVertexFormatUShortNormalized = 51,
60 MTLVertexFormatShortNormalized = 52,
61 MTLVertexFormatHalf = 53,
62 MTLVertexFormatFloatRG11B10 = 54,
63 MTLVertexFormatFloatRGB9E5 = 55,
64 }
65);
66
67ns_enum!(
68 #[underlying(NSUInteger)]
69 pub enum MTLVertexStepFunction {
70 MTLVertexStepFunctionConstant = 0,
71 MTLVertexStepFunctionPerVertex = 1,
72 MTLVertexStepFunctionPerInstance = 2,
73 MTLVertexStepFunctionPerPatch = 3,
74 MTLVertexStepFunctionPerPatchControlPoint = 4,
75 }
76);
77
78extern_class!(
79 #[derive(Debug, PartialEq, Eq, Hash)]
80 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
81 pub struct MTLVertexBufferLayoutDescriptor;
82
83 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
84 unsafe impl ClassType for MTLVertexBufferLayoutDescriptor {
85 type Super = NSObject;
86 type Mutability = InteriorMutable;
87 }
88);
89
90#[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
91unsafe impl NSCopying for MTLVertexBufferLayoutDescriptor {}
92
93#[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
94unsafe impl NSObjectProtocol for MTLVertexBufferLayoutDescriptor {}
95
96extern_methods!(
97 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
98 unsafe impl MTLVertexBufferLayoutDescriptor {
99 #[method(stride)]
100 pub fn stride(&self) -> NSUInteger;
101
102 #[method(setStride:)]
103 pub unsafe fn setStride(&self, stride: NSUInteger);
104
105 #[method(stepFunction)]
106 pub fn stepFunction(&self) -> MTLVertexStepFunction;
107
108 #[method(setStepFunction:)]
109 pub unsafe fn setStepFunction(&self, step_function: MTLVertexStepFunction);
110
111 #[method(stepRate)]
112 pub fn stepRate(&self) -> NSUInteger;
113
114 #[method(setStepRate:)]
115 pub unsafe fn setStepRate(&self, step_rate: NSUInteger);
116 }
117);
118
119extern_methods!(
120 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
122 unsafe impl MTLVertexBufferLayoutDescriptor {
123 #[method_id(@__retain_semantics Init init)]
124 pub fn init(this: Allocated<Self>) -> Id<Self>;
125
126 #[method_id(@__retain_semantics New new)]
127 pub fn new() -> Id<Self>;
128 }
129);
130
131#[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
132impl DefaultId for MTLVertexBufferLayoutDescriptor {
133 #[inline]
134 fn default_id() -> Id<Self> {
135 Self::new()
136 }
137}
138
139extern_class!(
140 #[derive(Debug, PartialEq, Eq, Hash)]
141 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptorArray")]
142 pub struct MTLVertexBufferLayoutDescriptorArray;
143
144 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptorArray")]
145 unsafe impl ClassType for MTLVertexBufferLayoutDescriptorArray {
146 type Super = NSObject;
147 type Mutability = InteriorMutable;
148 }
149);
150
151#[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptorArray")]
152unsafe impl NSObjectProtocol for MTLVertexBufferLayoutDescriptorArray {}
153
154extern_methods!(
155 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptorArray")]
156 unsafe impl MTLVertexBufferLayoutDescriptorArray {
157 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
158 #[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
159 pub unsafe fn objectAtIndexedSubscript(
160 &self,
161 index: NSUInteger,
162 ) -> Id<MTLVertexBufferLayoutDescriptor>;
163
164 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptor")]
165 #[method(setObject:atIndexedSubscript:)]
166 pub unsafe fn setObject_atIndexedSubscript(
167 &self,
168 buffer_desc: Option<&MTLVertexBufferLayoutDescriptor>,
169 index: NSUInteger,
170 );
171 }
172);
173
174extern_methods!(
175 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptorArray")]
177 unsafe impl MTLVertexBufferLayoutDescriptorArray {
178 #[method_id(@__retain_semantics Init init)]
179 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
180
181 #[method_id(@__retain_semantics New new)]
182 pub unsafe fn new() -> Id<Self>;
183 }
184);
185
186extern_class!(
187 #[derive(Debug, PartialEq, Eq, Hash)]
188 #[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
189 pub struct MTLVertexAttributeDescriptor;
190
191 #[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
192 unsafe impl ClassType for MTLVertexAttributeDescriptor {
193 type Super = NSObject;
194 type Mutability = InteriorMutable;
195 }
196);
197
198#[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
199unsafe impl NSCopying for MTLVertexAttributeDescriptor {}
200
201#[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
202unsafe impl NSObjectProtocol for MTLVertexAttributeDescriptor {}
203
204extern_methods!(
205 #[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
206 unsafe impl MTLVertexAttributeDescriptor {
207 #[method(format)]
208 pub fn format(&self) -> MTLVertexFormat;
209
210 #[method(setFormat:)]
211 pub fn setFormat(&self, format: MTLVertexFormat);
212
213 #[method(offset)]
214 pub fn offset(&self) -> NSUInteger;
215
216 #[method(setOffset:)]
217 pub unsafe fn setOffset(&self, offset: NSUInteger);
218
219 #[method(bufferIndex)]
220 pub fn bufferIndex(&self) -> NSUInteger;
221
222 #[method(setBufferIndex:)]
223 pub unsafe fn setBufferIndex(&self, buffer_index: NSUInteger);
224 }
225);
226
227extern_methods!(
228 #[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
230 unsafe impl MTLVertexAttributeDescriptor {
231 #[method_id(@__retain_semantics Init init)]
232 pub fn init(this: Allocated<Self>) -> Id<Self>;
233
234 #[method_id(@__retain_semantics New new)]
235 pub fn new() -> Id<Self>;
236 }
237);
238
239#[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
240impl DefaultId for MTLVertexAttributeDescriptor {
241 #[inline]
242 fn default_id() -> Id<Self> {
243 Self::new()
244 }
245}
246
247extern_class!(
248 #[derive(Debug, PartialEq, Eq, Hash)]
249 #[cfg(feature = "Metal_MTLVertexAttributeDescriptorArray")]
250 pub struct MTLVertexAttributeDescriptorArray;
251
252 #[cfg(feature = "Metal_MTLVertexAttributeDescriptorArray")]
253 unsafe impl ClassType for MTLVertexAttributeDescriptorArray {
254 type Super = NSObject;
255 type Mutability = InteriorMutable;
256 }
257);
258
259#[cfg(feature = "Metal_MTLVertexAttributeDescriptorArray")]
260unsafe impl NSObjectProtocol for MTLVertexAttributeDescriptorArray {}
261
262extern_methods!(
263 #[cfg(feature = "Metal_MTLVertexAttributeDescriptorArray")]
264 unsafe impl MTLVertexAttributeDescriptorArray {
265 #[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
266 #[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
267 pub unsafe fn objectAtIndexedSubscript(
268 &self,
269 index: NSUInteger,
270 ) -> Id<MTLVertexAttributeDescriptor>;
271
272 #[cfg(feature = "Metal_MTLVertexAttributeDescriptor")]
273 #[method(setObject:atIndexedSubscript:)]
274 pub unsafe fn setObject_atIndexedSubscript(
275 &self,
276 attribute_desc: Option<&MTLVertexAttributeDescriptor>,
277 index: NSUInteger,
278 );
279 }
280);
281
282extern_methods!(
283 #[cfg(feature = "Metal_MTLVertexAttributeDescriptorArray")]
285 unsafe impl MTLVertexAttributeDescriptorArray {
286 #[method_id(@__retain_semantics Init init)]
287 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
288
289 #[method_id(@__retain_semantics New new)]
290 pub unsafe fn new() -> Id<Self>;
291 }
292);
293
294extern_class!(
295 #[derive(Debug, PartialEq, Eq, Hash)]
296 #[cfg(feature = "Metal_MTLVertexDescriptor")]
297 pub struct MTLVertexDescriptor;
298
299 #[cfg(feature = "Metal_MTLVertexDescriptor")]
300 unsafe impl ClassType for MTLVertexDescriptor {
301 type Super = NSObject;
302 type Mutability = InteriorMutable;
303 }
304);
305
306#[cfg(feature = "Metal_MTLVertexDescriptor")]
307unsafe impl NSCopying for MTLVertexDescriptor {}
308
309#[cfg(feature = "Metal_MTLVertexDescriptor")]
310unsafe impl NSObjectProtocol for MTLVertexDescriptor {}
311
312extern_methods!(
313 #[cfg(feature = "Metal_MTLVertexDescriptor")]
314 unsafe impl MTLVertexDescriptor {
315 #[method_id(@__retain_semantics Other vertexDescriptor)]
316 pub fn vertexDescriptor() -> Id<MTLVertexDescriptor>;
317
318 #[cfg(feature = "Metal_MTLVertexBufferLayoutDescriptorArray")]
319 #[method_id(@__retain_semantics Other layouts)]
320 pub fn layouts(&self) -> Id<MTLVertexBufferLayoutDescriptorArray>;
321
322 #[cfg(feature = "Metal_MTLVertexAttributeDescriptorArray")]
323 #[method_id(@__retain_semantics Other attributes)]
324 pub fn attributes(&self) -> Id<MTLVertexAttributeDescriptorArray>;
325
326 #[method(reset)]
327 pub fn reset(&self);
328 }
329);
330
331extern_methods!(
332 #[cfg(feature = "Metal_MTLVertexDescriptor")]
334 unsafe impl MTLVertexDescriptor {
335 #[method_id(@__retain_semantics Init init)]
336 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
337
338 #[method_id(@__retain_semantics New new)]
339 pub unsafe fn new() -> Id<Self>;
340 }
341);