makeBuffer(bytesNoCopy:length:options:deallocator:)
Creates a buffer that wraps an existing contiguous memory allocation.
Declaration
func makeBuffer(bytesNoCopy pointer: UnsafeMutableRawPointer, length: Int, options: MTLResourceOptions = [], deallocator: (@Sendable (UnsafeMutableRawPointer, Int) -> Void)? = nil) -> (any MTLBuffer)?Parameters
- pointer:
A page-aligned pointer to the starting memory address.
- length:
The size of the new buffer, in bytes, that results in a page-aligned region of memory.
- 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.
- deallocator:
A block the framework invokes when it deallocates the buffer so that your app can release the underlying memory; otherwise
nilto opt out.
Return Value
A new MTLBuffer instance if the method completes successfully; otherwise nil.