drawMaskOnStencilAttachment(commandEncoder:value:)
Store the value parameter in the stencil texture in the pixels that the Compositor displays onscreen.
Declaration
func drawMaskOnStencilAttachment(commandEncoder command_encoder: any MTL4RenderCommandEncoder, value: UInt8)Parameters
- value:
The value to use when updating the stencil texture in the Mtlrendercommandencoder.
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:
The stencil texture has the same pixel format as cp_layer_renderer_configuration_get_drawable_render_context_stencil_format.
The renderTargetArrayLength is the same as the number of views in the layer renderer drawable.
The rasterizationRateMap matches the one provided by the layer renderer drawable.
The API doesn’t support dedicated or shared layouts.
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.