Contents

setRenderPipelineState(_:)

Configures the encoder with a render or tile pipeline state that applies to your subsequent draw commands.

Declaration

func setRenderPipelineState(_ pipelineState: any MTLRenderPipelineState)

Parameters

Discussion

Set the render pass’s render pipeline state before encoding any draw or tile commands by calling this method because the default pipeline state is nil.

You can change which pipeline state the encoder uses multiple times during its lifetime. For example, your app may want render some things with a vertex shader, and render others with an object and mesh shader. Changing the pipeline state only affects the subsequent commands and has no effect on the commands you encode before changing the state.

The render pipeline you pass to this method needs to be compatible with the render pass’s attachments. You configure these attachments with the properties of an MTLRenderPassDescriptor instance, including colorAttachments, depthAttachment, and stencilAttachment.