---
title: commit()
framework: metal
role: symbol
role_heading: Instance Method
path: metal/mtlcommandbuffer/commit()
---

# commit()

Submits the command buffer to run on the GPU.

## Declaration

```swift
func commit()
```

## Mentioned in

Simplifying GPU resource management with residency sets Understanding the Metal 4 core API

## Discussion

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.

## See Also

### Submitting a command buffer

- [enqueue()](metal/mtlcommandbuffer/enqueue().md)
