---
title: "setSamplePositions(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrenderpassdescriptor/setsamplepositions(_:)"
---

# setSamplePositions(_:)

Sets the programmable sample positions for a render pass.

## Declaration

```swift
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

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 supportsTextureSampleCount(_:) method to determine whether the device object supports a specific sample count.

## See Also

### Using programmable sample positions

- [MTLSamplePositionMake(_:_:)](metal/mtlsamplepositionmake(_:_:).md)
- [getSamplePositions()](metal/mtlrenderpassdescriptor/getsamplepositions().md)
