<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCommandQueue/makeCommandBuffer(descriptor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLCommandQueue(im)commandBufferWithDescriptor:"
  },
  "title" : "makeCommandBuffer(descriptor:)"
}
-->

# makeCommandBuffer(descriptor:)

Returns a command buffer from the command queue that you configure with a descriptor.

```
func makeCommandBuffer(descriptor: MTLCommandBufferDescriptor) -> (any MTLCommandBuffer)?
```

## Parameters

`descriptor`

An [`MTLCommandBufferDescriptor`](/documentation/Metal/MTLCommandBufferDescriptor) instance that configures the [`MTLCommandBuffer`](/documentation/Metal/MTLCommandBuffer) the method returns.

## Discussion

Use this method to create a command buffer that you configure with a descriptor. You can configure whether the command buffer retains references to resources that its commands refer to by setting the `descriptor` parameter’s [`retainedReferences`](/documentation/Metal/MTLCommandBufferDescriptor/retainedReferences) property. You can also configure whether the command buffer saves extra error information, which is useful during development, by setting the descriptor’s [`errorOptions`](/documentation/Metal/MTLCommandBufferDescriptor/errorOptions) property.

Each command queue has a fixed number of command buffers for its lifetime (see [`makeCommandQueue(maxCommandBufferCount:)`](/documentation/Metal/MTLDevice/makeCommandQueue(maxCommandBufferCount:))). This method blocks the calling CPU thread when the queue doesn’t have any free command buffers, and returns after the GPU finishes executing one.

---

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)