endEncoding(commandEncoder:)
Finish encoding the render context.
Declaration
func endEncoding(commandEncoder command_encoder: any MTLRenderCommandEncoder)Parameters
- command_encoder:
The command encoder to use to render the Compositor effects and present the layer renderer drawable.
Discussion
endEncoding(commandEncoder:) passes the ownership of the command encoder to the drawable render context and calls endEncoding() on the command encoder. The command encoder used in the render context has the following constraints:
The
colorAttachment[0]contains the color texture provided by the layer renderer drawable.The depthAttachment contains the depth texture provided by the layer renderer drawable.
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 and 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.