commit()
Submits the command buffer to run on the GPU.
Declaration
func commit()Mentioned in
Discussion
The commit() method sends the command buffer to the MTLCommandQueue instance that owns it, which then schedules it to run on the GPU. If your app calls commit() for a command buffer that isn’t enqueued, the method effectively calls enqueue() for you.
The commit() method has several restrictions, including:
You can commit a command buffer to its command queue only one time.
You can only commit a command buffer when it doesn’t have an active encoder (see MTLCommandBuffer and MTLCommandEncoder).
You can’t encode additional commands to a command buffer after you commit it.
You can’t call the addScheduledHandler(_:) or addCompletedHandler(_:) methods after you commit a command buffer.
The GPU starts the command buffer after it starts any command buffers that are ahead of it in the same command queue.