<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLComputeCommandEncoder/setSamplerStates:lodMinClamps:lodMaxClamps:withRange:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLComputeCommandEncoder(im)setSamplerStates:lodMinClamps:lodMaxClamps:withRange:"
  },
  "title" : "setSamplerStates:lodMinClamps:lodMaxClamps:withRange:"
}
-->

# setSamplerStates:lodMinClamps:lodMaxClamps:withRange:

Encodes multiple texture samplers with custom levels of detail clamping, allowing compute kernels to use them for sampling textures on the GPU.

```
- (void) setSamplerStates:(id<MTLSamplerState> const[]) samplers lodMinClamps:(const float[]) lodMinClamps lodMaxClamps:(const float[]) lodMaxClamps withRange:(NSRange) range;
```

## Parameters

`samplers`

An array 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 the `samplers` array.

`lodMaxClamps`

An array of maximum levels of detail to use for the corresponding sampler in the `samplers` array.

`range`

The sampler table indicies to bind each of the `samplers` to, in the order they appear.

## 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)