---
title: "setDepthStoreAction(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setdepthstoreaction(_:)"
---

# setDepthStoreAction(_:)

Configures the store action for the depth attachment.

## Declaration

```swift
func setDepthStoreAction(_ storeAction: MTLStoreAction)
```

## Parameters

- `storeAction`: A store action for the depth attachment that can’t be doc://com.apple.metal/documentation/Metal/MTLStoreAction/unknown.

## Discussion

Discussion This method changes the render command encoder’s store action for the depth attachment. You can assign the default store action for the depth attachment by configuring the storeAction property of its MTLRenderPassDepthAttachmentDescriptor (see MTLRenderPassDescriptor and its depthAttachment property). important: You need to call this method before calling the encoder’s endEncoding() method, but only if the depth attachment’s storeAction property is equal to MTLStoreAction.unknown.

## See Also

### Configuring the actions for attachments

- [setColorStoreAction(_:index:)](metal/mtlrendercommandencoder/setcolorstoreaction(_:index:).md)
- [setColorStoreActionOptions(_:index:)](metal/mtlrendercommandencoder/setcolorstoreactionoptions(_:index:).md)
- [setDepthStoreActionOptions(_:)](metal/mtlrendercommandencoder/setdepthstoreactionoptions(_:).md)
- [setStencilStoreAction(_:)](metal/mtlrendercommandencoder/setstencilstoreaction(_:).md)
- [setStencilStoreActionOptions(_:)](metal/mtlrendercommandencoder/setstencilstoreactionoptions(_:).md)
