<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCommandBuffer/resourceStateCommandEncoder(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLCommandBuffer(im)resourceStateCommandEncoderWithDescriptor:"
  },
  "title" : "resourceStateCommandEncoder(with:)"
}
-->

# resourceStateCommandEncoder(with:)

Creates a resource state command encoder from a descriptor.

```
func resourceStateCommandEncoder(with resourceStatePassDescriptor: MTLResourceStatePassDescriptor) -> (any MTLResourceStateCommandEncoder)?
```

## Parameters

`resourceStatePassDescriptor`

An [`MTLResourceStatePassDescriptor`](/documentation/Metal/MTLResourceStatePassDescriptor) instance that configures the [`MTLResourceStateCommandEncoder`](/documentation/Metal/MTLResourceStateCommandEncoder) the method returns.

## Discussion

Use an [`MTLResourceStateCommandEncoder`](/documentation/Metal/MTLResourceStateCommandEncoder) instance’s methods to create a pass that updates the state of one or more sparse textures.

---

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)