<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLParallelRenderCommandEncoder/setColorStoreAction(_:index:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLParallelRenderCommandEncoder(im)setColorStoreAction:atIndex:"
  },
  "title" : "setColorStoreAction(_:index:)"
}
-->

# setColorStoreAction(_:index:)

Specifies a known store action to replace the initial [`MTLStoreAction.unknown`](/documentation/Metal/MTLStoreAction/unknown) value specified for a given color attachment.

```
func setColorStoreAction(_ storeAction: MTLStoreAction, index colorAttachmentIndex: Int)
```

## Parameters

`storeAction`

The desired store action for the color attachment. This value can’t be [`MTLStoreAction.unknown`](/documentation/Metal/MTLStoreAction/unknown).

`colorAttachmentIndex`

The index of the color attachment.

## Discussion

If the store action for the given color attachment was set to [`MTLStoreAction.unknown`](/documentation/Metal/MTLStoreAction/unknown) when the parallel render command encoder was created, you need to call this method to specify another store action before you call the [`endEncoding()`](/documentation/Metal/MTLCommandEncoder/endEncoding()) method.

---

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)