<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/buffers",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Buffers"
}
-->

# Buffers

Create and manage untyped data your app uses to exchange information with its shader functions.

## Discussion

Each [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance represents a general purpose,
typeless memory allocation that your app uses to send and retrieve data from a shader.
Your app decides how to use and interpret the buffer’s underlying bytes.

You create buffers from either an [`MTLDevice`](/documentation/Metal/MTLDevice) or [`MTLHeap`](/documentation/Metal/MTLHeap) instance.

```swift
let deviceBuffer = device.makeBuffer(length: bufferSize,
                                     options: .storageModeShared)

let heapBuffer = heap.makeBuffer(length: bufferSize,
                                 options: .storageModePrivate)
```

Buffers inherently support the [`MTLResource`](/documentation/Metal/MTLResource) protocol’s properties and methods,
including [`storageMode`](/documentation/Metal/MTLResource/storageMode),
which controls how the GPU handles its memory (see [Resource fundamentals](/documentation/Metal/resource-fundamentals)).

## Topics

### General purpose buffers

Store arbitrary data in a buffer, such as vertex locations or your own custom data structure.

[`protocol MTLBuffer`](/documentation/Metal/MTLBuffer)

A resource that stores data in a format defined by your app.

### Argument buffers

Group resources together into an argument buffer.

[Improving CPU performance by using argument buffers](/documentation/Metal/improving-cpu-performance-by-using-argument-buffers)

Optimize your app’s performance by grouping your resources into argument buffers.

[Managing groups of resources with argument buffers](/documentation/Metal/managing-groups-of-resources-with-argument-buffers)

Create argument buffers to organize related resources.

[Tracking the resource residency of argument buffers](/documentation/Metal/tracking-the-resource-residency-of-argument-buffers)

Optimize resource performance within an argument buffer.

[Indexing argument buffers](/documentation/Metal/indexing-argument-buffers)

Assign resource indices within an argument buffer.

[Rendering terrain dynamically with argument buffers](/documentation/Metal/rendering-terrain-dynamically-with-argument-buffers)

Use argument buffers to render terrain in real time with a GPU-driven pipeline.

[Encoding argument buffers on the GPU](/documentation/Metal/encoding-argument-buffers-on-the-gpu)

Use a compute pass to encode an argument buffer and access its arguments in a subsequent render pass.

[Using argument buffers with resource heaps](/documentation/Metal/using-argument-buffers-with-resource-heaps)

Reduce CPU overhead by using arrays inside argument buffers and combining them with resource heaps.

[`class MTLArgumentDescriptor`](/documentation/Metal/MTLArgumentDescriptor)

A representation of an argument within an argument buffer.

[`protocol MTLArgumentEncoder`](/documentation/Metal/MTLArgumentEncoder)

An interface you can use to encode argument data into an argument buffer.

[`var MTLAttributeStrideStatic: Int`](/documentation/Metal/MTLAttributeStrideStatic)

### Model I/O interoperability

Load complex 3D meshes and textures from Model I/O assets, and prepare to draw them in your Metal render pipelines.

  <doc://com.apple.documentation/documentation/MetalKit/MTKMesh>

  <doc://com.apple.documentation/documentation/MetalKit/MTKMeshBuffer>

  <doc://com.apple.documentation/documentation/MetalKit/MTKMeshBufferAllocator>

  <doc://com.apple.documentation/documentation/MetalKit/MTKSubmesh>

  <doc://com.apple.documentation/documentation/MetalKit/MTKModelError>

  <doc://com.apple.documentation/documentation/MetalKit/MTKMetalVertexFormatFromModelIO(_:)>

  <doc://com.apple.documentation/documentation/MetalKit/MTKModelIOVertexFormatFromMetal(_:)>

  <doc://com.apple.documentation/documentation/MetalKit/MTKMetalVertexDescriptorFromModelIO(_:)>

  <doc://com.apple.documentation/documentation/MetalKit/MTKMetalVertexDescriptorFromModelIOWithError>

  <doc://com.apple.documentation/documentation/MetalKit/MTKModelIOVertexDescriptorFromMetal(_:)>

  <doc://com.apple.documentation/documentation/MetalKit/MTKModelIOVertexDescriptorFromMetalWithError>



---

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)