<!--
{
  "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/setSamplePositions:count:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLRenderPassDescriptor(im)setSamplePositions:count:"
  },
  "title" : "setSamplePositions:count:"
}
-->

# setSamplePositions:count:

Sets the programmable sample positions for a render pass.

```
- (void) setSamplePositions:(const MTLSamplePosition *) positions count:(NSUInteger) count;
```

## Parameters

`positions`

An array of programmable sample positions for the render pass.

`count`

The number of elements, which needs to match the render pass sample count,
or `0` to disable custom sample positions.

## Discussion

Programmable sample positions need to be floating-point values in the `[0.0, 1.0)` range along each axis, with the origin `(0,0)` defined at the top-left corner. Values can be set from `0/16` up to `15/16`, inclusive, in 1`/16` increments along each axis.

If the value of `count` is `0`, the GPU uses the default sample positions for the render pass.

> Note:
> Call the ``doc://com.apple.metal/documentation/Metal/MTLDevice/supportsTextureSampleCount(_:)`` method to determine whether the device object supports a specific sample count.

---

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)