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

# endOfEncoderSampleIndex

The index the Metal device object should use to store GPU counters when ending the resource state pass.

```
var endOfEncoderSampleIndex: Int { get set }
```

## Discussion

Specify [`MTLCounterDontSample`](/documentation/Metal/MTLCounterDontSample) if you don’t want to sample GPU counters at the end of the resource state pass. Otherwise, specify an index within the sample buffer where you want the GPU to write the sample data.

On devices that don’t support [`MTLCounterSamplingPoint.atStageBoundary`](/documentation/Metal/MTLCounterSamplingPoint/atStageBoundary) you need to set the value to [`MTLCounterDontSample`](/documentation/Metal/MTLCounterDontSample).

---

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)