Instance Method

enqueue

Reserves a place for the command buffer on the associated command queue.

Required.

Declaration

- (void)enqueue;

Discussion

Enqueueing a command buffer reserves a place for the command buffer on the command queue without committing the command buffer for execution. When this command buffer is later committed, it keeps its position in the queue. You enqueue command buffers so that you can create multiple command buffers with a fixed order of execution without encoding the command buffers serially. You can use other threads to encode commands into the command buffers and those threads can complete in any order.

You can call the enqueue method before, during, or after encoding of commands. You can only enqueue a command buffer once.

The enqueue method doesn’t make the command buffer eligible for execution. To execute the command buffer, call the commit method.

See Also

Scheduling and Executing Commands

- commit

Commits the command buffer for execution.

Required.

- addScheduledHandler:

Registers a block of code that Metal calls immediately after it schedules the command buffer for execution on the GPU.

Required.

- addCompletedHandler:

Registers a block of code that Metal calls immediately after the GPU finishes executing the commands in the command buffer.

Required.

- waitUntilScheduled

Blocks execution of the current thread until the command buffer is scheduled.

Required.

- waitUntilCompleted

Blocks execution of the current thread until execution of the command buffer is completed.

Required.

MTLCommandBufferHandler

A block of code invoked when a command buffer is scheduled for execution or has completed execution.