Creates a buffer by wrapping an existing contiguous memory allocation.
- iOS 8.0+
- macOS 10.11+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
The memory address from which the data starts. The memory allocation in the
pointerargument must already be page-aligned.
The number of bytes of the existing memory allocation to cover. This value must result in a page-aligned region of memory.
Specifies the behavior of the new buffer.
A block of code invoked when this buffer is deallocated. Pass
nilif you do not need to perform an action.
MTLBuffer object that references an existing contiguous memory allocation.
The storage allocation of the returned new
MTLBuffer object is the same as the
pointer input value. The existing memory allocation must be covered by a single VM region, typically allocated with
mmap. Memory allocated by
malloc is specifically disallowed.
deallocator block can be used to free the wrapped memory allocation in any desired fashion.
Page size can vary for different hardware and should not be assumed to always be 4 kilobytes. For more information on querying a system’s page size, see getpagesize(3) macOS Developer Tools Manual Page.
MTLBuffer objects created with this method are CPU-accessible and can be specified with a
MTLResource storage mode, but not a
MTLResource storage mode.