<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/render-pass-configuration",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Render pass configuration"
}
-->

# Render pass configuration

Set a render pass’s pipeline state, attachment actions, viewports, and so on, that affect subsequent drawing commands.

## Discussion

These methods encode commands that configure the render pass for all subsequent drawing commands.
The most important configuration is the pipeline state (see [`MTLRenderPipelineState`](/documentation/Metal/MTLRenderPipelineState)), which you configure by calling the [`setRenderPipelineState(_:)`](/documentation/Metal/MTLRenderCommandEncoder/setRenderPipelineState(_:)) method.

## Topics

### Configuring pipeline state

[`func setRenderPipelineState(any MTLRenderPipelineState)`](/documentation/Metal/MTLRenderCommandEncoder/setRenderPipelineState(_:))

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

### Configuring the actions for attachments

[`func setColorStoreAction(MTLStoreAction, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setColorStoreAction(_:index:))

Configures the store action for a color attachment.

[`func setColorStoreActionOptions(MTLStoreActionOptions, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setColorStoreActionOptions(_:index:))

Configures the store action options for a color attachment.

[`func setDepthStoreAction(MTLStoreAction)`](/documentation/Metal/MTLRenderCommandEncoder/setDepthStoreAction(_:))

Configures the store action for the depth attachment.

[`func setDepthStoreActionOptions(MTLStoreActionOptions)`](/documentation/Metal/MTLRenderCommandEncoder/setDepthStoreActionOptions(_:))

Configures the store action options for the depth attachment.

[`func setStencilStoreAction(MTLStoreAction)`](/documentation/Metal/MTLRenderCommandEncoder/setStencilStoreAction(_:))

Configures the store action for the stencil attachment.

[`func setStencilStoreActionOptions(MTLStoreActionOptions)`](/documentation/Metal/MTLRenderCommandEncoder/setStencilStoreActionOptions(_:))

Configures the store action options for the stencil attachment.

### Configuring blend behavior

[`func setBlendColor(red: Float, green: Float, blue: Float, alpha: Float)`](/documentation/Metal/MTLRenderCommandEncoder/setBlendColor(red:green:blue:alpha:))

Configures each pixel component value, including alpha, for the render pipeline’s constant blend color.

[`func setColorAttachmentMap(MTLLogicalToPhysicalColorAttachmentMap?)`](/documentation/Metal/MTLRenderCommandEncoder/setColorAttachmentMap(_:))

Sets the mapping from logical shader color output to physical render pass color attachments.

### Configuring rendering behavior

[`func setTriangleFillMode(MTLTriangleFillMode)`](/documentation/Metal/MTLRenderCommandEncoder/setTriangleFillMode(_:))

Configures how subsequent draw commands rasterize triangle and triangle strip primitives.

[`func setFrontFacing(MTLWinding)`](/documentation/Metal/MTLRenderCommandEncoder/setFrontFacing(_:))

Configures which face of a primitive, such as a triangle, is the front.

[`func setCullMode(MTLCullMode)`](/documentation/Metal/MTLRenderCommandEncoder/setCullMode(_:))

Configures how the render pipeline determines which primitives to remove.

### Configuring depth and stencil behavior

[`func setDepthStencilState((any MTLDepthStencilState)?)`](/documentation/Metal/MTLRenderCommandEncoder/setDepthStencilState(_:))

Configures the combined depth and stencil state.

[`func setDepthBias(Float, slopeScale: Float, clamp: Float)`](/documentation/Metal/MTLRenderCommandEncoder/setDepthBias(_:slopeScale:clamp:))

Configures the adjustments a render pass applies to depth values from fragment functions by a scaling factor and bias.

[`func setDepthClipMode(MTLDepthClipMode)`](/documentation/Metal/MTLRenderCommandEncoder/setDepthClipMode(_:))

Configures how the render pipeline handles fragments outside the near and far planes of the view frustum.

[`func setDepthTestBounds(ClosedRange<Float>)`](/documentation/Metal/MTLRenderCommandEncoder/setDepthTestBounds(_:))

Configures the range for depth bounds testing.

[`- (void) setDepthTestMinBound:(float) minBound maxBound:(float) maxBound;`](/documentation/Metal/MTLRenderCommandEncoder/setDepthTestMinBound:maxBound:)

Configures the minimum and maximum bounds for depth bounds testing.

[`func setStencilReferenceValue(UInt32)`](/documentation/Metal/MTLRenderCommandEncoder/setStencilReferenceValue(_:))

Configures the same comparison value for front- and back-facing primitives.

[`func setStencilReferenceValues(front: UInt32, back: UInt32)`](/documentation/Metal/MTLRenderCommandEncoder/setStencilReferenceValues(front:back:))

Configures different comparison values for front- and back-facing primitives.

### Configuring viewport and scissor behavior

[`func setViewport(MTLViewport)`](/documentation/Metal/MTLRenderCommandEncoder/setViewport(_:))

Configures the render pipeline with a viewport that applies a transformation and a clipping rectangle.

[`func setViewports([MTLViewport])`](/documentation/Metal/MTLRenderCommandEncoder/setViewports(_:))

Configures the render pipeline with multiple viewports that apply transformations and clipping rectangles.

[`- (void) setViewports:(const MTLViewport[]) viewports count:(NSUInteger) count;`](/documentation/Metal/MTLRenderCommandEncoder/setViewports:count:)

Configures the render pipeline with multiple viewports that apply transformations and clipping rectangles.

[`func setScissorRect(MTLScissorRect)`](/documentation/Metal/MTLRenderCommandEncoder/setScissorRect(_:))

Configures a rectangle for the fragment scissor test.

[`func setScissorRects([MTLScissorRect])`](/documentation/Metal/MTLRenderCommandEncoder/setScissorRects(_:))

Configures multiple rectangles for the fragment scissor test.

[`- (void) setScissorRects:(const MTLScissorRect[]) scissorRects count:(NSUInteger) count;`](/documentation/Metal/MTLRenderCommandEncoder/setScissorRects:count:)

Configures multiple rectangles for the fragment scissor test.

### Configuring visibility testing

[`func setVisibilityResultMode(MTLVisibilityResultMode, offset: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setVisibilityResultMode(_:offset:))

Configures which visibility test the GPU runs and the destination for any results it generates.

### Configuring vertex amplification

[`func setVertexAmplificationCount(Int, viewMappings: UnsafePointer<MTLVertexAmplificationViewMapping>?)`](/documentation/Metal/MTLRenderCommandEncoder/setVertexAmplificationCount(_:viewMappings:))

Configures the number of output vertices the render pipeline produces for each input vertex, optionally with render target and viewport offsets.

### Configuring tessellation factors

[`func setTessellationFactorScale(Float)`](/documentation/Metal/MTLRenderCommandEncoder/setTessellationFactorScale(_:))

Configures the scale factor for per-patch tessellation factors.

[`func setTessellationFactorBuffer((any MTLBuffer)?, offset: Int, instanceStride: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setTessellationFactorBuffer(_:offset:instanceStride:))

Configures the per-patch tessellation factors for any subsequent patch-drawing commands.

### Configuring persistent threadgroup memory

[`func setObjectThreadgroupMemoryLength(Int, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setObjectThreadgroupMemoryLength(_:index:))

Configures the size of a threadgroup memory buffer for an entry in the object argument table.

[`func setThreadgroupMemoryLength(Int, offset: Int, index: Int)`](/documentation/Metal/MTLRenderCommandEncoder/setThreadgroupMemoryLength(_:offset:index:))

Configures the size of a threadgroup memory buffer for an entry in the fragment or tile shader argument table.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)