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


class MTLRenderPassDescriptor : NSObject


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.


Specifying the Attachments for a Rendering Pass

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.

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

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.


Inherits From

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software