<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderCommandEncoder/setMeshSamplerStates(_:lodMinClamps:lodMaxClamps:range:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So23MTLRenderCommandEncoderP5MetalE20setMeshSamplerStates_12lodMinClamps0i3MaxK05rangeySaySo15MTLSamplerState_pSgG_SaySfGAKSnySiGtF"
  },
  "title" : "setMeshSamplerStates(_:lodMinClamps:lodMaxClamps:range:)"
}
-->

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

Assigns multiple sampler states and clamp values to a range of entries in the mesh shader argument table.

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

## Parameters

`samplers`

An array of [`MTLSamplerState`](/documentation/Metal/MTLSamplerState) instances the command assigns to entries in the mesh shader argument table for sampler states.

`lodMinClamps`

An array of floating-point values. Each element is the smallest level of detail value a mesh shader can use when it samples a texture with the corresponding element in `samplers`.

`lodMaxClamps`

An array of floating-point values. Each element is the largest level of detail value a mesh shader can use when it samples a texture with the corresponding element in `samplers`.

`range`

A span of integers that represent the entries in the mesh shader argument table for sampler states. Each entry stores a record of the corresponding element in `samplers`.

## Discussion

Each element of the method’s `lodMinClamps` and `lodMaxClamps` parameters overrides the default values for the corresponding sampler in `samplers`. You can set a sampler’s default values by configuring the [`lodMinClamp`](/documentation/Metal/MTLSamplerDescriptor/lodMinClamp) and [`lodMaxClamp`](/documentation/Metal/MTLSamplerDescriptor/lodMaxClamp) properties of [`MTLSamplerDescriptor`](/documentation/Metal/MTLSamplerDescriptor) before you create the sampler.

By default, the sampler state at each index is `nil`.

> Note:
> The Objective-C version of this method is ``doc://com.apple.metal/documentation/Metal/MTLRenderCommandEncoder/setMeshSamplerStates:lodMinClamps:lodMaxClamps:withRange:``.

---

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)