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

# setSamplePositions:count:

Sets the programmable sample positions for a render pass.

## Declaration

```occ
- (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.

## Mentioned in

Positioning samples programmatically

## 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 value of count 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:count:](metal/mtlrenderpassdescriptor/getsamplepositions:count:.md)
