Contents

MTLCommandQueue

An instance you use to create, submit, and schedule command buffers to a specific GPU device to run the commands within those buffers.

Declaration

protocol MTLCommandQueue : NSObjectProtocol, Sendable

Mentioned in

Overview

A command queue maintains an ordered list of command buffers. You use a command queue to:

  • Create command buffers, which you fill with commands for the GPU device that creates the queue

  • Submit command buffers to run on that GPU

Create a command queue from an MTLDevice instance by calling its makeCommandQueue() or makeCommandQueue(maxCommandBufferCount:) method. Typically, you create one or more command queues when your app launches and then keep them throughout your app’s lifetime.

With each MTLCommandQueue instance you create, you can create MTLCommandBuffer instances for that queue by calling its makeCommandBuffer() or makeCommandBufferWithUnretainedReferences() method.

For more information about command buffers and encoding GPU commands to them — such as rendering images and computing data in parallel — see Setting up a command structure.

Topics

Creating command buffers

Attaching residency sets

Detaching residency sets

Identifying the command queue

Deprecated

See Also

Submitting work to a GPU with Metal