---
title: "setSamplerStates(_:lodMinClamps:lodMaxClamps:range:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlcomputecommandencoder/setsamplerstates(_:lodminclamps:lodmaxclamps:range:)"
---

# setSamplerStates(_:lodMinClamps:lodMaxClamps:range:)

Encodes multiple texture samplers for the compute function, specifying clamp values for the level of detail of each sampler.

## Declaration

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

## Parameters

- `samplers`: A list of doc://com.apple.metal/documentation/Metal/MTLSamplerState instances to bind to the sampler argument table.
- `lodMinClamps`: An array of minimum levels of detail to use for the corresponding sampler in samplers.
- `lodMaxClamps`: An array of maximum levels of detail to use for the corresponding sample in samplers.
- `range`: A range of indices in the sampler state argument table.

## Discussion

Discussion important: This method requires that the lengths of samplers, lodMinClamps, and lodMaxClamps be the same as the length of range. Calling this method ignores the lodMinClamp and lodMaxClamp properties of the samplers, using the provided levels of detail instead.

## See Also

### Binding texture samplers

- [setSamplerState(_:index:)](metal/mtlcomputecommandencoder/setsamplerstate(_:index:).md)
- [setSamplerState(_:lodMinClamp:lodMaxClamp:index:)](metal/mtlcomputecommandencoder/setsamplerstate(_:lodminclamp:lodmaxclamp:index:).md)
- [setSamplerStates(_:range:)](metal/mtlcomputecommandencoder/setsamplerstates(_:range:).md)
