An object that contains the graphics functions and configuration state used in a render pass.
SDKs
- iOS 8.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- Metal
Declaration
protocol MTLRenderPipelineState
Overview
The MTLRender
protocol defines the interface for a lightweight object used to encode the state for a configured graphics rendering pipeline.
To use MTLRender
to encode commands for a rendering pass, specify a MTLRender
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 MTLRender
object. To create a MTLRender
object, first create a MTLRender
object that describes the desired state of the pipeline. Then call one of these MTLDevice
methods.
Call either the
make
orRender Pipeline State(descriptor:) make
method to synchronously create aRender Pipeline State(descriptor: options: reflection:) MTLRender
object and compile the graphics state, including graphics shader code.Pipeline State Call either the
make
orRender Pipeline State(descriptor: completion Handler:) make
method to asynchronously create aRender Pipeline State(descriptor: options: completion Handler:) MTLRender
object and compile the graphics state, including graphics shader code. The completion handler is the last operation executed during creation of the pipeline state object.Pipeline State
The make
and make
methods of MTLDevice
also obtain reflection data in a MTLRender
object that reveals details of the arguments of the vertex and fragment functions. (In make
, the reflection data is returned in the completion handler.) Obtain reflection data only if it will be used.