<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/setting-resource-storage-modes",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Setting resource storage modes"
}
-->

# Setting resource storage modes

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

## Discussion

Storage modes are only set when creating an instance, and the system default allows for access to memory from both the CPU and GPU. Metal selects the default mode for resources depending on hardware.

- For Apple silicon GPUs the default is [`MTLStorageMode.shared`](/documentation/Metal/MTLStorageMode/shared).
- For Intel-based Mac computers, the default is [`MTLStorageMode.managed`](/documentation/Metal/MTLStorageMode/managed) for all [`MTLTexture`](/documentation/Metal/MTLTexture) instances and [`MTLBuffer`](/documentation/Metal/MTLBuffer) instances attached to discrete GPUs. [`MTLBuffer`](/documentation/Metal/MTLBuffer) instances using the integrated GPU have [`MTLStorageMode.shared`](/documentation/Metal/MTLStorageMode/shared) as their default.

> Important:
> Use the system default if your data is available to both the CPU and GPU. When you manually select shared or managed mode, your app may not run on some hardware.

You perform the same synchronization tasks to ensure GPU and CPU memory coherency in both default modes. To check for GPU architecture and capabilities, use the [`supportsFamily(_:)`](/documentation/Metal/MTLDevice/supportsFamily(_:)) method instead of the [`storageMode`](/documentation/Metal/MTLResource/storageMode) property. See [Detecting GPU features and Metal software versions](/documentation/Metal/detecting-gpu-features-and-metal-software-versions) for more information.

Use [`MTLStorageMode.memoryless`](/documentation/Metal/MTLStorageMode/memoryless), only available on Apple silicon, when you manage your own storage, or want to run a GPU task that requires temporary resources. For tasks that share memory on the GPU, use [`MTLStorageMode.private`](/documentation/Metal/MTLStorageMode/private) storage. This article includes examples of how to set the storage mode for a buffer or texture.

For more guidance on which mode to choose, see [Choosing a resource storage mode for Apple GPUs](/documentation/Metal/choosing-a-resource-storage-mode-for-apple-gpus) and [Choosing a resource storage mode for Intel and AMD GPUs](/documentation/Metal/choosing-a-resource-storage-mode-for-intel-and-amd-gpus).

### Set a storage mode for a buffer

Create a new [`MTLBuffer`](/documentation/Metal/MTLBuffer) with the [`makeBuffer(length:options:)`](/documentation/Metal/MTLDevice/makeBuffer(length:options:)) method and set its storage mode in the method’s `options` parameter.

```swift
let bufferOptions = MTLResourceOptions.storageModePrivate
let buffer = device.makeBuffer(length: 256,
                               options: bufferOptions)
```

> Note:
> The storage mode options in ``doc://com.apple.metal/documentation/Metal/MTLResourceOptions`` are equivalent to the storage mode values in ``doc://com.apple.metal/documentation/Metal/MTLStorageMode``. When you create a new buffer, you can combine multiple resource options but you can set only one storage mode.

### Set a storage mode for a texture

Create a new [`MTLTextureDescriptor`](/documentation/Metal/MTLTextureDescriptor) and set its storage mode in the descriptor’s [`storageMode`](/documentation/Metal/MTLResource/storageMode) property. Then create a new [`MTLTexture`](/documentation/Metal/MTLTexture) with the [`makeTexture(descriptor:)`](/documentation/Metal/MTLDevice/makeTexture(descriptor:)) method.

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)