<!--
{
  "availability" : [
    "iOS: 11.0.0 - 16.0.0",
    "iPadOS: 11.0.0 - 16.0.0",
    "macCatalyst: 13.1.0 - 16.0.0",
    "macOS: 10.13.0 - 13.0.0",
    "tvOS: 11.0.0 - 16.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLFunction/makeArgumentEncoder(bufferIndex:reflection:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLFunction(im)newArgumentEncoderWithBufferIndex:reflection:"
  },
  "title" : "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

```
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

Resources encoded into an argument buffer by the [`MTLArgumentEncoder`](/documentation/Metal/MTLArgumentEncoder) object need to match the structure of the argument buffer located at the function’s specified buffer index.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)