Contents

MTLParallelRenderCommandEncoder

An instance that splits up a single render pass so that it can be simultaneously encoded from multiple threads.

Declaration

protocol MTLParallelRenderCommandEncoder : MTLCommandEncoder

Mentioned in

Overview

Your app does not define classes that implement this protocol. To create an MTLParallelRenderCommandEncoder instance, call the makeParallelRenderCommandEncoder(descriptor:) method of the MTLCommandBuffer instance that you want to encode the rendering commands into. Then, call the renderCommandEncoder method on this MTLParallelRenderCommandEncoder instance to create one or more MTLRenderCommandEncoder instances. The subordinate MTLRenderCommandEncoder instances created encode their commands to the same command buffer and target the same MTLRenderPassAttachmentDescriptor instance. The MTLParallelRenderCommandEncoder instance ensures the attachment load and store actions only occur at the start and end of the entire rendering pass.

You can assign each MTLRenderCommandEncoder to its own thread and each can encode commands in parallel. You are responsible for any thread synchronization that is required. After all the subordinate encoders have finished encoding their commands, call endEncoding() to execute the commands. The rendering commands are executed in the order that the subordinate encoders were created.

Topics

Creating a render command encoder

Setting render pass state

See Also

Encoding a render pass in parallel