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

# setFragmentBuffer(_:offset:at:)

Sets a fragment buffer argument for the command.

## Declaration

```swift
func setFragmentBuffer(_ 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 fragment 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 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)
- [setVertexBuffer(_:offset:at:)](metal/mtlindirectrendercommand/setvertexbuffer(_:offset:at:).md)
