<!--
{
  "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/startOfEncoderSampleIndex",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLResourceStatePassSampleBufferAttachmentDescriptor(py)startOfEncoderSampleIndex"
  },
  "title" : "startOfEncoderSampleIndex"
}
-->

# startOfEncoderSampleIndex

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

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

## Discussion

Specify [`MTLCounterDontSample`](/documentation/Metal/MTLCounterDontSample) if you don’t want to sample GPU counters at the start 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)