Protocol

MTLResourceStateCommandEncoder

An encoder that encodes commands that modify resource configurations.

Declaration

@protocol MTLResourceStateCommandEncoder

Overview

Use a resource state command encoder to manage memory mappings for sparse textures.

Your app does not define classes that implement this protocol. To create a MTLResourceStateCommandEncoder object, call the resourceStateCommandEncoder method of the MTLCommandBuffer object into which you want to encode blit commands. Next, call methods on the MTLResourceStateCommandEncoder object to enqueue state updates. Finally, call endEncoding to finish the encoding process.

Topics

Updating Texture Memory Assignments

- updateTextureMapping:mode:region:mipLevel:slice:

Encodes a command to update the texture mappings for a region in a single texture mipmap.

Required.

- updateTextureMappings:mode:regions:mipLevels:slices:numRegions:

Encodes a command to update memory mappings for multiple regions inside a texture.

Required.

MTLSparseTextureMappingMode

Options for sparse texture mapping.

Updating Texture Memory Assignments Indirectly

- updateTextureMapping:mode:indirectBuffer:indirectBufferOffset:

Encodes a command to update a texture's memory mappings, specifying the parameters indirectly.

Required.

MTLMapIndirectArguments

The data layout for mapping sparse texture regions when using indirect commands.

Performing Fence Operations

- updateFence:

Updates the given fence to capture all GPU work that the command encoder has enqueued up to this point.

Required.

- waitForFence:

Prevents the command encoder from enqueuing further GPU commands until the given fence is reached.

Required.

Relationships

Inherits From

See Also

Resources

Setting Resource Storage Modes

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

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.

MTLResource

An allocation of memory that is accessible to a GPU.

MTLBlitCommandEncoder

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

Buffers

Create and manipulate unstructured GPU resources.

Textures

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.

Heaps

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

Synchronization

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