Class

MTLStencilDescriptor

An object that defines the front-facing or back-facing stencil operations of a depth and stencil state object.

Declaration

@interface MTLStencilDescriptor : NSObject

Overview

A stencil test is a comparison between a masked reference value and a masked value stored in a stencil attachment. (A value is masked by performing a logical AND operation on it with the readMask value.) The MTLStencilDescriptor object defines how to update the contents of the stencil attachment, based on the results of the stencil test and the depth test.

The stencilCompareFunction property defines the stencil test. The stencilFailureOperation, depthFailureOperation, and depthStencilPassOperation properties specify what to do to a stencil value stored in the stencil attachment for three different test outcomes: if the stencil test fails, if the stencil test passes and the depth test fails, or if both stencil and depth tests succeed, respectively. writeMask determines which stencil bits can be modified as the result of a stencil operation.

Topics

Specifying Stencil Functions and Operations

stencilFailureOperation

The operation that is performed to update the values in the stencil attachment when the stencil test fails.

depthFailureOperation

The operation that is performed to update the values in the stencil attachment when the stencil test passes, but the depth test fails.

depthStencilPassOperation

The operation that is performed to update the values in the stencil attachment when both the stencil test and the depth test pass.

stencilCompareFunction

The comparison that is performed between the masked reference value and a masked value in the stencil attachment.

Specifying Stencil Bit Mask Properties

readMask

A bitmask that determines from which bits that stencil comparison tests can read.

writeMask

A bitmask that determines to which bits that stencil operations can write.

Constants

MTLStencilOperation

The operation performed on a currently stored stencil value when a comparison test passes or fails.

Relationships

Inherits From

Conforms To

See Also

Creating Depth and Stencil Objects

MTLDepthStencilDescriptor

An object that configures new MTLDepthStencilState objects.

MTLDepthStencilState

A depth and stencil state object that specifies the depth and stencil configuration and operations used in a render pass.