<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLResourceStateCommandEncoder",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLResourceStateCommandEncoder"
  },
  "title" : "MTLResourceStateCommandEncoder"
}
-->

# MTLResourceStateCommandEncoder

An encoder that encodes commands that modify resource configurations.

```
protocol MTLResourceStateCommandEncoder : MTLCommandEncoder
```

## 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 an [`MTLResourceStateCommandEncoder`](/documentation/Metal/MTLResourceStateCommandEncoder) instance, call the [`makeResourceStateCommandEncoder()`](/documentation/Metal/MTLCommandBuffer/makeResourceStateCommandEncoder()) method of the [`MTLCommandBuffer`](/documentation/Metal/MTLCommandBuffer) instance into which you want to encode blit commands. Next, call methods on the [`MTLResourceStateCommandEncoder`](/documentation/Metal/MTLResourceStateCommandEncoder) instance to enqueue state updates. Finally, call [`endEncoding()`](/documentation/Metal/MTLCommandEncoder/endEncoding()) to finish the encoding process.

## Topics

### Updating texture memory assignments

[`updateTextureMapping(_:mode:region:mipLevel:slice:)`](/documentation/Metal/MTLResourceStateCommandEncoder/updateTextureMapping(_:mode:region:mipLevel:slice:))

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

[`updateTextureMappings(_:mode:regions:mipLevels:slices:numRegions:)`](/documentation/Metal/MTLResourceStateCommandEncoder/updateTextureMappings(_:mode:regions:mipLevels:slices:numRegions:))

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

[`MTLSparseTextureMappingMode`](/documentation/Metal/MTLSparseTextureMappingMode)

Options for sparse texture mapping.

### Updating texture memory assignments indirectly

[`updateTextureMapping(_:mode:indirectBuffer:indirectBufferOffset:)`](/documentation/Metal/MTLResourceStateCommandEncoder/updateTextureMapping(_:mode:indirectBuffer:indirectBufferOffset:))

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

### Performing fence operations

[`update(_:)`](/documentation/Metal/MTLResourceStateCommandEncoder/update(_:))

Encodes a command that instructs the GPU to update a fence, which signals passes waiting on the fence.

[`wait(for:)`](/documentation/Metal/MTLResourceStateCommandEncoder/wait(for:))

Encodes a command that instructs the GPU to pause before starting the resource state commands until another pass updates a fence.



---

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)