objc2-metal 0.3.2

Bindings to the Metal framework
Documentation
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
//! 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::*;

/// Enumerates possible behaviors of how a pipeline maps its logical outputs to its color attachments.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4logicaltophysicalcolorattachmentmappingstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTL4LogicalToPhysicalColorAttachmentMappingState(pub NSInteger);
impl MTL4LogicalToPhysicalColorAttachmentMappingState {
    /// Treats the logical color attachment descriptor array for render and tile render pipelines to match the physical one.
    ///
    /// This is the default behavior, which produces an identity mapping.
    #[doc(alias = "MTL4LogicalToPhysicalColorAttachmentMappingStateIdentity")]
    pub const Identity: Self = Self(0);
    /// Deduces the color attachment mapping by inheriting it from the color attachment map of the current encoder.
    ///
    /// Use this setting to indicate Metal should inherit the mapping from the ``colorAttachmentMap`` property of the current
    /// ``MTL4RenderCommandEncoder`` or ``MTLRenderCommandEncoder`` in use at draw time.
    #[doc(alias = "MTL4LogicalToPhysicalColorAttachmentMappingStateInherited")]
    pub const Inherited: Self = Self(1);
}

unsafe impl Encode for MTL4LogicalToPhysicalColorAttachmentMappingState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for MTL4LogicalToPhysicalColorAttachmentMappingState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinecolorattachmentdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4RenderPipelineColorAttachmentDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MTL4RenderPipelineColorAttachmentDescriptor {}
);

unsafe impl CopyingHelper for MTL4RenderPipelineColorAttachmentDescriptor {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MTL4RenderPipelineColorAttachmentDescriptor {}
);

impl MTL4RenderPipelineColorAttachmentDescriptor {
    extern_methods!(
        #[cfg(feature = "MTLPixelFormat")]
        /// Configures the pixel format.
        ///
        /// This property defaults to ``MTLPixelFormatInvalid``.
        #[unsafe(method(pixelFormat))]
        #[unsafe(method_family = none)]
        pub fn pixelFormat(&self) -> MTLPixelFormat;

        #[cfg(feature = "MTLPixelFormat")]
        /// Setter for [`pixelFormat`][Self::pixelFormat].
        #[unsafe(method(setPixelFormat:))]
        #[unsafe(method_family = none)]
        pub fn setPixelFormat(&self, pixel_format: MTLPixelFormat);

        #[cfg(feature = "MTL4PipelineState")]
        /// Configure the blend state for color attachments the pipeline state uses.
        ///
        /// This property's default value is ``MTL4BlendStateDisabled``.
        #[unsafe(method(blendingState))]
        #[unsafe(method_family = none)]
        pub fn blendingState(&self) -> MTL4BlendState;

        #[cfg(feature = "MTL4PipelineState")]
        /// Setter for [`blendingState`][Self::blendingState].
        #[unsafe(method(setBlendingState:))]
        #[unsafe(method_family = none)]
        pub fn setBlendingState(&self, blending_state: MTL4BlendState);

        #[cfg(feature = "MTLRenderPipeline")]
        /// Configures the source RGB blend factor.
        ///
        /// This property defaults to ``MTLBlendFactorOne``.
        #[unsafe(method(sourceRGBBlendFactor))]
        #[unsafe(method_family = none)]
        pub fn sourceRGBBlendFactor(&self) -> MTLBlendFactor;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`sourceRGBBlendFactor`][Self::sourceRGBBlendFactor].
        #[unsafe(method(setSourceRGBBlendFactor:))]
        #[unsafe(method_family = none)]
        pub fn setSourceRGBBlendFactor(&self, source_rgb_blend_factor: MTLBlendFactor);

        #[cfg(feature = "MTLRenderPipeline")]
        /// Configures the destination RGB blend factor.
        ///
        /// This property defaults to ``MTLBlendFactorZero``.
        #[unsafe(method(destinationRGBBlendFactor))]
        #[unsafe(method_family = none)]
        pub fn destinationRGBBlendFactor(&self) -> MTLBlendFactor;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`destinationRGBBlendFactor`][Self::destinationRGBBlendFactor].
        #[unsafe(method(setDestinationRGBBlendFactor:))]
        #[unsafe(method_family = none)]
        pub fn setDestinationRGBBlendFactor(&self, destination_rgb_blend_factor: MTLBlendFactor);

        #[cfg(feature = "MTLRenderPipeline")]
        /// Configures the RGB blend operation.
        ///
        /// This property defaults to ``MTLBlendOperationAdd``.
        #[unsafe(method(rgbBlendOperation))]
        #[unsafe(method_family = none)]
        pub fn rgbBlendOperation(&self) -> MTLBlendOperation;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`rgbBlendOperation`][Self::rgbBlendOperation].
        #[unsafe(method(setRgbBlendOperation:))]
        #[unsafe(method_family = none)]
        pub fn setRgbBlendOperation(&self, rgb_blend_operation: MTLBlendOperation);

        #[cfg(feature = "MTLRenderPipeline")]
        /// Configures the source-alpha blend factor.
        ///
        /// This property defaults to ``MTLBlendFactorOne``.
        #[unsafe(method(sourceAlphaBlendFactor))]
        #[unsafe(method_family = none)]
        pub fn sourceAlphaBlendFactor(&self) -> MTLBlendFactor;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`sourceAlphaBlendFactor`][Self::sourceAlphaBlendFactor].
        #[unsafe(method(setSourceAlphaBlendFactor:))]
        #[unsafe(method_family = none)]
        pub fn setSourceAlphaBlendFactor(&self, source_alpha_blend_factor: MTLBlendFactor);

        #[cfg(feature = "MTLRenderPipeline")]
        /// Configures the destination-alpha blend factor.
        ///
        /// This property defaults to ``MTLBlendFactorZero``.
        #[unsafe(method(destinationAlphaBlendFactor))]
        #[unsafe(method_family = none)]
        pub fn destinationAlphaBlendFactor(&self) -> MTLBlendFactor;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`destinationAlphaBlendFactor`][Self::destinationAlphaBlendFactor].
        #[unsafe(method(setDestinationAlphaBlendFactor:))]
        #[unsafe(method_family = none)]
        pub fn setDestinationAlphaBlendFactor(
            &self,
            destination_alpha_blend_factor: MTLBlendFactor,
        );

        #[cfg(feature = "MTLRenderPipeline")]
        /// Configures the alpha blending operation.
        ///
        /// This property defaults to ``MTLBlendOperationAdd``.
        #[unsafe(method(alphaBlendOperation))]
        #[unsafe(method_family = none)]
        pub fn alphaBlendOperation(&self) -> MTLBlendOperation;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`alphaBlendOperation`][Self::alphaBlendOperation].
        #[unsafe(method(setAlphaBlendOperation:))]
        #[unsafe(method_family = none)]
        pub fn setAlphaBlendOperation(&self, alpha_blend_operation: MTLBlendOperation);

        #[cfg(feature = "MTLRenderPipeline")]
        /// Configures the color write mask.
        ///
        /// This property defaults to ``MTLColorWriteMaskAll``.
        #[unsafe(method(writeMask))]
        #[unsafe(method_family = none)]
        pub fn writeMask(&self) -> MTLColorWriteMask;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`writeMask`][Self::writeMask].
        #[unsafe(method(setWriteMask:))]
        #[unsafe(method_family = none)]
        pub fn setWriteMask(&self, write_mask: MTLColorWriteMask);

        /// Resets this descriptor to its default state.
        #[unsafe(method(reset))]
        #[unsafe(method_family = none)]
        pub fn reset(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl MTL4RenderPipelineColorAttachmentDescriptor {
    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 MTL4RenderPipelineColorAttachmentDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// An array of color attachment descriptions for a render pipeline.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinecolorattachmentdescriptorarray?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4RenderPipelineColorAttachmentDescriptorArray;
);

extern_conformance!(
    unsafe impl NSCopying for MTL4RenderPipelineColorAttachmentDescriptorArray {}
);

unsafe impl CopyingHelper for MTL4RenderPipelineColorAttachmentDescriptorArray {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MTL4RenderPipelineColorAttachmentDescriptorArray {}
);

impl MTL4RenderPipelineColorAttachmentDescriptorArray {
    extern_methods!(
        /// Accesses a color attachment at a specific index.
        ///
        /// - Parameter attachmentIndex: Index of the attachment to access.
        ///
        /// # Safety
        ///
        /// `attachmentIndex` might not be bounds-checked.
        #[unsafe(method(objectAtIndexedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectAtIndexedSubscript(
            &self,
            attachment_index: NSUInteger,
        ) -> Retained<MTL4RenderPipelineColorAttachmentDescriptor>;

        /// Sets an attachment at an index.
        ///
        /// This function offers 'copy' semantics.
        ///
        /// You can safely set the color attachment at any legal index to nil. This has the effect of resetting that attachment
        /// descriptor's state to its default values.
        ///
        /// - Parameters:
        /// - attachment: the descriptor of the attachment to set.
        /// - attachmentIndex: the index of the attachment within the array.
        ///
        /// # Safety
        ///
        /// `attachmentIndex` might not be bounds-checked.
        #[unsafe(method(setObject:atIndexedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObject_atIndexedSubscript(
            &self,
            attachment: Option<&MTL4RenderPipelineColorAttachmentDescriptor>,
            attachment_index: NSUInteger,
        );

        /// Resets the elements of the descriptor array
        #[unsafe(method(reset))]
        #[unsafe(method_family = none)]
        pub fn reset(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl MTL4RenderPipelineColorAttachmentDescriptorArray {
    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 MTL4RenderPipelineColorAttachmentDescriptorArray {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// Allows you to specify additional binary functions to link to each stage of a render pipeline.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinebinaryfunctionsdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4RenderPipelineBinaryFunctionsDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MTL4RenderPipelineBinaryFunctionsDescriptor {}
);

unsafe impl CopyingHelper for MTL4RenderPipelineBinaryFunctionsDescriptor {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MTL4RenderPipelineBinaryFunctionsDescriptor {}
);

impl MTL4RenderPipelineBinaryFunctionsDescriptor {
    extern_methods!(
        #[cfg(feature = "MTL4BinaryFunction")]
        /// Provides an array of binary functions representing additional binary vertex shader functions.
        #[unsafe(method(vertexAdditionalBinaryFunctions))]
        #[unsafe(method_family = none)]
        pub fn vertexAdditionalBinaryFunctions(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Setter for [`vertexAdditionalBinaryFunctions`][Self::vertexAdditionalBinaryFunctions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setVertexAdditionalBinaryFunctions:))]
        #[unsafe(method_family = none)]
        pub fn setVertexAdditionalBinaryFunctions(
            &self,
            vertex_additional_binary_functions: Option<
                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
            >,
        );

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Provides an array of binary functions representing additional binary fragment shader functions.
        #[unsafe(method(fragmentAdditionalBinaryFunctions))]
        #[unsafe(method_family = none)]
        pub fn fragmentAdditionalBinaryFunctions(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Setter for [`fragmentAdditionalBinaryFunctions`][Self::fragmentAdditionalBinaryFunctions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFragmentAdditionalBinaryFunctions:))]
        #[unsafe(method_family = none)]
        pub fn setFragmentAdditionalBinaryFunctions(
            &self,
            fragment_additional_binary_functions: Option<
                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
            >,
        );

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Provides an array of binary functions representing additional binary tile shader functions.
        #[unsafe(method(tileAdditionalBinaryFunctions))]
        #[unsafe(method_family = none)]
        pub fn tileAdditionalBinaryFunctions(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Setter for [`tileAdditionalBinaryFunctions`][Self::tileAdditionalBinaryFunctions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTileAdditionalBinaryFunctions:))]
        #[unsafe(method_family = none)]
        pub fn setTileAdditionalBinaryFunctions(
            &self,
            tile_additional_binary_functions: Option<
                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
            >,
        );

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Provides an array of binary functions representing additional binary object shader functions.
        #[unsafe(method(objectAdditionalBinaryFunctions))]
        #[unsafe(method_family = none)]
        pub fn objectAdditionalBinaryFunctions(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Setter for [`objectAdditionalBinaryFunctions`][Self::objectAdditionalBinaryFunctions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setObjectAdditionalBinaryFunctions:))]
        #[unsafe(method_family = none)]
        pub fn setObjectAdditionalBinaryFunctions(
            &self,
            object_additional_binary_functions: Option<
                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
            >,
        );

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Provides an array of binary functions representing additional binary mesh shader functions.
        #[unsafe(method(meshAdditionalBinaryFunctions))]
        #[unsafe(method_family = none)]
        pub fn meshAdditionalBinaryFunctions(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;

        #[cfg(feature = "MTL4BinaryFunction")]
        /// Setter for [`meshAdditionalBinaryFunctions`][Self::meshAdditionalBinaryFunctions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMeshAdditionalBinaryFunctions:))]
        #[unsafe(method_family = none)]
        pub fn setMeshAdditionalBinaryFunctions(
            &self,
            mesh_additional_binary_functions: Option<
                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
            >,
        );

        /// Resets this descriptor to its default state.
        #[unsafe(method(reset))]
        #[unsafe(method_family = none)]
        pub fn reset(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl MTL4RenderPipelineBinaryFunctionsDescriptor {
    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 MTL4RenderPipelineBinaryFunctionsDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// Groups together properties to create a render pipeline state object.
    ///
    /// Compared to ``MTLRenderPipelineDescriptor``, this interface doesn't offer a mechanism to hint to Metal mutability of
    /// vertex and fragment buffers. Additionally, using this descriptor, you don't specify binary archives.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinedescriptor?language=objc)
    #[unsafe(super(MTL4PipelineDescriptor, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MTL4PipelineState")]
    pub struct MTL4RenderPipelineDescriptor;
);

#[cfg(feature = "MTL4PipelineState")]
extern_conformance!(
    unsafe impl NSCopying for MTL4RenderPipelineDescriptor {}
);

#[cfg(feature = "MTL4PipelineState")]
unsafe impl CopyingHelper for MTL4RenderPipelineDescriptor {
    type Result = Self;
}

#[cfg(feature = "MTL4PipelineState")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MTL4RenderPipelineDescriptor {}
);

#[cfg(feature = "MTL4PipelineState")]
impl MTL4RenderPipelineDescriptor {
    extern_methods!(
        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Assigns the shader function that this pipeline executes for each vertex.
        #[unsafe(method(vertexFunctionDescriptor))]
        #[unsafe(method_family = none)]
        pub fn vertexFunctionDescriptor(&self) -> Option<Retained<MTL4FunctionDescriptor>>;

        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Setter for [`vertexFunctionDescriptor`][Self::vertexFunctionDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setVertexFunctionDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setVertexFunctionDescriptor(
            &self,
            vertex_function_descriptor: Option<&MTL4FunctionDescriptor>,
        );

        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Assigns the shader function that this pipeline executes for each fragment.
        ///
        /// When you don't specify a fragment function, you need to disable rasterization by setting property
        /// ``rasterizationEnabled`` to false.
        #[unsafe(method(fragmentFunctionDescriptor))]
        #[unsafe(method_family = none)]
        pub fn fragmentFunctionDescriptor(&self) -> Option<Retained<MTL4FunctionDescriptor>>;

        #[cfg(feature = "MTL4FunctionDescriptor")]
        /// Setter for [`fragmentFunctionDescriptor`][Self::fragmentFunctionDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFragmentFunctionDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setFragmentFunctionDescriptor(
            &self,
            fragment_function_descriptor: Option<&MTL4FunctionDescriptor>,
        );

        #[cfg(feature = "MTLVertexDescriptor")]
        /// Configures an optional vertex descriptor for the vertex input.
        ///
        /// A vertex descriptor specifies the layout of your vertex data, allowing your vertex shaders to access the content
        /// in your vertex arrays via the `[[stage_in]]` attribute in Metal Shading Language.
        #[unsafe(method(vertexDescriptor))]
        #[unsafe(method_family = none)]
        pub fn vertexDescriptor(&self) -> Option<Retained<MTLVertexDescriptor>>;

        #[cfg(feature = "MTLVertexDescriptor")]
        /// Setter for [`vertexDescriptor`][Self::vertexDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setVertexDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setVertexDescriptor(&self, vertex_descriptor: Option<&MTLVertexDescriptor>);

        /// Controls the number of samples this pipeline applies for each fragment.
        #[unsafe(method(rasterSampleCount))]
        #[unsafe(method_family = none)]
        pub fn rasterSampleCount(&self) -> NSUInteger;

        /// Setter for [`rasterSampleCount`][Self::rasterSampleCount].
        ///
        /// # Safety
        ///
        /// This might not be bounds-checked.
        #[unsafe(method(setRasterSampleCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRasterSampleCount(&self, raster_sample_count: NSUInteger);

        /// Indicates whether to read and use the alpha channel fragment output of color attachments to compute a sample coverage mask.
        #[unsafe(method(alphaToCoverageState))]
        #[unsafe(method_family = none)]
        pub fn alphaToCoverageState(&self) -> MTL4AlphaToCoverageState;

        /// Setter for [`alphaToCoverageState`][Self::alphaToCoverageState].
        #[unsafe(method(setAlphaToCoverageState:))]
        #[unsafe(method_family = none)]
        pub fn setAlphaToCoverageState(&self, alpha_to_coverage_state: MTL4AlphaToCoverageState);

        /// Indicates whether the pipeline forces alpha channel values of color attachments to the largest representable value.
        #[unsafe(method(alphaToOneState))]
        #[unsafe(method_family = none)]
        pub fn alphaToOneState(&self) -> MTL4AlphaToOneState;

        /// Setter for [`alphaToOneState`][Self::alphaToOneState].
        #[unsafe(method(setAlphaToOneState:))]
        #[unsafe(method_family = none)]
        pub fn setAlphaToOneState(&self, alpha_to_one_state: MTL4AlphaToOneState);

        /// Determines whether the pipeline rasterizes primitives.
        ///
        /// By default, this value is
        /// <doc
        /// ://com.apple.documentation/documentation/swift/true>, specifying that this pipeline
        /// rasterizes primitives. Set this property to
        /// <doc
        /// ://com.apple.documentation/documentation/swift/false> when you
        /// don't provide a fragment shader function via function ``fragmentFunctionDescriptor``.
        #[unsafe(method(isRasterizationEnabled))]
        #[unsafe(method_family = none)]
        pub fn isRasterizationEnabled(&self) -> bool;

        /// Setter for [`isRasterizationEnabled`][Self::isRasterizationEnabled].
        #[unsafe(method(setRasterizationEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setRasterizationEnabled(&self, rasterization_enabled: bool);

        /// Determines the maximum value that can you can pass as the pipeline's amplification count.
        ///
        /// This property controls the maximum count you pass to ``MTL4RenderCommandEncoder/setVertexAmplificationCount:viewMappings:``
        /// when using vertex amplification with this pipeline.
        #[unsafe(method(maxVertexAmplificationCount))]
        #[unsafe(method_family = none)]
        pub fn maxVertexAmplificationCount(&self) -> NSUInteger;

        /// Setter for [`maxVertexAmplificationCount`][Self::maxVertexAmplificationCount].
        ///
        /// # Safety
        ///
        /// This might not be bounds-checked.
        #[unsafe(method(setMaxVertexAmplificationCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaxVertexAmplificationCount(
            &self,
            max_vertex_amplification_count: NSUInteger,
        );

        /// Accesses an array containing descriptions of the color attachments this pipeline writes to.
        #[unsafe(method(colorAttachments))]
        #[unsafe(method_family = none)]
        pub fn colorAttachments(
            &self,
        ) -> Retained<MTL4RenderPipelineColorAttachmentDescriptorArray>;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Assigns type of primitive topology this pipeline renders.
        #[unsafe(method(inputPrimitiveTopology))]
        #[unsafe(method_family = none)]
        pub fn inputPrimitiveTopology(&self) -> MTLPrimitiveTopologyClass;

        #[cfg(feature = "MTLRenderPipeline")]
        /// Setter for [`inputPrimitiveTopology`][Self::inputPrimitiveTopology].
        #[unsafe(method(setInputPrimitiveTopology:))]
        #[unsafe(method_family = none)]
        pub fn setInputPrimitiveTopology(
            &self,
            input_primitive_topology: MTLPrimitiveTopologyClass,
        );

        #[cfg(feature = "MTL4LinkingDescriptor")]
        /// Provides static linking information for the vertex stage of the render pipeline.
        ///
        /// Use this property to link extra shader functions to the vertex stage of the render pipeline.
        #[unsafe(method(vertexStaticLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn vertexStaticLinkingDescriptor(&self) -> Retained<MTL4StaticLinkingDescriptor>;

        #[cfg(feature = "MTL4LinkingDescriptor")]
        /// Setter for [`vertexStaticLinkingDescriptor`][Self::vertexStaticLinkingDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setVertexStaticLinkingDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setVertexStaticLinkingDescriptor(
            &self,
            vertex_static_linking_descriptor: Option<&MTL4StaticLinkingDescriptor>,
        );

        #[cfg(feature = "MTL4LinkingDescriptor")]
        /// Provides static linking information for the fragment stage of the render pipeline.
        ///
        /// Use this property to link extra shader functions to the fragment stage of the render pipeline.
        #[unsafe(method(fragmentStaticLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn fragmentStaticLinkingDescriptor(&self) -> Retained<MTL4StaticLinkingDescriptor>;

        #[cfg(feature = "MTL4LinkingDescriptor")]
        /// Setter for [`fragmentStaticLinkingDescriptor`][Self::fragmentStaticLinkingDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFragmentStaticLinkingDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setFragmentStaticLinkingDescriptor(
            &self,
            fragment_static_linking_descriptor: Option<&MTL4StaticLinkingDescriptor>,
        );

        /// Indicates whether you can use the render pipeline to create new pipelines by
        /// adding binary functions to the vertex shader function’s callable functions list.
        #[unsafe(method(supportVertexBinaryLinking))]
        #[unsafe(method_family = none)]
        pub fn supportVertexBinaryLinking(&self) -> bool;

        /// Setter for [`supportVertexBinaryLinking`][Self::supportVertexBinaryLinking].
        #[unsafe(method(setSupportVertexBinaryLinking:))]
        #[unsafe(method_family = none)]
        pub fn setSupportVertexBinaryLinking(&self, support_vertex_binary_linking: bool);

        /// Indicates whether you can use the pipeline to create new pipelines by
        /// adding binary functions to the fragment shader function’s callable functions list.
        #[unsafe(method(supportFragmentBinaryLinking))]
        #[unsafe(method_family = none)]
        pub fn supportFragmentBinaryLinking(&self) -> bool;

        /// Setter for [`supportFragmentBinaryLinking`][Self::supportFragmentBinaryLinking].
        #[unsafe(method(setSupportFragmentBinaryLinking:))]
        #[unsafe(method_family = none)]
        pub fn setSupportFragmentBinaryLinking(&self, support_fragment_binary_linking: bool);

        /// Configures a logical-to-physical rendering remap state.
        ///
        /// Use this property to assign how a ``MTL4RenderCommandEncoder`` instance maps the output of your fragment shader to
        /// physical color attachments.
        #[unsafe(method(colorAttachmentMappingState))]
        #[unsafe(method_family = none)]
        pub fn colorAttachmentMappingState(
            &self,
        ) -> MTL4LogicalToPhysicalColorAttachmentMappingState;

        /// Setter for [`colorAttachmentMappingState`][Self::colorAttachmentMappingState].
        #[unsafe(method(setColorAttachmentMappingState:))]
        #[unsafe(method_family = none)]
        pub fn setColorAttachmentMappingState(
            &self,
            color_attachment_mapping_state: MTL4LogicalToPhysicalColorAttachmentMappingState,
        );

        /// Indicates whether the pipeline supports indirect command buffers.
        #[unsafe(method(supportIndirectCommandBuffers))]
        #[unsafe(method_family = none)]
        pub fn supportIndirectCommandBuffers(&self) -> MTL4IndirectCommandBufferSupportState;

        /// Setter for [`supportIndirectCommandBuffers`][Self::supportIndirectCommandBuffers].
        #[unsafe(method(setSupportIndirectCommandBuffers:))]
        #[unsafe(method_family = none)]
        pub fn setSupportIndirectCommandBuffers(
            &self,
            support_indirect_command_buffers: MTL4IndirectCommandBufferSupportState,
        );

        /// Resets this descriptor to its default state.
        #[unsafe(method(reset))]
        #[unsafe(method_family = none)]
        pub fn reset(&self);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "MTL4PipelineState")]
impl MTL4RenderPipelineDescriptor {
    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>;
    );
}

#[cfg(feature = "MTL4PipelineState")]
impl DefaultRetained for MTL4RenderPipelineDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}