---
title: "resolveCounters(_:range:destinationBuffer:destinationOffset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlblitcommandencoder/resolvecounters(_:range:destinationbuffer:destinationoffset:)"
---

# resolveCounters(_:range:destinationBuffer:destinationOffset:)

Encodes a command that resolves the data from the samples in a sample counter buffer and stores the results into a buffer.

## Declaration

```swift
func resolveCounters(_ sampleBuffer: any MTLCounterSampleBuffer, range: Range<Int>, destinationBuffer: any MTLBuffer, destinationOffset: Int)
```

## Parameters

- `sampleBuffer`: A counter sample buffer source that contains the sample data.
- `range`: A range that indicates which of the buffer’s samples the command resolves.
- `destinationBuffer`: A destination buffer where the command stores the data it resolves.
- `destinationOffset`: A starting offset, in bytes, within destinationBuffer where the blit pass writes the first byte of the data it resolves.

## Mentioned in

Converting a GPU’s counter data into a readable format

## Discussion

Discussion 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.

## See Also

### Sampling counters

- [sampleCounters(sampleBuffer:sampleIndex:barrier:)](metal/mtlblitcommandencoder/samplecounters(samplebuffer:sampleindex:barrier:).md)
