MTLDepthStencilState
A depth and stencil state instance that specifies the depth and stencil configuration and operations used in a render pass.
Declaration
protocol MTLDepthStencilState : NSObjectProtocol, SendableOverview
The MTLDepthStencilState protocol defines the interface for a lightweight instance used to encode how a graphics rendering pass should perform depth and stencil operations. The MTLRenderCommandEncoder uses an MTLDepthStencilState instance to set the depth and stencil state for a rendering pass.
The standard allocation and initialization techniques don’t apply when creating an MTLDepthStencilState instance. Instead, you can apply the following steps:
Create an MTLDepthStencilDescriptor instance that defines the operations you want the rendering pass to use.
Create an MTLDepthStencilState instance by passing the descriptor to an MTLDevice instance’s makeDepthStencilState(descriptor:) method.
Typically, you create MTLDepthStencilState instances when your app is first initialized and then reuse them throughout the lifetime of your app.