MTLStencilDescriptor
An object that defines the front-facing or back-facing stencil operations of a depth and stencil state object.
Declaration
class MTLStencilDescriptorOverview
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
Configuring stencil functions and operations
stencilFailureOperationdepthFailureOperationdepthStencilPassOperationstencilCompareFunctionMTLStencilOperation