Protocol

MTLRenderPipelineState

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

Overview

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.

Topics

Identifying Properties

var device: MTLDevice

The device for which this pipeline state object was created.

Required.

var label: String?

A string to help identify this object.

Required.

Using Tile Functions

var maxTotalThreadsPerThreadgroup: Int

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

Required.

var threadgroupSizeMatchesTileSize: Bool

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

Required.

Using Imageblocks

var imageblockSampleLength: Int

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

Required.

func imageblockMemoryLength(forDimensions: MTLSize)

Returns the imageblock memory length for the given imageblock dimensions.

Required.

Relationships

Inherits From

See Also

Render Pipeline

class MTLRenderPipelineDescriptor

An object that configures new MTLRenderPipelineState objects.