---
title: "makeCounterHeap(descriptor:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtldevice/makecounterheap(descriptor:)"
---

# makeCounterHeap(descriptor:)

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

## Declaration

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

## Parameters

- `descriptor`: doc://com.apple.metal/documentation/Metal/MTL4CounterHeapDescriptor instance that configures the doc://com.apple.metal/documentation/Metal/MTL4CounterHeap instance.

## Return Value

Return Value A MTL4CounterHeap instance, or nil if the function failed.
