Instance Method

setDepthStencilState(_:)

Sets the depth and stencil test state.

Required.

Declaration

func setDepthStencilState(_ depthStencilState: MTLDepthStencilState?)

Parameters

depthStencilState

An object that contains the depth and stencil state.

Discussion

The depth and stencil state must be compatible with the attachment configuration specified by the render pass descriptor. If you enable depth testing or depth writing, the MTLRenderPassDescriptor must include a depth attachment. If you enable stencil testing or stencil writing, the MTLRenderPassDescriptor must include a stencil attachment.

The default value is nil; the default property values of MTLDepthStencilDescriptor determine the behavior.

See Also

Setting Depth and Stencil Behavior

func setDepthBias(Float, slopeScale: Float, clamp: Float)

Adjusts the depth values from fragment functions by a scaling factor and a scaling bias, clamping the bias to a maximum amount.

Required.

func setDepthClipMode(MTLDepthClipMode)

Controls what is done with fragments outside of the near or far planes.

Required.

enum MTLDepthClipMode

The mode that determines how to deal with fragments outside of the near or far planes.

func setStencilReferenceValues(front: UInt32, back: UInt32)

Sets the stencil reference values for front and back stencil comparison tests.

Required.

func setStencilReferenceValue(UInt32)

Sets a stencil reference value for both front and back stencil comparison tests.

Required.