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

# MTLComputePassSampleBufferAttachmentDescriptor

A configuration that instructs the GPU where to store counter data from the beginning and end of a compute pass.

```
class MTLComputePassSampleBufferAttachmentDescriptor
```

## Overview

For more context about configuring sample buffer attachments for compute passes, see [Sampling GPU data into counter sample buffers](/documentation/Metal/sampling-gpu-data-into-counter-sample-buffers). That article is one of a series in [GPU counters and counter sample buffers](/documentation/Metal/gpu-counters-and-counter-sample-buffers) about sampling Metal hardware counters for performance measurement.

## Topics

### Configuring the sample buffer attachment

[`sampleBuffer`](/documentation/Metal/MTLComputePassSampleBufferAttachmentDescriptor/sampleBuffer)

A specialized memory buffer that the GPU uses to store its counter data during a compute pass.

[`startOfEncoderSampleIndex`](/documentation/Metal/MTLComputePassSampleBufferAttachmentDescriptor/startOfEncoderSampleIndex)

An index within a counter sample buffer that tells the GPU where to store counter data from the start of a compute pass.

[`endOfEncoderSampleIndex`](/documentation/Metal/MTLComputePassSampleBufferAttachmentDescriptor/endOfEncoderSampleIndex)

An index within a counter sample buffer that tells the GPU where to store counter data from the end of a compute pass.



---

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)