objc2_metal/generated/
MTLVertexDescriptor.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct MTLVertexFormat(pub NSUInteger);
17impl MTLVertexFormat {
18 #[doc(alias = "MTLVertexFormatInvalid")]
19 pub const Invalid: Self = Self(0);
20 #[doc(alias = "MTLVertexFormatUChar2")]
21 pub const UChar2: Self = Self(1);
22 #[doc(alias = "MTLVertexFormatUChar3")]
23 pub const UChar3: Self = Self(2);
24 #[doc(alias = "MTLVertexFormatUChar4")]
25 pub const UChar4: Self = Self(3);
26 #[doc(alias = "MTLVertexFormatChar2")]
27 pub const Char2: Self = Self(4);
28 #[doc(alias = "MTLVertexFormatChar3")]
29 pub const Char3: Self = Self(5);
30 #[doc(alias = "MTLVertexFormatChar4")]
31 pub const Char4: Self = Self(6);
32 #[doc(alias = "MTLVertexFormatUChar2Normalized")]
33 pub const UChar2Normalized: Self = Self(7);
34 #[doc(alias = "MTLVertexFormatUChar3Normalized")]
35 pub const UChar3Normalized: Self = Self(8);
36 #[doc(alias = "MTLVertexFormatUChar4Normalized")]
37 pub const UChar4Normalized: Self = Self(9);
38 #[doc(alias = "MTLVertexFormatChar2Normalized")]
39 pub const Char2Normalized: Self = Self(10);
40 #[doc(alias = "MTLVertexFormatChar3Normalized")]
41 pub const Char3Normalized: Self = Self(11);
42 #[doc(alias = "MTLVertexFormatChar4Normalized")]
43 pub const Char4Normalized: Self = Self(12);
44 #[doc(alias = "MTLVertexFormatUShort2")]
45 pub const UShort2: Self = Self(13);
46 #[doc(alias = "MTLVertexFormatUShort3")]
47 pub const UShort3: Self = Self(14);
48 #[doc(alias = "MTLVertexFormatUShort4")]
49 pub const UShort4: Self = Self(15);
50 #[doc(alias = "MTLVertexFormatShort2")]
51 pub const Short2: Self = Self(16);
52 #[doc(alias = "MTLVertexFormatShort3")]
53 pub const Short3: Self = Self(17);
54 #[doc(alias = "MTLVertexFormatShort4")]
55 pub const Short4: Self = Self(18);
56 #[doc(alias = "MTLVertexFormatUShort2Normalized")]
57 pub const UShort2Normalized: Self = Self(19);
58 #[doc(alias = "MTLVertexFormatUShort3Normalized")]
59 pub const UShort3Normalized: Self = Self(20);
60 #[doc(alias = "MTLVertexFormatUShort4Normalized")]
61 pub const UShort4Normalized: Self = Self(21);
62 #[doc(alias = "MTLVertexFormatShort2Normalized")]
63 pub const Short2Normalized: Self = Self(22);
64 #[doc(alias = "MTLVertexFormatShort3Normalized")]
65 pub const Short3Normalized: Self = Self(23);
66 #[doc(alias = "MTLVertexFormatShort4Normalized")]
67 pub const Short4Normalized: Self = Self(24);
68 #[doc(alias = "MTLVertexFormatHalf2")]
69 pub const Half2: Self = Self(25);
70 #[doc(alias = "MTLVertexFormatHalf3")]
71 pub const Half3: Self = Self(26);
72 #[doc(alias = "MTLVertexFormatHalf4")]
73 pub const Half4: Self = Self(27);
74 #[doc(alias = "MTLVertexFormatFloat")]
75 pub const Float: Self = Self(28);
76 #[doc(alias = "MTLVertexFormatFloat2")]
77 pub const Float2: Self = Self(29);
78 #[doc(alias = "MTLVertexFormatFloat3")]
79 pub const Float3: Self = Self(30);
80 #[doc(alias = "MTLVertexFormatFloat4")]
81 pub const Float4: Self = Self(31);
82 #[doc(alias = "MTLVertexFormatInt")]
83 pub const Int: Self = Self(32);
84 #[doc(alias = "MTLVertexFormatInt2")]
85 pub const Int2: Self = Self(33);
86 #[doc(alias = "MTLVertexFormatInt3")]
87 pub const Int3: Self = Self(34);
88 #[doc(alias = "MTLVertexFormatInt4")]
89 pub const Int4: Self = Self(35);
90 #[doc(alias = "MTLVertexFormatUInt")]
91 pub const UInt: Self = Self(36);
92 #[doc(alias = "MTLVertexFormatUInt2")]
93 pub const UInt2: Self = Self(37);
94 #[doc(alias = "MTLVertexFormatUInt3")]
95 pub const UInt3: Self = Self(38);
96 #[doc(alias = "MTLVertexFormatUInt4")]
97 pub const UInt4: Self = Self(39);
98 #[doc(alias = "MTLVertexFormatInt1010102Normalized")]
99 pub const Int1010102Normalized: Self = Self(40);
100 #[doc(alias = "MTLVertexFormatUInt1010102Normalized")]
101 pub const UInt1010102Normalized: Self = Self(41);
102 #[doc(alias = "MTLVertexFormatUChar4Normalized_BGRA")]
103 pub const UChar4Normalized_BGRA: Self = Self(42);
104 #[doc(alias = "MTLVertexFormatUChar")]
105 pub const UChar: Self = Self(45);
106 #[doc(alias = "MTLVertexFormatChar")]
107 pub const Char: Self = Self(46);
108 #[doc(alias = "MTLVertexFormatUCharNormalized")]
109 pub const UCharNormalized: Self = Self(47);
110 #[doc(alias = "MTLVertexFormatCharNormalized")]
111 pub const CharNormalized: Self = Self(48);
112 #[doc(alias = "MTLVertexFormatUShort")]
113 pub const UShort: Self = Self(49);
114 #[doc(alias = "MTLVertexFormatShort")]
115 pub const Short: Self = Self(50);
116 #[doc(alias = "MTLVertexFormatUShortNormalized")]
117 pub const UShortNormalized: Self = Self(51);
118 #[doc(alias = "MTLVertexFormatShortNormalized")]
119 pub const ShortNormalized: Self = Self(52);
120 #[doc(alias = "MTLVertexFormatHalf")]
121 pub const Half: Self = Self(53);
122 #[doc(alias = "MTLVertexFormatFloatRG11B10")]
123 pub const FloatRG11B10: Self = Self(54);
124 #[doc(alias = "MTLVertexFormatFloatRGB9E5")]
125 pub const FloatRGB9E5: Self = Self(55);
126}
127
128unsafe impl Encode for MTLVertexFormat {
129 const ENCODING: Encoding = NSUInteger::ENCODING;
130}
131
132unsafe impl RefEncode for MTLVertexFormat {
133 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
134}
135
136#[repr(transparent)]
139#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
140pub struct MTLVertexStepFunction(pub NSUInteger);
141impl MTLVertexStepFunction {
142 #[doc(alias = "MTLVertexStepFunctionConstant")]
143 pub const Constant: Self = Self(0);
144 #[doc(alias = "MTLVertexStepFunctionPerVertex")]
145 pub const PerVertex: Self = Self(1);
146 #[doc(alias = "MTLVertexStepFunctionPerInstance")]
147 pub const PerInstance: Self = Self(2);
148 #[doc(alias = "MTLVertexStepFunctionPerPatch")]
149 pub const PerPatch: Self = Self(3);
150 #[doc(alias = "MTLVertexStepFunctionPerPatchControlPoint")]
151 pub const PerPatchControlPoint: Self = Self(4);
152}
153
154unsafe impl Encode for MTLVertexStepFunction {
155 const ENCODING: Encoding = NSUInteger::ENCODING;
156}
157
158unsafe impl RefEncode for MTLVertexStepFunction {
159 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
160}
161
162pub static MTLBufferLayoutStrideDynamic: NSUInteger = NSUIntegerMax as _;
168
169extern_class!(
170 #[unsafe(super(NSObject))]
172 #[derive(Debug, PartialEq, Eq, Hash)]
173 pub struct MTLVertexBufferLayoutDescriptor;
174);
175
176extern_conformance!(
177 unsafe impl NSCopying for MTLVertexBufferLayoutDescriptor {}
178);
179
180unsafe impl CopyingHelper for MTLVertexBufferLayoutDescriptor {
181 type Result = Self;
182}
183
184extern_conformance!(
185 unsafe impl NSObjectProtocol for MTLVertexBufferLayoutDescriptor {}
186);
187
188impl MTLVertexBufferLayoutDescriptor {
189 extern_methods!(
190 #[unsafe(method(stride))]
191 #[unsafe(method_family = none)]
192 pub fn stride(&self) -> NSUInteger;
193
194 #[unsafe(method(setStride:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn setStride(&self, stride: NSUInteger);
202
203 #[unsafe(method(stepFunction))]
204 #[unsafe(method_family = none)]
205 pub fn stepFunction(&self) -> MTLVertexStepFunction;
206
207 #[unsafe(method(setStepFunction:))]
209 #[unsafe(method_family = none)]
210 pub fn setStepFunction(&self, step_function: MTLVertexStepFunction);
211
212 #[unsafe(method(stepRate))]
213 #[unsafe(method_family = none)]
214 pub fn stepRate(&self) -> NSUInteger;
215
216 #[unsafe(method(setStepRate:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn setStepRate(&self, step_rate: NSUInteger);
220 );
221}
222
223impl MTLVertexBufferLayoutDescriptor {
225 extern_methods!(
226 #[unsafe(method(init))]
227 #[unsafe(method_family = init)]
228 pub fn init(this: Allocated<Self>) -> Retained<Self>;
229
230 #[unsafe(method(new))]
231 #[unsafe(method_family = new)]
232 pub fn new() -> Retained<Self>;
233 );
234}
235
236impl DefaultRetained for MTLVertexBufferLayoutDescriptor {
237 #[inline]
238 fn default_retained() -> Retained<Self> {
239 Self::new()
240 }
241}
242
243extern_class!(
244 #[unsafe(super(NSObject))]
246 #[derive(Debug, PartialEq, Eq, Hash)]
247 pub struct MTLVertexBufferLayoutDescriptorArray;
248);
249
250extern_conformance!(
251 unsafe impl NSObjectProtocol for MTLVertexBufferLayoutDescriptorArray {}
252);
253
254impl MTLVertexBufferLayoutDescriptorArray {
255 extern_methods!(
256 #[unsafe(method(objectAtIndexedSubscript:))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn objectAtIndexedSubscript(
262 &self,
263 index: NSUInteger,
264 ) -> Retained<MTLVertexBufferLayoutDescriptor>;
265
266 #[unsafe(method(setObject:atIndexedSubscript:))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn setObject_atIndexedSubscript(
272 &self,
273 buffer_desc: Option<&MTLVertexBufferLayoutDescriptor>,
274 index: NSUInteger,
275 );
276 );
277}
278
279impl MTLVertexBufferLayoutDescriptorArray {
281 extern_methods!(
282 #[unsafe(method(init))]
283 #[unsafe(method_family = init)]
284 pub fn init(this: Allocated<Self>) -> Retained<Self>;
285
286 #[unsafe(method(new))]
287 #[unsafe(method_family = new)]
288 pub fn new() -> Retained<Self>;
289 );
290}
291
292impl DefaultRetained for MTLVertexBufferLayoutDescriptorArray {
293 #[inline]
294 fn default_retained() -> Retained<Self> {
295 Self::new()
296 }
297}
298
299extern_class!(
300 #[unsafe(super(NSObject))]
302 #[derive(Debug, PartialEq, Eq, Hash)]
303 pub struct MTLVertexAttributeDescriptor;
304);
305
306extern_conformance!(
307 unsafe impl NSCopying for MTLVertexAttributeDescriptor {}
308);
309
310unsafe impl CopyingHelper for MTLVertexAttributeDescriptor {
311 type Result = Self;
312}
313
314extern_conformance!(
315 unsafe impl NSObjectProtocol for MTLVertexAttributeDescriptor {}
316);
317
318impl MTLVertexAttributeDescriptor {
319 extern_methods!(
320 #[unsafe(method(format))]
321 #[unsafe(method_family = none)]
322 pub fn format(&self) -> MTLVertexFormat;
323
324 #[unsafe(method(setFormat:))]
326 #[unsafe(method_family = none)]
327 pub fn setFormat(&self, format: MTLVertexFormat);
328
329 #[unsafe(method(offset))]
330 #[unsafe(method_family = none)]
331 pub fn offset(&self) -> NSUInteger;
332
333 #[unsafe(method(setOffset:))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn setOffset(&self, offset: NSUInteger);
341
342 #[unsafe(method(bufferIndex))]
343 #[unsafe(method_family = none)]
344 pub fn bufferIndex(&self) -> NSUInteger;
345
346 #[unsafe(method(setBufferIndex:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn setBufferIndex(&self, buffer_index: NSUInteger);
354 );
355}
356
357impl MTLVertexAttributeDescriptor {
359 extern_methods!(
360 #[unsafe(method(init))]
361 #[unsafe(method_family = init)]
362 pub fn init(this: Allocated<Self>) -> Retained<Self>;
363
364 #[unsafe(method(new))]
365 #[unsafe(method_family = new)]
366 pub fn new() -> Retained<Self>;
367 );
368}
369
370impl DefaultRetained for MTLVertexAttributeDescriptor {
371 #[inline]
372 fn default_retained() -> Retained<Self> {
373 Self::new()
374 }
375}
376
377extern_class!(
378 #[unsafe(super(NSObject))]
380 #[derive(Debug, PartialEq, Eq, Hash)]
381 pub struct MTLVertexAttributeDescriptorArray;
382);
383
384extern_conformance!(
385 unsafe impl NSObjectProtocol for MTLVertexAttributeDescriptorArray {}
386);
387
388impl MTLVertexAttributeDescriptorArray {
389 extern_methods!(
390 #[unsafe(method(objectAtIndexedSubscript:))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn objectAtIndexedSubscript(
396 &self,
397 index: NSUInteger,
398 ) -> Retained<MTLVertexAttributeDescriptor>;
399
400 #[unsafe(method(setObject:atIndexedSubscript:))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn setObject_atIndexedSubscript(
406 &self,
407 attribute_desc: Option<&MTLVertexAttributeDescriptor>,
408 index: NSUInteger,
409 );
410 );
411}
412
413impl MTLVertexAttributeDescriptorArray {
415 extern_methods!(
416 #[unsafe(method(init))]
417 #[unsafe(method_family = init)]
418 pub fn init(this: Allocated<Self>) -> Retained<Self>;
419
420 #[unsafe(method(new))]
421 #[unsafe(method_family = new)]
422 pub fn new() -> Retained<Self>;
423 );
424}
425
426impl DefaultRetained for MTLVertexAttributeDescriptorArray {
427 #[inline]
428 fn default_retained() -> Retained<Self> {
429 Self::new()
430 }
431}
432
433extern_class!(
434 #[unsafe(super(NSObject))]
436 #[derive(Debug, PartialEq, Eq, Hash)]
437 pub struct MTLVertexDescriptor;
438);
439
440extern_conformance!(
441 unsafe impl NSCopying for MTLVertexDescriptor {}
442);
443
444unsafe impl CopyingHelper for MTLVertexDescriptor {
445 type Result = Self;
446}
447
448extern_conformance!(
449 unsafe impl NSObjectProtocol for MTLVertexDescriptor {}
450);
451
452impl MTLVertexDescriptor {
453 extern_methods!(
454 #[unsafe(method(vertexDescriptor))]
455 #[unsafe(method_family = none)]
456 pub fn vertexDescriptor() -> Retained<MTLVertexDescriptor>;
457
458 #[unsafe(method(layouts))]
459 #[unsafe(method_family = none)]
460 pub fn layouts(&self) -> Retained<MTLVertexBufferLayoutDescriptorArray>;
461
462 #[unsafe(method(attributes))]
463 #[unsafe(method_family = none)]
464 pub fn attributes(&self) -> Retained<MTLVertexAttributeDescriptorArray>;
465
466 #[unsafe(method(reset))]
467 #[unsafe(method_family = none)]
468 pub fn reset(&self);
469 );
470}
471
472impl MTLVertexDescriptor {
474 extern_methods!(
475 #[unsafe(method(init))]
476 #[unsafe(method_family = init)]
477 pub fn init(this: Allocated<Self>) -> Retained<Self>;
478
479 #[unsafe(method(new))]
480 #[unsafe(method_family = new)]
481 pub fn new() -> Retained<Self>;
482 );
483}
484
485impl DefaultRetained for MTLVertexDescriptor {
486 #[inline]
487 fn default_retained() -> Retained<Self> {
488 Self::new()
489 }
490}