---
title: "makeArgumentEncoder(bufferIndex:reflection:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlfunction/makeargumentencoder(bufferindex:reflection:)"
---

# makeArgumentEncoder(bufferIndex:reflection:)

Creates an argument encoder and returns reflection information for an argument buffer that’s one of this function’s arguments

## Declaration

```swift
func makeArgumentEncoder(bufferIndex: Int, reflection: AutoreleasingUnsafeMutablePointer<MTLAutoreleasedArgument?>?) -> any MTLArgumentEncoder
```

## Parameters

- `bufferIndex`: The index of an argument buffer in the function’s argument list. This method fails if the specified index doesn’t correspond to an argument buffer.
- `reflection`: A pointer that Metal populates with the function reflection data in the argument buffer at bufferIndex.

## Discussion

Discussion Resources encoded into an argument buffer by the MTLArgumentEncoder object need to match the structure of the argument buffer located at the function’s specified buffer index.

## See Also

### Creating argument encoders

- [makeArgumentEncoder(bufferIndex:)](metal/mtlfunction/makeargumentencoder(bufferindex:).md)
