<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderPassDescriptor/setSamplePositions(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So23MTLRenderPassDescriptorC5MetalE18setSamplePositionsyySaySo17MTLSamplePositionaGF"
  },
  "title" : "setSamplePositions(_:)"
}
-->

# setSamplePositions(_:)

Sets the programmable sample positions for a render pass.

```
func setSamplePositions(_ positions: [MTLSamplePosition])
```

## Parameters

`positions`

An array of programmable sample positions for the render pass with the
the same number of elements as the render pass sample count,
or an empty array 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 length of the array 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)