Enumeration Case

MTLStorageModeShared

The resource is stored in system memory and is accessible to both the CPU and the GPU.

Declaration

MTLStorageModeShared = 0

Discussion

This is the default storage mode for MTLBuffer objects. In iOS and tvOS, this is also the default storage mode for MTLTexture objects. In macOS, the shared storage mode is not available for MTLTexture objects.

When either the CPU or GPU changes the contents of the resource, you are responsible for synchronizing access to the texture from the other participant.

If you use the CPU to change the contents of the resource, you must complete those changes before you commit a command buffer that accesses that resource.

If you use encode commands in a command buffer that change the contents of the resource, your code running on the CPU must not read the contents of the resource until the command buffer completes execution (that is, the status property of the MTLCommandBuffer object is MTLCommandBufferStatusCompleted).

For more guidance on how to choose storage modes, see Setting Resource Storage Modes.

See Also

Storage Mode Options

MTLStorageModeManaged

The CPU and GPU may maintain separate copies of the resource, and any changes must be explicitly synchronized.

MTLStorageModePrivate

The resource can be accessed only by the GPU.

MTLStorageModeMemoryless

The resource’s contents can be accessed only by the GPU and only exist temporarily during a render pass.