<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDevice/makeBuffer(length:options:placementSparsePageSize:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLDevice(im)newBufferWithLength:options:placementSparsePageSize:"
  },
  "title" : "makeBuffer(length:options:placementSparsePageSize:)"
}
-->

# makeBuffer(length:options:placementSparsePageSize:)

Creates a new placement sparse buffer of a specific length.

```
func makeBuffer(length: Int, options: MTLResourceOptions = [], placementSparsePageSize: MTLSparsePageSize) -> (any MTLBuffer)?
```

## Parameters

`length`

The size of the [`MTLBuffer`](/documentation/Metal/MTLBuffer), in bytes.

`options`

A [`MTLResourceOptions`](/documentation/Metal/MTLResourceOptions) instance that establishes the buffer’s storage modes.

`placementSparsePageSize`

[`MTLSparsePageSize`](/documentation/Metal/MTLSparsePageSize) to use for the placement sparse buffer.

## Return Value

A [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance, or `nil` if the function failed.

## Discussion

This method creates a new placement sparse [`MTLBuffer`](/documentation/Metal/MTLBuffer) of a specific length. You assign memory to
placement sparse buffers using a [`MTLHeap`](/documentation/Metal/MTLHeap) of type [`MTLHeapType.placement`](/documentation/Metal/MTLHeapType/placement).

---

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)