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.
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.
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.
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.
[Image]
You can begin profiling with the Game Performance template (see Analyzing the performance of your Metal app) or the Game Memory template (see 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.
[Image]
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.
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.
Learn more about Metal debugger.
Topics
Project preparation for debugging
Building your project with embedded shader sourcesNaming resources and commandsCreating and using custom capture scopes
Runtime diagnostics
Inspecting live resources at runtimeValidating your app’s Metal API usageValidating your app’s Metal shader usageMonitoring your Metal app’s graphics performanceCustomizing the Metal Performance HUDUnderstanding the Metal Performance HUD metricsGaining performance insights with the Metal Performance HUDGenerating performance reports with the Metal Performance HUD