<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCommandBuffer/commit()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLCommandBuffer(im)commit"
  },
  "title" : "commit()"
}
-->

# commit()

Submits the command buffer to run on the GPU.

```
func commit()
```

## Discussion

The [`commit()`](/documentation/Metal/MTLCommandBuffer/commit()) method sends the command buffer to the [`MTLCommandQueue`](/documentation/Metal/MTLCommandQueue) instance that owns it, which then schedules it to run on the GPU. If your app calls [`commit()`](/documentation/Metal/MTLCommandBuffer/commit()) for a command buffer that isn’t enqueued, the method effectively calls [`enqueue()`](/documentation/Metal/MTLCommandBuffer/enqueue()) for you.

The [`commit()`](/documentation/Metal/MTLCommandBuffer/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`](/documentation/Metal/MTLCommandBuffer) and [`MTLCommandEncoder`](/documentation/Metal/MTLCommandEncoder)).
- You can’t encode additional commands to a command buffer after you commit it.
- You can’t call the [`addScheduledHandler(_:)`](/documentation/Metal/MTLCommandBuffer/addScheduledHandler(_:)) or [`addCompletedHandler(_:)`](/documentation/Metal/MTLCommandBuffer/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)