An object that contains the graphics functions and configuration state used in a render pass.


protocol MTLRenderPipelineState


The MTLRenderPipelineState protocol defines the interface for a lightweight object used to encode the state for a configured graphics rendering pipeline.

To use MTLRenderCommandEncoder to encode commands for a rendering pass, specify a MTLRenderPipelineState object that defines the graphics state, including vertex and fragment shader functions, before issuing any draw calls. Because creating a pipeline state object can require an expensive evaluation of graphics state and a possible compilation of the specified graphics shader functions, you usually create these pipeline state objects early in the development of your app and reuse them throughout its lifetime.

Do not use standard allocation and initialization techniques to create a MTLRenderPipelineState object. To create a MTLRenderPipelineState object, first create a MTLRenderPipelineDescriptor object that describes the desired state of the pipeline. Then call one of these MTLDevice methods.

The makeRenderPipelineState(descriptor:options:reflection:) and makeRenderPipelineState(descriptor:options:completionHandler:) methods of MTLDevice also obtain reflection data in a MTLRenderPipelineReflection object that reveals details of the arguments of the vertex and fragment functions. (In makeRenderPipelineState(descriptor:options:completionHandler:), the reflection data is returned in the completion handler.) Obtain reflection data only if it will be used.


Identifying Properties

var device: MTLDevice

The device for which this pipeline state object was created.


var label: String?

A string that identifies this object.


Using Tile Functions

var maxTotalThreadsPerThreadgroup: Int

The maximum total number of threads that can be in a single threadgroup.


var threadgroupSizeMatchesTileSize: Bool

A Boolean indicating that the pipeline state requires a threadgroup size equal to the tile size.


Using Imageblocks

var imageblockSampleLength: Int

The size, in bytes, of the render pipeline's imageblock for a single sample.


func imageblockMemoryLength(forDimensions: MTLSize) -> Int

Returns the imageblock memory length for the given imageblock dimensions.


Indirect Command Buffers

var supportIndirectCommandBuffers: Bool

A Boolean that indicates whether you can use this render pipeline state with indirect command buffers.



Inherits From

See Also

Creating Render Pipeline State Objects

class MTLRenderPipelineDescriptor

An argument of options you pass to a device to get a render pipeline state object.

class MTLTileRenderPipelineDescriptor

An object that configures new render pipeline state objects for tile shading.