<!--
{
  "documentType" : "article",
  "framework" : "Xcode",
  "identifier" : "/documentation/Xcode/Metal-developer-workflows",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Metal developer workflows"
}
-->

# Metal developer workflows

Locate and fix issues related to your app’s use of the Metal API and GPU functions.

## Overview

Metal comes with a comprehensive suite of advanced developer tools to help you debug and optimize your Metal apps.

### Runtime diagnostics

You can enable API Validation when running your app to check for incorrect Metal API usage.
For more information, see [Validating your app’s Metal API usage](/documentation/Xcode/Validating-your-apps-Metal-API-usage).

Enable Shader Validation when running your app to check for issues like out-of-bounds memory access, missing `useResource` calls, and stack overflows.
For more information, see [Validating your app’s Metal shader usage](/documentation/Xcode/Validating-your-apps-Metal-shader-usage).

The Metal Performance HUD offers a visual overlay to catch performance issues while your app is running.
For more information, see [Monitoring your Metal app’s graphics performance](/documentation/Xcode/Monitoring-your-Metal-apps-graphics-performance).

### Runtime performance analysis

The Metal system trace tool in Instruments provides a visual timeline of the parallel work on the CPU and the GPU, and the memory usage of your Metal app.

![An Instruments screenshot displaying a capture in the Game Performance template.](images/com.apple.Xcode/gputools-instruments-game-performance-hero.png)

You can begin profiling with the Game Performance template (see [Analyzing the performance of your Metal app](/documentation/Xcode/Analyzing-the-performance-of-your-Metal-app)) or the Game Memory template (see [Analyzing the memory usage of your Metal app](/documentation/Xcode/Analyzing-the-memory-usage-of-your-Metal-app)).

### Advanced Metal debugging and profiling

The Metal debugger in Xcode provides advanced tools for debugging and profiling your Metal app.

![A screenshot of the Metal debugger showing the Bound Resources viewer and attachments for a draw command.](images/com.apple.Xcode/gputools-metal-debugger-hero.png)

You can get summaries of your Metal workload with the Dependencies viewer and the Memory viewer, inspect individual resources, and selectively debug your shaders.
For more information on debugging, see [Investigating visual artifacts](/documentation/Xcode/Investigating-visual-artifacts).

In addition, you can optimize your Metal app by drilling down performance bottlenecks with the Performance timeline and the per-line shader profiling results.
For more information on profiling, see [Optimizing GPU performance](/documentation/Xcode/Optimizing-GPU-performance).

Learn more about [Metal debugger](/documentation/Xcode/Metal-debugger).

## Topics

### Project preparation for debugging

Make your Metal app easier to debug by taking a few extra steps as you develop your code.

[Building your project with embedded shader sources](/documentation/Xcode/Building-your-project-with-embedded-shader-sources)

Prepare to debug your project’s shaders by including source code in the build.

[Naming resources and commands](/documentation/Xcode/Naming-resources-and-commands)

Enhance the debugging of your Metal app using labels and grouping.

[Creating and using custom capture scopes](/documentation/Xcode/Creating-and-using-custom-capture-scopes)

Capture specific GPU commands by using custom capture scopes.

### Runtime diagnostics

Learn how to use runtime tools to discover potential issues in your Metal app.

[Inspecting live resources at runtime](/documentation/Xcode/Inspecting-live-resources-at-runtime)

Validate your resources by viewing the contents of your textures and buffers while debugging your Metal app.

[Validating your app’s Metal API usage](/documentation/Xcode/Validating-your-apps-Metal-API-usage)

Catch runtime issues in your Metal app using API Validation.

[Validating your app’s Metal shader usage](/documentation/Xcode/Validating-your-apps-Metal-shader-usage)

Catch common shader runtime issues using Shader Validation.

[Monitoring your Metal app’s graphics performance](/documentation/Xcode/Monitoring-your-Metal-apps-graphics-performance)

Catch performance issues using the Metal Performance HUD while your app runs.

[Customizing the Metal Performance HUD](/documentation/Xcode/Customizing-metal-performance-hud)

Modify the appearance of your Metal heads-up display to monitor your graphics performance.

[Understanding the Metal Performance HUD metrics](/documentation/Xcode/Understanding-metal-performance-hud-metrics)

Learn what each of the metrics reported by the heads-up display indicates.

[Gaining performance insights with the Metal Performance HUD](/documentation/Xcode/Gaining-performance-insights-with-metal-performance-hud)

Catch potential performance issues while your app runs using the Metal heads-up display.

[Generating performance reports with the Metal Performance HUD](/documentation/Xcode/Generating-performance-reports-with-metal-performance-hud)

Record your app’s performance using the heads-up display.

### Counters

Get references for the set of performance metrics available across Metal tools.

[Finding your Metal app’s GPU occupancy](/documentation/Xcode/Finding-your-Metal-apps-GPU-occupancy)

Understand the GPU usage for executing shaders by using occupancy.

[Reducing shader bottlenecks](/documentation/Xcode/Reducing-shader-bottlenecks)

Identify and minimize congestion points in a GPU’s subsystems by checking its limiter and utilization counters.

[Measuring the GPU’s use of memory bandwidth](/documentation/Xcode/Measuring-the-GPUs-use-of-memory-bandwidth)

Check whether your Metal app correctly reads and writes to memory by measuring the GPU’s memory bandwidth.



---

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)