---
title: "setSamplerStates(_:range:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlargumentencoder/setsamplerstates(_:range:)"
---

# setSamplerStates(_:range:)

Encodes an array of samplers into the argument buffer.

## Declaration

```swift
func setSamplerStates(_ samplers: [(any MTLSamplerState)?], range: Range<Int>)
```

## Parameters

- `samplers`: An array of samplers the method encodes.
- `range`: A range of indices within the argument buffer for each element in samplers. The values correspond to either the index IDs of declarations in Metal Shading Language (MSL) or the doc://com.apple.metal/documentation/Metal/MTLArgumentDescriptor/index property of doc://com.apple.metal/documentation/Metal/MTLArgumentDescriptor instances.

## See Also

### Encoding samplers

- [setSamplerState(_:index:)](metal/mtlargumentencoder/setsamplerstate(_:index:).md)
