Class

MTLRenderPassDescriptor

A group of render targets that hold the results of a render pass.

Declaration

class MTLRenderPassDescriptor : NSObject

Overview

A MTLRenderPassDescriptor object contains a collection of attachments that are the rendering destination for pixels generated by a rendering pass. The MTLRenderPassDescriptor class is also used to set the destination buffer for visibility information generated by a rendering pass.

Topics

Specifying the Attachments for a Rendering Pass

Setting Load and Store Actions

Set actions that define how a render pass loads and stores a render target.

var colorAttachments: MTLRenderPassColorAttachmentDescriptorArray

An array of state information for attachments that store color data.

var depthAttachment: MTLRenderPassDepthAttachmentDescriptor!

State information for an attachment that stores depth data.

var stencilAttachment: MTLRenderPassStencilAttachmentDescriptor!

State information for an attachment that stores stencil data.

class MTLRenderPassAttachmentDescriptor

A render target that serves as the output destination for pixels generated by a render pass.

class MTLRenderPassColorAttachmentDescriptor

A color render target that serves as the output destination for color pixels generated by a render pass.

class MTLRenderPassDepthAttachmentDescriptor

A depth render target that serves as the output destination for depth pixels generated by a render pass.

class MTLRenderPassStencilAttachmentDescriptor

A stencil render target that serves as the output destination for stencil pixels generated by a render pass.

Specifying the Visibility Result Buffer

var visibilityResultBuffer: MTLBuffer?

The destination for the GPU to write visibility information when samples pass the depth and stencil tests.

Layered Rendering

Rendering to Multiple Texture Slices in a Draw Command

Select a destination texture slice in your vertex shader.

var renderTargetArrayLength: Int

The number of active layers that all attachments must have for layered rendering.

var renderTargetWidth: Int

The width, in pixels, to constrain the render target to.

var renderTargetHeight: Int

The height, in pixels, to constrain the render target to.

Using Programmable Sample Positions

Positioning Samples Programmatically

Configure the position of samples when rendering to a multisampled render target.

Handling MSAA Depth with Programmable Sample Positions

Use depth render targets and programmable sample positions effectively.

struct MTLSamplePosition

A sample position on a subpixel grid.

func MTLSamplePositionMake(Float, Float) -> MTLSamplePosition

Returns a new sample position on a subpixel grid.

func setSamplePositions([MTLSamplePosition])

Sets the programmable sample positions for a render pass.

func getSamplePositions() -> [MTLSamplePosition]

Returns the programmable sample positions set for a render pass.

Specifying Tile Shading Parameters

var imageblockSampleLength: Int

The per-sample size, in bytes, of the largest explicit imageblock layout in the render pass.

var threadgroupMemoryLength: Int

The per-tile size, in bytes, of the persistent threadgroup memory allocation.

var tileWidth: Int

The tile width, in pixels.

var tileHeight: Int

The tile height, in pixels.

Specifying Sample Counts

var defaultRasterSampleCount: Int

The raster sample count for the render pass when no attachments are given.

Specifying a Rasterization Rate Map

Rendering at Different Rasterization Rates

Configure a rasterization rate map to vary rasterization rates depending on the amount of detail needed.

var rasterizationRateMap: MTLRasterizationRateMap?

The rasterization rate map to use when executing the render pass.

class MTLRasterizationRateMapDescriptor

An object that you use to configure new rasterization rate maps.

protocol MTLRasterizationRateMap

A compiled read-only object that determines how to apply variable rasterization rates when rendering.

Relationships

Inherits From

See Also

Rendering

Creating and Sampling Textures

Load image data into a texture and apply it to a quadrangle.

Calculating Primitive Visibility Using Depth Testing

Determine which pixels are visible in a scene by using a depth texture.

Generating Multiple Output Vertex Streams from One Input Stream

Render efficiently to multiple layers or viewports.

Render Pipelines

Specify how graphics primitives should be rendered.

protocol MTLRenderCommandEncoder

The object to use for encoding commands for a render pass.

protocol MTLParallelRenderCommandEncoder

An object that splits up a single render pass so that it can be simultaneously encoded from multiple threads.

Model I/O

Specify precise locations within the textures associated with graphics processing.