---
title: "setMeshBuffer(_:offset:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setmeshbuffer(_:offset:index:)"
---

# setMeshBuffer(_:offset:index:)

Assigns a buffer to an entry in the mesh shader argument table.

## Declaration

```swift
func setMeshBuffer(_ buffer: (any MTLBuffer)?, offset: Int, index: Int)
```

## Parameters

- `buffer`: An doc://com.apple.metal/documentation/Metal/MTLBuffer instance the command assigns to an entry in the mesh shader argument table for buffers.
- `offset`: An integer that represents the location, in bytes, from the start of buffer where the mesh shader argument data begins. See the https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf to check for offset alignment requirements for buffers in device and constant address space.
- `index`: An integer that represents the entry in the mesh shader argument table for buffers that stores a record of buffer and offset.

## Mentioned in

Improving CPU performance by using argument buffers

## Discussion

Discussion By default, the texture at each index is nil.

## See Also

### Assigning buffers for mesh shaders

- [setMeshBuffers(_:offsets:range:)](metal/mtlrendercommandencoder/setmeshbuffers(_:offsets:range:).md)
- [setMeshBytes(_:length:index:)](metal/mtlrendercommandencoder/setmeshbytes(_:length:index:).md)
- [setMeshBufferOffset(_:index:)](metal/mtlrendercommandencoder/setmeshbufferoffset(_:index:).md)
