<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCounterSampleBuffer",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLCounterSampleBuffer"
  },
  "title" : "MTLCounterSampleBuffer"
}
-->

# MTLCounterSampleBuffer

A specialized memory buffer that stores a GPU’s counter set data.

```
protocol MTLCounterSampleBuffer : NSObjectProtocol
```

## Overview

Create a counter sample buffer by calling an [`MTLDevice`](/documentation/Metal/MTLDevice) instance’s [`makeCounterSampleBuffer(descriptor:)`](/documentation/Metal/MTLDevice/makeCounterSampleBuffer(descriptor:)) method. See [Creating a counter sample buffer to store a GPU’s counter data during a pass](/documentation/Metal/creating-a-counter-sample-buffer-to-store-a-gpus-counter-data-during-a-pass).

You can store a GPU device’s counter set data only with an [`MTLCounterSampleBuffer`](/documentation/Metal/MTLCounterSampleBuffer) instance that you create from the same device. See [Sampling GPU data into counter sample buffers](/documentation/Metal/sampling-gpu-data-into-counter-sample-buffers) for information about storing counter sample data in a counter sample buffer.

## Topics

### Resolving the counter sample buffer’s data

[`resolveCounterRange(_:)`](/documentation/Metal/MTLCounterSampleBuffer/resolveCounterRange(_:))

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

[`resolveCounterRange:`](/documentation/Metal/MTLCounterSampleBuffer/resolveCounterRange:)

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

### Inspecting the counter sample buffer’s configuration

[`label`](/documentation/Metal/MTLCounterSampleBuffer/label)

A string that identifies the counter sample buffer.

[`device`](/documentation/Metal/MTLCounterSampleBuffer/device)

The GPU device instance that owns the counter sample buffer.

[`sampleCount`](/documentation/Metal/MTLCounterSampleBuffer/sampleCount)

The number of samples in the buffer.



---

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)