Contents

drawMaskOnStencilAttachment(commandEncoder:value:)

Store the value parameter in the stencil texture in the pixels that the compositor will display onscreen.

Declaration

func drawMaskOnStencilAttachment(commandEncoder command_encoder: any MTLRenderCommandEncoder, value: UInt8)

Parameters

Discussion

In full and mixed immersion styles, drawMaskOnStencilAttachment(commandEncoder:value:) stores the full texture. The command encoder used in the render context has the following constraints:

If the render encoder has multiple color attachments, set supportColorAttachmentMapping to true to avoid Metal API validation errors.

For testing performance of this method, always test your app on-device rather than in Simulator. However, if you need to iterate on your code in development, you can disable API validation in Xcode, or separate the rendering into multiple render encoders for other color attachments.

This function modifies the depth stencil state, viewports, vertex amplification count, and some of the texture bindings in the render command encoder passed to the function. Make sure to set those values again to those expected in your app.

See Also

Rendering with Metal