<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLBlitCommandEncoder/resolveCounters(_:range:destinationBuffer:destinationOffset:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So21MTLBlitCommandEncoderP5MetalE15resolveCounters_5range17destinationBuffer0H6OffsetySo016MTLCounterSampleI0_p_SnySiGSo9MTLBuffer_pSitF"
  },
  "title" : "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.

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

## Discussion

For an example of how and when to use this method, see [Converting a GPU’s counter data into a readable format](/documentation/Metal/converting-a-gpus-counter-data-into-a-readable-format).

> Note:
> The GPU stores ``doc://com.apple.metal/documentation/Metal/MTLCounterErrorValue`` in `destinationBuffer` each time it encounters an error resolving a sample.

---

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)