//! 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::*; extern_class!( /// Describes a render pass. /// /// You use render pass descriptors to create instances of ``MTL4RenderCommandEncoder`` and encode draw /// commands into instances of ``MTL4CommandBuffer``. /// /// To create render command encoders, you typically call ``MTL4CommandBuffer/renderCommandEncoderWithDescriptor:``. /// The ``MTL4CommandBuffer/renderCommandEncoderWithDescriptor:options:`` variant of this method allows you to specify /// additional options to encode a render pass in parallel from multiple CPU cores by creating *suspending* and *resuming* /// render passes. /// /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpassdescriptor?language=objc) #[unsafe(super(NSObject))] #[derive(Debug, PartialEq, Eq, Hash)] pub struct MTL4RenderPassDescriptor; ); extern_conformance!( unsafe impl NSCopying for MTL4RenderPassDescriptor {} ); unsafe impl CopyingHelper for MTL4RenderPassDescriptor { type Result = Self; } extern_conformance!( unsafe impl NSObjectProtocol for MTL4RenderPassDescriptor {} ); impl MTL4RenderPassDescriptor { extern_methods!( #[cfg(feature = "MTLRenderPass")] /// Accesses the array of state information for render attachments that store color data. #[unsafe(method(colorAttachments))] #[unsafe(method_family = none)] pub fn colorAttachments(&self) -> Retained; #[cfg(feature = "MTLRenderPass")] /// Accesses state information for a render attachment that stores depth data. #[unsafe(method(depthAttachment))] #[unsafe(method_family = none)] pub fn depthAttachment(&self) -> Retained; #[cfg(feature = "MTLRenderPass")] /// Setter for [`depthAttachment`][Self::depthAttachment]. /// /// This is [copied][objc2_foundation::NSCopying::copy] when set. #[unsafe(method(setDepthAttachment:))] #[unsafe(method_family = none)] pub fn setDepthAttachment( &self, depth_attachment: Option<&MTLRenderPassDepthAttachmentDescriptor>, ); #[cfg(feature = "MTLRenderPass")] /// Accesses state information for a render attachment that stores stencil data. #[unsafe(method(stencilAttachment))] #[unsafe(method_family = none)] pub fn stencilAttachment(&self) -> Retained; #[cfg(feature = "MTLRenderPass")] /// Setter for [`stencilAttachment`][Self::stencilAttachment]. /// /// This is [copied][objc2_foundation::NSCopying::copy] when set. #[unsafe(method(setStencilAttachment:))] #[unsafe(method_family = none)] pub fn setStencilAttachment( &self, stencil_attachment: Option<&MTLRenderPassStencilAttachmentDescriptor>, ); /// Assigns the number of layers that all attachments this descriptor references have. #[unsafe(method(renderTargetArrayLength))] #[unsafe(method_family = none)] pub fn renderTargetArrayLength(&self) -> NSUInteger; /// Setter for [`renderTargetArrayLength`][Self::renderTargetArrayLength]. #[unsafe(method(setRenderTargetArrayLength:))] #[unsafe(method_family = none)] pub fn setRenderTargetArrayLength(&self, render_target_array_length: NSUInteger); /// Assigns the per-sample size, in bytes, of the largest explicit imageblock layout in the render pass. #[unsafe(method(imageblockSampleLength))] #[unsafe(method_family = none)] pub fn imageblockSampleLength(&self) -> NSUInteger; /// Setter for [`imageblockSampleLength`][Self::imageblockSampleLength]. #[unsafe(method(setImageblockSampleLength:))] #[unsafe(method_family = none)] pub fn setImageblockSampleLength(&self, imageblock_sample_length: NSUInteger); /// Assigns the per-tile size, in bytes, of the persistent threadgroup memory allocation of this render pass. #[unsafe(method(threadgroupMemoryLength))] #[unsafe(method_family = none)] pub fn threadgroupMemoryLength(&self) -> NSUInteger; /// Setter for [`threadgroupMemoryLength`][Self::threadgroupMemoryLength]. #[unsafe(method(setThreadgroupMemoryLength:))] #[unsafe(method_family = none)] pub fn setThreadgroupMemoryLength(&self, threadgroup_memory_length: NSUInteger); /// The width of the tiles, in pixels, a render pass you create with this descriptor applies to its attachments. /// /// For tile-based rendering, Metal divides each render attachment into smaller regions, or _tiles_. /// The property's default is `0`, which tells Metal to select a size that fits in tile memory. /// /// See /// /// for more information about tiles, tile memory, and deferred rendering. #[unsafe(method(tileWidth))] #[unsafe(method_family = none)] pub fn tileWidth(&self) -> NSUInteger; /// Setter for [`tileWidth`][Self::tileWidth]. #[unsafe(method(setTileWidth:))] #[unsafe(method_family = none)] pub fn setTileWidth(&self, tile_width: NSUInteger); /// The height of the tiles, in pixels, a render pass you create with this descriptor applies to its attachments. /// /// For tile-based rendering, Metal divides each render attachment into smaller regions, or _tiles_. /// The property's default is `0`, which tells Metal to select a size that fits in tile memory. /// /// See /// /// for more information about tiles, tile memory, and deferred rendering. #[unsafe(method(tileHeight))] #[unsafe(method_family = none)] pub fn tileHeight(&self) -> NSUInteger; /// Setter for [`tileHeight`][Self::tileHeight]. #[unsafe(method(setTileHeight:))] #[unsafe(method_family = none)] pub fn setTileHeight(&self, tile_height: NSUInteger); /// Sets the default raster sample count for the render pass when it references no attachments. #[unsafe(method(defaultRasterSampleCount))] #[unsafe(method_family = none)] pub fn defaultRasterSampleCount(&self) -> NSUInteger; /// Setter for [`defaultRasterSampleCount`][Self::defaultRasterSampleCount]. /// /// # Safety /// /// This might not be bounds-checked. #[unsafe(method(setDefaultRasterSampleCount:))] #[unsafe(method_family = none)] pub unsafe fn setDefaultRasterSampleCount(&self, default_raster_sample_count: NSUInteger); /// Sets the width, in pixels, to which Metal constrains the render target. /// /// When this value is non-zero, you need to assign it to be smaller than or equal to the minimum width of all attachments. /// /// The default value of this property is `0`. #[unsafe(method(renderTargetWidth))] #[unsafe(method_family = none)] pub fn renderTargetWidth(&self) -> NSUInteger; /// Setter for [`renderTargetWidth`][Self::renderTargetWidth]. #[unsafe(method(setRenderTargetWidth:))] #[unsafe(method_family = none)] pub fn setRenderTargetWidth(&self, render_target_width: NSUInteger); /// Sets the height, in pixels, to which Metal constrains the render target. /// /// When this value is non-zero, you need to assign it to be smaller than or equal to the minimum height of all attachments. /// /// The default value of this property is `0`. #[unsafe(method(renderTargetHeight))] #[unsafe(method_family = none)] pub fn renderTargetHeight(&self) -> NSUInteger; /// Setter for [`renderTargetHeight`][Self::renderTargetHeight]. #[unsafe(method(setRenderTargetHeight:))] #[unsafe(method_family = none)] pub fn setRenderTargetHeight(&self, render_target_height: NSUInteger); #[cfg(feature = "MTLRasterizationRate")] /// Assigns an optional variable rasterization rate map that Metal uses in the render pass. /// /// Enabling variable rasterization rate allows Metal to decrease the rasterization rate, typically in unimportant /// regions of color attachments, to accelerate processing. /// /// When set to `nil`, the default, Metal doesn't use variable rasterization rate. #[unsafe(method(rasterizationRateMap))] #[unsafe(method_family = none)] pub fn rasterizationRateMap( &self, ) -> Option>>; #[cfg(feature = "MTLRasterizationRate")] /// Setter for [`rasterizationRateMap`][Self::rasterizationRateMap]. #[unsafe(method(setRasterizationRateMap:))] #[unsafe(method_family = none)] pub fn setRasterizationRateMap( &self, rasterization_rate_map: Option<&ProtocolObject>, ); #[cfg(all( feature = "MTLAllocation", feature = "MTLBuffer", feature = "MTLResource" ))] /// Configures a buffer into which Metal writes counts of fragments (pixels) passing the depth and stencil tests. #[unsafe(method(visibilityResultBuffer))] #[unsafe(method_family = none)] pub fn visibilityResultBuffer(&self) -> Option>>; #[cfg(all( feature = "MTLAllocation", feature = "MTLBuffer", feature = "MTLResource" ))] /// Setter for [`visibilityResultBuffer`][Self::visibilityResultBuffer]. /// /// # Safety /// /// - `visibility_result_buffer` may need to be synchronized. /// - `visibility_result_buffer` may be unretained, you must ensure it is kept alive while in use. /// - `visibility_result_buffer` contents should be of the correct type. #[unsafe(method(setVisibilityResultBuffer:))] #[unsafe(method_family = none)] pub unsafe fn setVisibilityResultBuffer( &self, visibility_result_buffer: Option<&ProtocolObject>, ); #[cfg(feature = "MTLRenderPass")] /// Determines if Metal accumulates visibility results between render encoders or resets them. #[unsafe(method(visibilityResultType))] #[unsafe(method_family = none)] pub fn visibilityResultType(&self) -> MTLVisibilityResultType; #[cfg(feature = "MTLRenderPass")] /// Setter for [`visibilityResultType`][Self::visibilityResultType]. #[unsafe(method(setVisibilityResultType:))] #[unsafe(method_family = none)] pub fn setVisibilityResultType(&self, visibility_result_type: MTLVisibilityResultType); #[cfg(feature = "MTLTypes")] /// Configures the custom sample positions to use in MSAA rendering. /// /// - Parameters: /// - positions: Array of ``MTLSamplePosition`` instances. /// - count: Number of ``MTLSamplePosition`` instances in the array. This value /// needs to be a valid sample count, or `0` to disable custom sample positions. /// /// # Safety /// /// - `positions` must be a valid pointer or null. /// - `count` might not be bounds-checked. #[unsafe(method(setSamplePositions:count:))] #[unsafe(method_family = none)] pub unsafe fn setSamplePositions_count( &self, positions: *const MTLSamplePosition, count: NSUInteger, ); #[cfg(feature = "MTLTypes")] /// Retrieves the previously-configured custom sample positions. /// /// This method stores the app's last set custom sample positions into an output array. Metal only modifies the array /// when the `count` parameter consists of a length sufficient to store the number of sample positions. /// /// - Parameters: /// - positions: The destination array where Metal stores ``MTLSamplePosition`` instances. /// - count: Number of ``MTLSamplePosition`` instances in the array. This array /// needs to be large enough to store all sample positions. /// /// - Returns: The number of previously-configured custom sample positions. /// /// # Safety /// /// - `positions` must be a valid pointer or null. /// - `count` might not be bounds-checked. #[unsafe(method(getSamplePositions:count:))] #[unsafe(method_family = none)] pub unsafe fn getSamplePositions_count( &self, positions: *mut MTLSamplePosition, count: NSUInteger, ) -> NSUInteger; /// Controls if the render pass supports color attachment mapping. #[unsafe(method(supportColorAttachmentMapping))] #[unsafe(method_family = none)] pub fn supportColorAttachmentMapping(&self) -> bool; /// Setter for [`supportColorAttachmentMapping`][Self::supportColorAttachmentMapping]. #[unsafe(method(setSupportColorAttachmentMapping:))] #[unsafe(method_family = none)] pub fn setSupportColorAttachmentMapping(&self, support_color_attachment_mapping: bool); ); } /// Methods declared on superclass `NSObject`. impl MTL4RenderPassDescriptor { extern_methods!( #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } impl DefaultRetained for MTL4RenderPassDescriptor { #[inline] fn default_retained() -> Retained { Self::new() } }