Contents

makeBuffer(bytes:length:options:)

Allocates a new buffer of a given length and initializes its contents by copying existing data into it.

Declaration

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

Parameters

  • pointer:

    A pointer to the starting memory address the method copies the initialization data from.

  • length:

    The size of the new buffer, in bytes, and the number of bytes the method copies from pointer.

  • options:

    An Mtlresourceoptions instance that sets the buffer’s storage and hazard-tracking modes. See Resource Fundamentals and Setting Resource Storage Modes for more information.

Mentioned in

Return Value

A new MTLBuffer instance if the method completes successfully; otherwise nil.

See Also

Creating buffers