Setting Resource Storage Modes

Set a storage mode that defines the memory location and access permissions of a resource.


By choosing an appropriate storage mode, you can configure a buffer or texture to benefit from fast memory access and driver-level performance optimizations. This article describes how to set the storage mode for a buffer or texture. For guidance on which mode to choose, see Choosing a Resource Storage Mode in iOS and tvOS and Choosing a Resource Storage Mode in macOS.

Set a Storage Mode for a Buffer

Create a new MTLBuffer with the makeBuffer(length:options:) method and set its storage mode in the method’s options parameter.

MTLResourceOptions bufferOptions = MTLResourceStorageModePrivate;
id <MTLBuffer> buffer = [_device newBufferWithLength:256

Set a Storage Mode for a Texture

Create a new MTLTextureDescriptor and set its storage mode in the descriptor’s storageMode property. Then create a new MTLTexture with the makeTexture(descriptor:) method.

let textureDescriptor = MTLTextureDescriptor.texture2DDescriptor(pixelFormat: .bgra8Unorm,
                                                                 width: 256,
                                                                 height: 256,
                                                                 mipmapped: true)
textureDescriptor.storageMode = .private
let texture = device.makeTexture(descriptor: textureDescriptor)


Resource Storage Modes by Platform

Choosing a Resource Storage Mode in iOS and tvOS

Choose an appropriate storage mode for your iOS and tvOS resources.

Choosing a Resource Storage Mode in macOS

Choose an appropriate storage mode for your macOS resources.

See Also


Copying Data to a Private Resource

Use a blit command encoder to copy buffer or texture data to a private resource.

Synchronizing a Managed Resource

Synchronize the contents of a managed resource for the CPU or GPU.

Transferring Data Between Connected GPUs

Use high-speed connections between GPUs to transfer data quickly.

Reducing the Memory Footprint of Metal Apps

Learn best practices for using memory efficiently in iOS and tvOS.

protocol MTLResource

An allocation of memory that is accessible to a GPU.

protocol MTLBlitCommandEncoder

An encoder that encodes memory copying, filtering, and fill commands.

protocol MTLResourceStateCommandEncoder

An encoder that encodes commands that modify resource configurations.


Create and manipulate unstructured GPU resources.


Create and manipulate structured GPU resources.

Indirect Command Buffers

Recoup encoding time by reusing commands, or create a GPU-driven rendering pipeline by generating commands on the GPU.


Create a single allocation of memory from which you can suballocate resources.


Manage access to resources in your app to avoid data hazards.