<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderPassDescriptor/getSamplePositions:count:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLRenderPassDescriptor(im)getSamplePositions:count:"
  },
  "title" : "getSamplePositions:count:"
}
-->

# getSamplePositions:count:

Retrieves the programmable sample positions set for a render pass.

```
- (NSUInteger) getSamplePositions:(MTLSamplePosition *) positions count:(NSUInteger) count;
```

## Parameters

`positions`

A pointer to a destination array of sample positions where Metal writes the programmable sample positions.

`count`

The number of programmable sample positions to retrieve.

## Return Value

The total number of programmable sample positions set for the render pass.

## Discussion

The value of `count` needs to be equal to the number of programmable sample positions set by a previous call to the [`setSamplePositions:count:`](/documentation/Metal/MTLRenderPassDescriptor/setSamplePositions:count:) method (the `count` parameter). Also, the `positions` array needs to contain at least as many elements as the value of `count`.

If you don’t know the correct value for `count`, you may query this method by passing a `nil` array for `positions` and a `0` value for `count`. This method returns the number of programmable sample positions that are currently set.

---

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)