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

# setStencilStoreAction(_:)

Configures the store action for the stencil attachment.

## Declaration

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

## Parameters

- `storeAction`: A store action for the stencil 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 stencil attachment. You can assign the default store action for the stencil attachment by configuring the storeAction property of its MTLRenderPassStencilAttachmentDescriptor (see MTLRenderPassDescriptor and its stencilAttachment property). important: You need to call this method before calling the encoder’s endEncoding() method, but only if the stencil 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)
- [setDepthStoreAction(_:)](metal/mtlrendercommandencoder/setdepthstoreaction(_:).md)
- [setDepthStoreActionOptions(_:)](metal/mtlrendercommandencoder/setdepthstoreactionoptions(_:).md)
- [setStencilStoreActionOptions(_:)](metal/mtlrendercommandencoder/setstencilstoreactionoptions(_:).md)
