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

# popDebugGroup()

Marks the end of a debug group and, if applicable, restores the previous group from a stack.

```
func popDebugGroup()
```

## Discussion

Use [`pushDebugGroup(_:)`](/documentation/Metal/MTLCommandBuffer/pushDebugGroup(_:)) to group commands within the command buffer, which adds a new group to a stack, effectively nesting a group within any previous group. Call [`popDebugGroup()`](/documentation/Metal/MTLCommandBuffer/popDebugGroup()) to mark the end of a group of commands within the command buffer, and restore the previous group, if applicable. You can inspect the group and the commands it contains when viewing the contents of a frame capture with Metal Debugger.

Labels can help you profile and debug your app at runtime with Metal Debugger and other tools. See <doc://com.apple.documentation/documentation/Xcode/Naming-resources-and-commands> for more information about using labels and other debugging techniques.

---

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)