<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDevice/makeCounterHeap(descriptor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLDevice(im)newCounterHeapWithDescriptor:error:"
  },
  "title" : "makeCounterHeap(descriptor:)"
}
-->

# makeCounterHeap(descriptor:)

Creates a new counter heap configured from a counter heap descriptor.

```
func makeCounterHeap(descriptor: MTL4CounterHeapDescriptor) throws -> any MTL4CounterHeap
```

## Parameters

`descriptor`

[`MTL4CounterHeapDescriptor`](/documentation/Metal/MTL4CounterHeapDescriptor) instance that configures the [`MTL4CounterHeap`](/documentation/Metal/MTL4CounterHeap) instance.

## Return Value

A [`MTL4CounterHeap`](/documentation/Metal/MTL4CounterHeap) instance, or `nil` if the function failed.

---

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)