MTLStorageMode.shared
The CPU and GPU share access to the resource, allocated in system memory.
Declaration
case sharedMentioned in
- Choosing a resource storage mode for Apple GPUs
- Optimizing texture data
- Setting resource storage modes
- Adjusting for GPU memory bandwidth tradeoffs
- Choosing a resource storage mode for Intel and AMD GPUs
- Converting a GPU’s counter data into a readable format
- Creating a counter sample buffer to store a GPU’s counter data during a pass
- Improving CPU performance by using argument buffers
- Synchronizing a managed resource in macOS
Discussion
This is the default storage mode for MTLBuffer instances on integrated GPUs and both MTLBuffer and MTLTexture instances on Apple silicon GPUs. On non-Apple family GPUs, the shared storage mode isn’t available for MTLTexture instances.
When either the CPU or GPU changes the contents of the resource, you’re responsible for synchronizing access to the texture from the other participant. Ensure that all changes you schedule on either the CPU or GPU for a resource that uses shared memory complete before accessing that resource on the other processor.
For more guidance on how to choose storage modes, see Setting resource storage modes.