Enumeration Case

MTLStorageMode.shared

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

Declaration

case shared = 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 MTLCommandBufferStatus.completed).

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

See Also

Storage Mode Options

case managed

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

case `private`

The resource can be accessed only by the GPU.

case memoryless

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software