setDepthStencilState(_:)
Configures the combined depth and stencil state.
Declaration
func setDepthStencilState(_ depthStencilState: (any MTLDepthStencilState)?)Parameters
- depthStencilState:
An instance that conforms to the Mtldepthstencilstate protocol.
Discussion
This method changes the combined depth and stencil state for the render command encoder that’s compatible with its depth and stencil attachment configuration. For example, if the new state enables depth testing or depth writing, the render pass needs to have a depth attachment. Similarly, if the new state enables stencil testing or stencil writing, the render pass’s stencil needs to have a stencil attachment. You create depth and stencil attachments for a render pass by assigning the depthAttachment and stencilAttachment properties of the MTLRenderPassDescriptor instance that creates it.
Pass nil to clear the state from the previous call, which restores a state that’s equivalent to the default values of an MTLDepthStencilDescriptor instance’s properties.