---
title: "resolveCounterRange(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlcountersamplebuffer/resolvecounterrange(_:)"
---

# resolveCounterRange(_:)

Transforms samples of a GPU’s counter set from the driver’s internal format to a standard Metal data structure.

## Declaration

```swift
func resolveCounterRange(_ range: Range<Int>) throws -> Data?
```

## Parameters

- `range`: A range that indicates which sample instances the method resolves in the counter sample buffer.

## Mentioned in

Converting a GPU’s counter data into a readable format

## Return Value

Return Value A Data instance in Swift, or an NSData instance in Objective-C, if the method successfully resolves the range of samples in the buffer; otherwise, nil.

## Discussion

Discussion You can only call this method on a counter sample buffer that you create with MTLStorageMode.shared (see storageMode). For an example of how and when to use this method, see Converting a GPU’s counter data into a readable format. note: The GPU stores MTLCounterErrorValue in destinationBuffer each time it encounters an error resolving a sample.
