<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: -",
    "macOS: 10.11.0 -",
    "tvOS: 8.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLComputeCommandEncoder/setSamplerStates(_:lodMinClamps:lodMaxClamps:range:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So24MTLComputeCommandEncoderP5MetalE16setSamplerStates_12lodMinClamps0h3MaxJ05rangeySaySo15MTLSamplerState_pSgG_SaySfGAKSnySiGtF"
  },
  "title" : "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.

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

## Parameters

`samplers`

A list of [`MTLSamplerState`](/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> 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`](/documentation/Metal/MTLSamplerDescriptor/lodMinClamp) and [`lodMaxClamp`](/documentation/Metal/MTLSamplerDescriptor/lodMaxClamp) properties of the samplers, using the provided levels of detail instead.

---

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)