---
title: "setResource(_:bufferIndex:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4argumenttable/setresource(_:bufferindex:)"
---

# setResource(_:bufferIndex:)

Binds a resource to a buffer binding slot.

## Declaration

```swift
func setResource(_ resourceID: MTLResourceID, bufferIndex bindingIndex: Int)
```

## Parameters

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

## Mentioned in

Understanding the Metal 4 core API
