Instance Method

newBufferWithLength:options:

Allocates a new zero-filled buffer of a given length.

Required.

Declaration

- (id<MTLBuffer>)newBufferWithLength:(NSUInteger)length options:(MTLResourceOptions)options;

Parameters

length

The size of the new buffer, in bytes.

options

Specifies the behavior of the new buffer.

Return Value

A new MTLBuffer object with a new zero-filled memory allocation.

Discussion

MTLBuffer objects created with this method can be CPU and/or GPU accessible and they can be specified with a MTLResourceStorageModeShared, MTLResourceStorageModeManaged, or MTLResourceStorageModePrivate storage mode.

Topics

Resource Options

MTLResourceOptions

Optional arguments used to set the behavior of a resource.

See Also

Creating Buffers

maxBufferLength

The maximum size of a buffer, in bytes.

Required.

- newBufferWithBytes:length:options:

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

Required.

- newBufferWithBytesNoCopy:length:options:deallocator:

Creates a buffer by wrapping an existing contiguous memory allocation.

Required.