---
title: "setVertexBuffer(_:offset:at:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlindirectrendercommand/setvertexbuffer(_:offset:at:)"
---

# setVertexBuffer(_:offset:at:)

Sets a vertex buffer argument for the command.

## Declaration

```swift
func setVertexBuffer(_ buffer: any MTLBuffer, offset: Int, at index: Int)
```

## Parameters

- `buffer`: The buffer to set in the buffer argument table.
- `offset`: The location, in bytes relative to start of buffer, of the first byte of data for the vertex shader.
- `index`: An index in the buffer argument table. The maximum index is determined when you created the indirect command buffer.

## Discussion

Discussion You don’t need to call this method if you create an indirect command buffer with its inheritBuffers property equal to true. The command gets the arguments from the parent encoder when it runs. If you need to pass other kinds of parameters to your shader, such as textures and samplers, create an argument buffer and pass it to the shader using this method.

## See Also

### Setting command arguments

- [setRenderPipelineState(_:)](metal/mtlindirectrendercommand/setrenderpipelinestate(_:).md)
- [setFragmentBuffer(_:offset:at:)](metal/mtlindirectrendercommand/setfragmentbuffer(_:offset:at:).md)
