---
title: "setSamplerState(_:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4argumenttable/setsamplerstate(_:index:)"
---

# setSamplerState(_:index:)

Binds a sampler state to a sampler state binding slot.

## Declaration

```swift
func setSamplerState(_ resourceID: MTLResourceID, index bindingIndex: Int)
```

## Parameters

- `resourceID`: The doc://com.apple.metal/documentation/Metal/MTLResourceID of the doc://com.apple.metal/documentation/Metal/MTLSamplerState instance to bind.
- `bindingIndex`: A valid binding index in the sampler binding range. It is an error for this value to match or exceed the value of property doc://com.apple.metal/documentation/Metal/MTL4ArgumentTableDescriptor/maxSamplerStateBindCount on the descriptor from which you created this argument table.

## Mentioned in

Understanding the Metal 4 core API
