<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSImage/setPurgeableState(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSImage(im)setPurgeableState:"
  },
  "title" : "setPurgeableState(_:)"
}
-->

# setPurgeableState(_:)

Set (or query) the purgeable state of the image’s underlying texture.

```
func setPurgeableState(_ state: MPSPurgeableState) -> MPSPurgeableState
```

## Parameters

`state`

The desired purgeable state of the image’s underlying texture.

## Return Value

Returns the prior purgeable state of the image’s underlying texture.

## Discussion

This method behaves the same as the <doc://com.apple.documentation/documentation/Metal/MTLResource/setPurgeableState(_:)> method of the <doc://com.apple.documentation/documentation/Metal/MTLResource> class, except that the state might be [`MPSPurgeableState.allocationDeferred`](/documentation/MetalPerformanceShaders/MPSPurgeableState/allocationDeferred), which means there is no underlying texture to mark as volatile or non-volatile. Attempts to set a purgeable state on <doc://com.apple.documentation/documentation/Metal/MTLTexture> objects that have not yet been allocated will be ignored.

---

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)