---
title: "resourceStateCommandEncoder(with:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlcommandbuffer/resourcestatecommandencoder(with:)"
---

# resourceStateCommandEncoder(with:)

Creates a resource state command encoder from a descriptor.

## Declaration

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

## Parameters

- `resourceStatePassDescriptor`: An doc://com.apple.metal/documentation/Metal/MTLResourceStatePassDescriptor instance that configures the doc://com.apple.metal/documentation/Metal/MTLResourceStateCommandEncoder the method returns.

## Discussion

Discussion Use an MTLResourceStateCommandEncoder instance’s methods to create a pass that updates the state of one or more sparse textures.

## See Also

### Creating resource state encoders

- [makeResourceStateCommandEncoder()](metal/mtlcommandbuffer/makeresourcestatecommandencoder().md)
