Contents

makeBuffer(length:options:)

Creates a buffer on the heap.

Declaration

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

Parameters

  • length:

    The size, in bytes, of the buffer.

  • options:

    Options that describe the properties of the buffer.

Return Value

A new buffer object backed by heap memory, or nil if the heap memory is full.

Discussion

You can call the method with the following restrictions:

  • The heap’s type needs to be MTLHeapType.automatic

  • The buffer’s storage mode option needs to match the heap’s storageMode property

  • The buffer’s CPU cache mode option needs to match the heap’s cpuCacheMode property

See Also

Creating buffers from a heap