<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4ComputeCommandEncoder/stages()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTL4ComputeCommandEncoder(im)stages"
  },
  "title" : "stages()"
}
-->

# stages()

Queries a bitmask representing the shader stages on which commands currently present in this command encoder
operate.

```
func stages() -> MTLStages
```

## Return Value

a bitmask representing shader stages that commands currently present in this command encoder operate on.

## Discussion

Metal dynamically updates this property based on the commands you encode into the command encoder, for example,
it sets the bit [`dispatch`](/documentation/Metal/MTLStages/dispatch) if this encoder contains any commands that dispatch a compute kernel.

Similarly, it sets the bit [`blit`](/documentation/Metal/MTLStages/blit) if this encoder contains any commands to copy or modify buffers,
textures, or indirect command buffers.

Finally, Metal sets the bit [`accelerationStructure`](/documentation/Metal/MTLStages/accelerationStructure) if this encoder contains any commands that
build, copy, or refit acceleration structures.

---

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)