objc2_metal/generated/
MTL4RenderPipeline.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
10/// Enumerates possible behaviors of how a pipeline maps its logical outputs to its color attachments.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4logicaltophysicalcolorattachmentmappingstate?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct MTL4LogicalToPhysicalColorAttachmentMappingState(pub NSInteger);
17impl MTL4LogicalToPhysicalColorAttachmentMappingState {
18    /// Treats the logical color attachment descriptor array for render and tile render pipelines to match the physical one.
19    ///
20    /// This is the default behavior, which produces an identity mapping.
21    #[doc(alias = "MTL4LogicalToPhysicalColorAttachmentMappingStateIdentity")]
22    pub const Identity: Self = Self(0);
23    /// Deduces the color attachment mapping by inheriting it from the color attachment map of the current encoder.
24    ///
25    /// Use this setting to indicate Metal should inherit the mapping from the ``colorAttachmentMap`` property of the current
26    /// ``MTL4RenderCommandEncoder`` or ``MTLRenderCommandEncoder`` in use at draw time.
27    #[doc(alias = "MTL4LogicalToPhysicalColorAttachmentMappingStateInherited")]
28    pub const Inherited: Self = Self(1);
29}
30
31unsafe impl Encode for MTL4LogicalToPhysicalColorAttachmentMappingState {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for MTL4LogicalToPhysicalColorAttachmentMappingState {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern_class!(
40    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinecolorattachmentdescriptor?language=objc)
41    #[unsafe(super(NSObject))]
42    #[derive(Debug, PartialEq, Eq, Hash)]
43    pub struct MTL4RenderPipelineColorAttachmentDescriptor;
44);
45
46extern_conformance!(
47    unsafe impl NSCopying for MTL4RenderPipelineColorAttachmentDescriptor {}
48);
49
50unsafe impl CopyingHelper for MTL4RenderPipelineColorAttachmentDescriptor {
51    type Result = Self;
52}
53
54extern_conformance!(
55    unsafe impl NSObjectProtocol for MTL4RenderPipelineColorAttachmentDescriptor {}
56);
57
58impl MTL4RenderPipelineColorAttachmentDescriptor {
59    extern_methods!(
60        #[cfg(feature = "MTLPixelFormat")]
61        /// Configures the pixel format.
62        ///
63        /// This property defaults to ``MTLPixelFormatInvalid``.
64        #[unsafe(method(pixelFormat))]
65        #[unsafe(method_family = none)]
66        pub fn pixelFormat(&self) -> MTLPixelFormat;
67
68        #[cfg(feature = "MTLPixelFormat")]
69        /// Setter for [`pixelFormat`][Self::pixelFormat].
70        #[unsafe(method(setPixelFormat:))]
71        #[unsafe(method_family = none)]
72        pub fn setPixelFormat(&self, pixel_format: MTLPixelFormat);
73
74        #[cfg(feature = "MTL4PipelineState")]
75        /// Configure the blend state for color attachments the pipeline state uses.
76        ///
77        /// This property's default value is ``MTL4BlendStateDisabled``.
78        #[unsafe(method(blendingState))]
79        #[unsafe(method_family = none)]
80        pub fn blendingState(&self) -> MTL4BlendState;
81
82        #[cfg(feature = "MTL4PipelineState")]
83        /// Setter for [`blendingState`][Self::blendingState].
84        #[unsafe(method(setBlendingState:))]
85        #[unsafe(method_family = none)]
86        pub fn setBlendingState(&self, blending_state: MTL4BlendState);
87
88        #[cfg(feature = "MTLRenderPipeline")]
89        /// Configures the source RGB blend factor.
90        ///
91        /// This property defaults to ``MTLBlendFactorOne``.
92        #[unsafe(method(sourceRGBBlendFactor))]
93        #[unsafe(method_family = none)]
94        pub fn sourceRGBBlendFactor(&self) -> MTLBlendFactor;
95
96        #[cfg(feature = "MTLRenderPipeline")]
97        /// Setter for [`sourceRGBBlendFactor`][Self::sourceRGBBlendFactor].
98        #[unsafe(method(setSourceRGBBlendFactor:))]
99        #[unsafe(method_family = none)]
100        pub fn setSourceRGBBlendFactor(&self, source_rgb_blend_factor: MTLBlendFactor);
101
102        #[cfg(feature = "MTLRenderPipeline")]
103        /// Configures the destination RGB blend factor.
104        ///
105        /// This property defaults to ``MTLBlendFactorZero``.
106        #[unsafe(method(destinationRGBBlendFactor))]
107        #[unsafe(method_family = none)]
108        pub fn destinationRGBBlendFactor(&self) -> MTLBlendFactor;
109
110        #[cfg(feature = "MTLRenderPipeline")]
111        /// Setter for [`destinationRGBBlendFactor`][Self::destinationRGBBlendFactor].
112        #[unsafe(method(setDestinationRGBBlendFactor:))]
113        #[unsafe(method_family = none)]
114        pub fn setDestinationRGBBlendFactor(&self, destination_rgb_blend_factor: MTLBlendFactor);
115
116        #[cfg(feature = "MTLRenderPipeline")]
117        /// Configures the RGB blend operation.
118        ///
119        /// This property defaults to ``MTLBlendOperationAdd``.
120        #[unsafe(method(rgbBlendOperation))]
121        #[unsafe(method_family = none)]
122        pub fn rgbBlendOperation(&self) -> MTLBlendOperation;
123
124        #[cfg(feature = "MTLRenderPipeline")]
125        /// Setter for [`rgbBlendOperation`][Self::rgbBlendOperation].
126        #[unsafe(method(setRgbBlendOperation:))]
127        #[unsafe(method_family = none)]
128        pub fn setRgbBlendOperation(&self, rgb_blend_operation: MTLBlendOperation);
129
130        #[cfg(feature = "MTLRenderPipeline")]
131        /// Configures the source-alpha blend factor.
132        ///
133        /// This property defaults to ``MTLBlendFactorOne``.
134        #[unsafe(method(sourceAlphaBlendFactor))]
135        #[unsafe(method_family = none)]
136        pub fn sourceAlphaBlendFactor(&self) -> MTLBlendFactor;
137
138        #[cfg(feature = "MTLRenderPipeline")]
139        /// Setter for [`sourceAlphaBlendFactor`][Self::sourceAlphaBlendFactor].
140        #[unsafe(method(setSourceAlphaBlendFactor:))]
141        #[unsafe(method_family = none)]
142        pub fn setSourceAlphaBlendFactor(&self, source_alpha_blend_factor: MTLBlendFactor);
143
144        #[cfg(feature = "MTLRenderPipeline")]
145        /// Configures the destination-alpha blend factor.
146        ///
147        /// This property defaults to ``MTLBlendFactorZero``.
148        #[unsafe(method(destinationAlphaBlendFactor))]
149        #[unsafe(method_family = none)]
150        pub fn destinationAlphaBlendFactor(&self) -> MTLBlendFactor;
151
152        #[cfg(feature = "MTLRenderPipeline")]
153        /// Setter for [`destinationAlphaBlendFactor`][Self::destinationAlphaBlendFactor].
154        #[unsafe(method(setDestinationAlphaBlendFactor:))]
155        #[unsafe(method_family = none)]
156        pub fn setDestinationAlphaBlendFactor(
157            &self,
158            destination_alpha_blend_factor: MTLBlendFactor,
159        );
160
161        #[cfg(feature = "MTLRenderPipeline")]
162        /// Configures the alpha blending operation.
163        ///
164        /// This property defaults to ``MTLBlendOperationAdd``.
165        #[unsafe(method(alphaBlendOperation))]
166        #[unsafe(method_family = none)]
167        pub fn alphaBlendOperation(&self) -> MTLBlendOperation;
168
169        #[cfg(feature = "MTLRenderPipeline")]
170        /// Setter for [`alphaBlendOperation`][Self::alphaBlendOperation].
171        #[unsafe(method(setAlphaBlendOperation:))]
172        #[unsafe(method_family = none)]
173        pub fn setAlphaBlendOperation(&self, alpha_blend_operation: MTLBlendOperation);
174
175        #[cfg(feature = "MTLRenderPipeline")]
176        /// Configures the color write mask.
177        ///
178        /// This property defaults to ``MTLColorWriteMaskAll``.
179        #[unsafe(method(writeMask))]
180        #[unsafe(method_family = none)]
181        pub fn writeMask(&self) -> MTLColorWriteMask;
182
183        #[cfg(feature = "MTLRenderPipeline")]
184        /// Setter for [`writeMask`][Self::writeMask].
185        #[unsafe(method(setWriteMask:))]
186        #[unsafe(method_family = none)]
187        pub fn setWriteMask(&self, write_mask: MTLColorWriteMask);
188
189        /// Resets this descriptor to its default state.
190        #[unsafe(method(reset))]
191        #[unsafe(method_family = none)]
192        pub fn reset(&self);
193    );
194}
195
196/// Methods declared on superclass `NSObject`.
197impl MTL4RenderPipelineColorAttachmentDescriptor {
198    extern_methods!(
199        #[unsafe(method(init))]
200        #[unsafe(method_family = init)]
201        pub fn init(this: Allocated<Self>) -> Retained<Self>;
202
203        #[unsafe(method(new))]
204        #[unsafe(method_family = new)]
205        pub fn new() -> Retained<Self>;
206    );
207}
208
209impl DefaultRetained for MTL4RenderPipelineColorAttachmentDescriptor {
210    #[inline]
211    fn default_retained() -> Retained<Self> {
212        Self::new()
213    }
214}
215
216extern_class!(
217    /// An array of color attachment descriptions for a render pipeline.
218    ///
219    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinecolorattachmentdescriptorarray?language=objc)
220    #[unsafe(super(NSObject))]
221    #[derive(Debug, PartialEq, Eq, Hash)]
222    pub struct MTL4RenderPipelineColorAttachmentDescriptorArray;
223);
224
225extern_conformance!(
226    unsafe impl NSCopying for MTL4RenderPipelineColorAttachmentDescriptorArray {}
227);
228
229unsafe impl CopyingHelper for MTL4RenderPipelineColorAttachmentDescriptorArray {
230    type Result = Self;
231}
232
233extern_conformance!(
234    unsafe impl NSObjectProtocol for MTL4RenderPipelineColorAttachmentDescriptorArray {}
235);
236
237impl MTL4RenderPipelineColorAttachmentDescriptorArray {
238    extern_methods!(
239        /// Accesses a color attachment at a specific index.
240        ///
241        /// - Parameter attachmentIndex: Index of the attachment to access.
242        ///
243        /// # Safety
244        ///
245        /// `attachmentIndex` might not be bounds-checked.
246        #[unsafe(method(objectAtIndexedSubscript:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn objectAtIndexedSubscript(
249            &self,
250            attachment_index: NSUInteger,
251        ) -> Retained<MTL4RenderPipelineColorAttachmentDescriptor>;
252
253        /// Sets an attachment at an index.
254        ///
255        /// This function offers 'copy' semantics.
256        ///
257        /// You can safely set the color attachment at any legal index to nil. This has the effect of resetting that attachment
258        /// descriptor's state to its default values.
259        ///
260        /// - Parameters:
261        /// - attachment: the descriptor of the attachment to set.
262        /// - attachmentIndex: the index of the attachment within the array.
263        ///
264        /// # Safety
265        ///
266        /// `attachmentIndex` might not be bounds-checked.
267        #[unsafe(method(setObject:atIndexedSubscript:))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn setObject_atIndexedSubscript(
270            &self,
271            attachment: Option<&MTL4RenderPipelineColorAttachmentDescriptor>,
272            attachment_index: NSUInteger,
273        );
274
275        /// Resets the elements of the descriptor array
276        #[unsafe(method(reset))]
277        #[unsafe(method_family = none)]
278        pub fn reset(&self);
279    );
280}
281
282/// Methods declared on superclass `NSObject`.
283impl MTL4RenderPipelineColorAttachmentDescriptorArray {
284    extern_methods!(
285        #[unsafe(method(init))]
286        #[unsafe(method_family = init)]
287        pub fn init(this: Allocated<Self>) -> Retained<Self>;
288
289        #[unsafe(method(new))]
290        #[unsafe(method_family = new)]
291        pub fn new() -> Retained<Self>;
292    );
293}
294
295impl DefaultRetained for MTL4RenderPipelineColorAttachmentDescriptorArray {
296    #[inline]
297    fn default_retained() -> Retained<Self> {
298        Self::new()
299    }
300}
301
302extern_class!(
303    /// Allows you to specify additional binary functions to link to each stage of a render pipeline.
304    ///
305    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinebinaryfunctionsdescriptor?language=objc)
306    #[unsafe(super(NSObject))]
307    #[derive(Debug, PartialEq, Eq, Hash)]
308    pub struct MTL4RenderPipelineBinaryFunctionsDescriptor;
309);
310
311extern_conformance!(
312    unsafe impl NSCopying for MTL4RenderPipelineBinaryFunctionsDescriptor {}
313);
314
315unsafe impl CopyingHelper for MTL4RenderPipelineBinaryFunctionsDescriptor {
316    type Result = Self;
317}
318
319extern_conformance!(
320    unsafe impl NSObjectProtocol for MTL4RenderPipelineBinaryFunctionsDescriptor {}
321);
322
323impl MTL4RenderPipelineBinaryFunctionsDescriptor {
324    extern_methods!(
325        #[cfg(feature = "MTL4BinaryFunction")]
326        /// Provides an array of binary functions representing additional binary vertex shader functions.
327        #[unsafe(method(vertexAdditionalBinaryFunctions))]
328        #[unsafe(method_family = none)]
329        pub fn vertexAdditionalBinaryFunctions(
330            &self,
331        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;
332
333        #[cfg(feature = "MTL4BinaryFunction")]
334        /// Setter for [`vertexAdditionalBinaryFunctions`][Self::vertexAdditionalBinaryFunctions].
335        ///
336        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
337        #[unsafe(method(setVertexAdditionalBinaryFunctions:))]
338        #[unsafe(method_family = none)]
339        pub fn setVertexAdditionalBinaryFunctions(
340            &self,
341            vertex_additional_binary_functions: Option<
342                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
343            >,
344        );
345
346        #[cfg(feature = "MTL4BinaryFunction")]
347        /// Provides an array of binary functions representing additional binary fragment shader functions.
348        #[unsafe(method(fragmentAdditionalBinaryFunctions))]
349        #[unsafe(method_family = none)]
350        pub fn fragmentAdditionalBinaryFunctions(
351            &self,
352        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;
353
354        #[cfg(feature = "MTL4BinaryFunction")]
355        /// Setter for [`fragmentAdditionalBinaryFunctions`][Self::fragmentAdditionalBinaryFunctions].
356        ///
357        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
358        #[unsafe(method(setFragmentAdditionalBinaryFunctions:))]
359        #[unsafe(method_family = none)]
360        pub fn setFragmentAdditionalBinaryFunctions(
361            &self,
362            fragment_additional_binary_functions: Option<
363                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
364            >,
365        );
366
367        #[cfg(feature = "MTL4BinaryFunction")]
368        /// Provides an array of binary functions representing additional binary tile shader functions.
369        #[unsafe(method(tileAdditionalBinaryFunctions))]
370        #[unsafe(method_family = none)]
371        pub fn tileAdditionalBinaryFunctions(
372            &self,
373        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;
374
375        #[cfg(feature = "MTL4BinaryFunction")]
376        /// Setter for [`tileAdditionalBinaryFunctions`][Self::tileAdditionalBinaryFunctions].
377        ///
378        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
379        #[unsafe(method(setTileAdditionalBinaryFunctions:))]
380        #[unsafe(method_family = none)]
381        pub fn setTileAdditionalBinaryFunctions(
382            &self,
383            tile_additional_binary_functions: Option<
384                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
385            >,
386        );
387
388        #[cfg(feature = "MTL4BinaryFunction")]
389        /// Provides an array of binary functions representing additional binary object shader functions.
390        #[unsafe(method(objectAdditionalBinaryFunctions))]
391        #[unsafe(method_family = none)]
392        pub fn objectAdditionalBinaryFunctions(
393            &self,
394        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;
395
396        #[cfg(feature = "MTL4BinaryFunction")]
397        /// Setter for [`objectAdditionalBinaryFunctions`][Self::objectAdditionalBinaryFunctions].
398        ///
399        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
400        #[unsafe(method(setObjectAdditionalBinaryFunctions:))]
401        #[unsafe(method_family = none)]
402        pub fn setObjectAdditionalBinaryFunctions(
403            &self,
404            object_additional_binary_functions: Option<
405                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
406            >,
407        );
408
409        #[cfg(feature = "MTL4BinaryFunction")]
410        /// Provides an array of binary functions representing additional binary mesh shader functions.
411        #[unsafe(method(meshAdditionalBinaryFunctions))]
412        #[unsafe(method_family = none)]
413        pub fn meshAdditionalBinaryFunctions(
414            &self,
415        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;
416
417        #[cfg(feature = "MTL4BinaryFunction")]
418        /// Setter for [`meshAdditionalBinaryFunctions`][Self::meshAdditionalBinaryFunctions].
419        ///
420        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
421        #[unsafe(method(setMeshAdditionalBinaryFunctions:))]
422        #[unsafe(method_family = none)]
423        pub fn setMeshAdditionalBinaryFunctions(
424            &self,
425            mesh_additional_binary_functions: Option<
426                &NSArray<ProtocolObject<dyn MTL4BinaryFunction>>,
427            >,
428        );
429
430        /// Resets this descriptor to its default state.
431        #[unsafe(method(reset))]
432        #[unsafe(method_family = none)]
433        pub fn reset(&self);
434    );
435}
436
437/// Methods declared on superclass `NSObject`.
438impl MTL4RenderPipelineBinaryFunctionsDescriptor {
439    extern_methods!(
440        #[unsafe(method(init))]
441        #[unsafe(method_family = init)]
442        pub fn init(this: Allocated<Self>) -> Retained<Self>;
443
444        #[unsafe(method(new))]
445        #[unsafe(method_family = new)]
446        pub fn new() -> Retained<Self>;
447    );
448}
449
450impl DefaultRetained for MTL4RenderPipelineBinaryFunctionsDescriptor {
451    #[inline]
452    fn default_retained() -> Retained<Self> {
453        Self::new()
454    }
455}
456
457extern_class!(
458    /// Groups together properties to create a render pipeline state object.
459    ///
460    /// Compared to ``MTLRenderPipelineDescriptor``, this interface doesn't offer a mechanism to hint to Metal mutability of
461    /// vertex and fragment buffers. Additionally, using this descriptor, you don't specify binary archives.
462    ///
463    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinedescriptor?language=objc)
464    #[unsafe(super(MTL4PipelineDescriptor, NSObject))]
465    #[derive(Debug, PartialEq, Eq, Hash)]
466    #[cfg(feature = "MTL4PipelineState")]
467    pub struct MTL4RenderPipelineDescriptor;
468);
469
470#[cfg(feature = "MTL4PipelineState")]
471extern_conformance!(
472    unsafe impl NSCopying for MTL4RenderPipelineDescriptor {}
473);
474
475#[cfg(feature = "MTL4PipelineState")]
476unsafe impl CopyingHelper for MTL4RenderPipelineDescriptor {
477    type Result = Self;
478}
479
480#[cfg(feature = "MTL4PipelineState")]
481extern_conformance!(
482    unsafe impl NSObjectProtocol for MTL4RenderPipelineDescriptor {}
483);
484
485#[cfg(feature = "MTL4PipelineState")]
486impl MTL4RenderPipelineDescriptor {
487    extern_methods!(
488        #[cfg(feature = "MTL4FunctionDescriptor")]
489        /// Assigns the shader function that this pipeline executes for each vertex.
490        #[unsafe(method(vertexFunctionDescriptor))]
491        #[unsafe(method_family = none)]
492        pub fn vertexFunctionDescriptor(&self) -> Option<Retained<MTL4FunctionDescriptor>>;
493
494        #[cfg(feature = "MTL4FunctionDescriptor")]
495        /// Setter for [`vertexFunctionDescriptor`][Self::vertexFunctionDescriptor].
496        ///
497        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
498        #[unsafe(method(setVertexFunctionDescriptor:))]
499        #[unsafe(method_family = none)]
500        pub fn setVertexFunctionDescriptor(
501            &self,
502            vertex_function_descriptor: Option<&MTL4FunctionDescriptor>,
503        );
504
505        #[cfg(feature = "MTL4FunctionDescriptor")]
506        /// Assigns the shader function that this pipeline executes for each fragment.
507        ///
508        /// When you don't specify a fragment function, you need to disable rasterization by setting property
509        /// ``rasterizationEnabled`` to false.
510        #[unsafe(method(fragmentFunctionDescriptor))]
511        #[unsafe(method_family = none)]
512        pub fn fragmentFunctionDescriptor(&self) -> Option<Retained<MTL4FunctionDescriptor>>;
513
514        #[cfg(feature = "MTL4FunctionDescriptor")]
515        /// Setter for [`fragmentFunctionDescriptor`][Self::fragmentFunctionDescriptor].
516        ///
517        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
518        #[unsafe(method(setFragmentFunctionDescriptor:))]
519        #[unsafe(method_family = none)]
520        pub fn setFragmentFunctionDescriptor(
521            &self,
522            fragment_function_descriptor: Option<&MTL4FunctionDescriptor>,
523        );
524
525        #[cfg(feature = "MTLVertexDescriptor")]
526        /// Configures an optional vertex descriptor for the vertex input.
527        ///
528        /// A vertex descriptor specifies the layout of your vertex data, allowing your vertex shaders to access the content
529        /// in your vertex arrays via the `[[stage_in]]` attribute in Metal Shading Language.
530        #[unsafe(method(vertexDescriptor))]
531        #[unsafe(method_family = none)]
532        pub fn vertexDescriptor(&self) -> Option<Retained<MTLVertexDescriptor>>;
533
534        #[cfg(feature = "MTLVertexDescriptor")]
535        /// Setter for [`vertexDescriptor`][Self::vertexDescriptor].
536        ///
537        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
538        #[unsafe(method(setVertexDescriptor:))]
539        #[unsafe(method_family = none)]
540        pub fn setVertexDescriptor(&self, vertex_descriptor: Option<&MTLVertexDescriptor>);
541
542        /// Controls the number of samples this pipeline applies for each fragment.
543        #[unsafe(method(rasterSampleCount))]
544        #[unsafe(method_family = none)]
545        pub fn rasterSampleCount(&self) -> NSUInteger;
546
547        /// Setter for [`rasterSampleCount`][Self::rasterSampleCount].
548        ///
549        /// # Safety
550        ///
551        /// This might not be bounds-checked.
552        #[unsafe(method(setRasterSampleCount:))]
553        #[unsafe(method_family = none)]
554        pub unsafe fn setRasterSampleCount(&self, raster_sample_count: NSUInteger);
555
556        /// Indicates whether to read and use the alpha channel fragment output of color attachments to compute a sample coverage mask.
557        #[unsafe(method(alphaToCoverageState))]
558        #[unsafe(method_family = none)]
559        pub fn alphaToCoverageState(&self) -> MTL4AlphaToCoverageState;
560
561        /// Setter for [`alphaToCoverageState`][Self::alphaToCoverageState].
562        #[unsafe(method(setAlphaToCoverageState:))]
563        #[unsafe(method_family = none)]
564        pub fn setAlphaToCoverageState(&self, alpha_to_coverage_state: MTL4AlphaToCoverageState);
565
566        /// Indicates whether the pipeline forces alpha channel values of color attachments to the largest representable value.
567        #[unsafe(method(alphaToOneState))]
568        #[unsafe(method_family = none)]
569        pub fn alphaToOneState(&self) -> MTL4AlphaToOneState;
570
571        /// Setter for [`alphaToOneState`][Self::alphaToOneState].
572        #[unsafe(method(setAlphaToOneState:))]
573        #[unsafe(method_family = none)]
574        pub fn setAlphaToOneState(&self, alpha_to_one_state: MTL4AlphaToOneState);
575
576        /// Determines whether the pipeline rasterizes primitives.
577        ///
578        /// By default, this value is
579        /// <doc
580        /// ://com.apple.documentation/documentation/swift/true>, specifying that this pipeline
581        /// rasterizes primitives. Set this property to
582        /// <doc
583        /// ://com.apple.documentation/documentation/swift/false> when you
584        /// don't provide a fragment shader function via function ``fragmentFunctionDescriptor``.
585        #[unsafe(method(isRasterizationEnabled))]
586        #[unsafe(method_family = none)]
587        pub fn isRasterizationEnabled(&self) -> bool;
588
589        /// Setter for [`isRasterizationEnabled`][Self::isRasterizationEnabled].
590        #[unsafe(method(setRasterizationEnabled:))]
591        #[unsafe(method_family = none)]
592        pub fn setRasterizationEnabled(&self, rasterization_enabled: bool);
593
594        /// Determines the maximum value that can you can pass as the pipeline's amplification count.
595        ///
596        /// This property controls the maximum count you pass to ``MTL4RenderCommandEncoder/setVertexAmplificationCount:viewMappings:``
597        /// when using vertex amplification with this pipeline.
598        #[unsafe(method(maxVertexAmplificationCount))]
599        #[unsafe(method_family = none)]
600        pub fn maxVertexAmplificationCount(&self) -> NSUInteger;
601
602        /// Setter for [`maxVertexAmplificationCount`][Self::maxVertexAmplificationCount].
603        ///
604        /// # Safety
605        ///
606        /// This might not be bounds-checked.
607        #[unsafe(method(setMaxVertexAmplificationCount:))]
608        #[unsafe(method_family = none)]
609        pub unsafe fn setMaxVertexAmplificationCount(
610            &self,
611            max_vertex_amplification_count: NSUInteger,
612        );
613
614        /// Accesses an array containing descriptions of the color attachments this pipeline writes to.
615        #[unsafe(method(colorAttachments))]
616        #[unsafe(method_family = none)]
617        pub fn colorAttachments(
618            &self,
619        ) -> Retained<MTL4RenderPipelineColorAttachmentDescriptorArray>;
620
621        #[cfg(feature = "MTLRenderPipeline")]
622        /// Assigns type of primitive topology this pipeline renders.
623        #[unsafe(method(inputPrimitiveTopology))]
624        #[unsafe(method_family = none)]
625        pub fn inputPrimitiveTopology(&self) -> MTLPrimitiveTopologyClass;
626
627        #[cfg(feature = "MTLRenderPipeline")]
628        /// Setter for [`inputPrimitiveTopology`][Self::inputPrimitiveTopology].
629        #[unsafe(method(setInputPrimitiveTopology:))]
630        #[unsafe(method_family = none)]
631        pub fn setInputPrimitiveTopology(
632            &self,
633            input_primitive_topology: MTLPrimitiveTopologyClass,
634        );
635
636        #[cfg(feature = "MTL4LinkingDescriptor")]
637        /// Provides static linking information for the vertex stage of the render pipeline.
638        ///
639        /// Use this property to link extra shader functions to the vertex stage of the render pipeline.
640        #[unsafe(method(vertexStaticLinkingDescriptor))]
641        #[unsafe(method_family = none)]
642        pub fn vertexStaticLinkingDescriptor(&self) -> Retained<MTL4StaticLinkingDescriptor>;
643
644        #[cfg(feature = "MTL4LinkingDescriptor")]
645        /// Setter for [`vertexStaticLinkingDescriptor`][Self::vertexStaticLinkingDescriptor].
646        ///
647        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
648        #[unsafe(method(setVertexStaticLinkingDescriptor:))]
649        #[unsafe(method_family = none)]
650        pub fn setVertexStaticLinkingDescriptor(
651            &self,
652            vertex_static_linking_descriptor: Option<&MTL4StaticLinkingDescriptor>,
653        );
654
655        #[cfg(feature = "MTL4LinkingDescriptor")]
656        /// Provides static linking information for the fragment stage of the render pipeline.
657        ///
658        /// Use this property to link extra shader functions to the fragment stage of the render pipeline.
659        #[unsafe(method(fragmentStaticLinkingDescriptor))]
660        #[unsafe(method_family = none)]
661        pub fn fragmentStaticLinkingDescriptor(&self) -> Retained<MTL4StaticLinkingDescriptor>;
662
663        #[cfg(feature = "MTL4LinkingDescriptor")]
664        /// Setter for [`fragmentStaticLinkingDescriptor`][Self::fragmentStaticLinkingDescriptor].
665        ///
666        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
667        #[unsafe(method(setFragmentStaticLinkingDescriptor:))]
668        #[unsafe(method_family = none)]
669        pub fn setFragmentStaticLinkingDescriptor(
670            &self,
671            fragment_static_linking_descriptor: Option<&MTL4StaticLinkingDescriptor>,
672        );
673
674        /// Indicates whether you can use the render pipeline to create new pipelines by
675        /// adding binary functions to the vertex shader function’s callable functions list.
676        #[unsafe(method(supportVertexBinaryLinking))]
677        #[unsafe(method_family = none)]
678        pub fn supportVertexBinaryLinking(&self) -> bool;
679
680        /// Setter for [`supportVertexBinaryLinking`][Self::supportVertexBinaryLinking].
681        #[unsafe(method(setSupportVertexBinaryLinking:))]
682        #[unsafe(method_family = none)]
683        pub fn setSupportVertexBinaryLinking(&self, support_vertex_binary_linking: bool);
684
685        /// Indicates whether you can use the pipeline to create new pipelines by
686        /// adding binary functions to the fragment shader function’s callable functions list.
687        #[unsafe(method(supportFragmentBinaryLinking))]
688        #[unsafe(method_family = none)]
689        pub fn supportFragmentBinaryLinking(&self) -> bool;
690
691        /// Setter for [`supportFragmentBinaryLinking`][Self::supportFragmentBinaryLinking].
692        #[unsafe(method(setSupportFragmentBinaryLinking:))]
693        #[unsafe(method_family = none)]
694        pub fn setSupportFragmentBinaryLinking(&self, support_fragment_binary_linking: bool);
695
696        /// Configures a logical-to-physical rendering remap state.
697        ///
698        /// Use this property to assign how a ``MTL4RenderCommandEncoder`` instance maps the output of your fragment shader to
699        /// physical color attachments.
700        #[unsafe(method(colorAttachmentMappingState))]
701        #[unsafe(method_family = none)]
702        pub fn colorAttachmentMappingState(
703            &self,
704        ) -> MTL4LogicalToPhysicalColorAttachmentMappingState;
705
706        /// Setter for [`colorAttachmentMappingState`][Self::colorAttachmentMappingState].
707        #[unsafe(method(setColorAttachmentMappingState:))]
708        #[unsafe(method_family = none)]
709        pub fn setColorAttachmentMappingState(
710            &self,
711            color_attachment_mapping_state: MTL4LogicalToPhysicalColorAttachmentMappingState,
712        );
713
714        /// Indicates whether the pipeline supports indirect command buffers.
715        #[unsafe(method(supportIndirectCommandBuffers))]
716        #[unsafe(method_family = none)]
717        pub fn supportIndirectCommandBuffers(&self) -> MTL4IndirectCommandBufferSupportState;
718
719        /// Setter for [`supportIndirectCommandBuffers`][Self::supportIndirectCommandBuffers].
720        #[unsafe(method(setSupportIndirectCommandBuffers:))]
721        #[unsafe(method_family = none)]
722        pub fn setSupportIndirectCommandBuffers(
723            &self,
724            support_indirect_command_buffers: MTL4IndirectCommandBufferSupportState,
725        );
726
727        /// Resets this descriptor to its default state.
728        #[unsafe(method(reset))]
729        #[unsafe(method_family = none)]
730        pub fn reset(&self);
731    );
732}
733
734/// Methods declared on superclass `NSObject`.
735#[cfg(feature = "MTL4PipelineState")]
736impl MTL4RenderPipelineDescriptor {
737    extern_methods!(
738        #[unsafe(method(init))]
739        #[unsafe(method_family = init)]
740        pub fn init(this: Allocated<Self>) -> Retained<Self>;
741
742        #[unsafe(method(new))]
743        #[unsafe(method_family = new)]
744        pub fn new() -> Retained<Self>;
745    );
746}
747
748#[cfg(feature = "MTL4PipelineState")]
749impl DefaultRetained for MTL4RenderPipelineDescriptor {
750    #[inline]
751    fn default_retained() -> Retained<Self> {
752        Self::new()
753    }
754}