Frame Capture Debugging Tools

Analyze and optimize your app performance at runtime.

Overview

Xcode provides a suite of tools that enable you to halt the execution of your Metal app and inspect its commands and data buffers. You take a snapshot of your app's Metal commands and data using a mechanism called GPU frame capture, then use the debugging and performance tools to operate on the data you collect.

When you're ready to capture a frame, click the camera button in Xcode's debug bar. Alternatively, you can invoke a frame capture using a breakpoint, or programmatically with the capture API during the runtime conditions you choose.

Topics

Essentials

Metal Frame Capture

Snapshot your app's Metal commands for analysis with the Metal frame debugger.

Developing Your Shaders

Developing and Debugging Metal Shaders

Step through your app's shaders to inspect their variables during execution, and use a live preview to enhance development.

Debugging Your App

Viewing Your Frame Graph

View your render passes as a flow chart to inspect resource dependencies and understand which commands wait on others to complete.

Viewing Your Meshes with the Geometry Viewer

Find problems in your app's vertex function by pausing your app at any time, and viewing the current geometry from an angle you choose.

Optimizing Your App

Optimizing Performance with GPU Counters

Examine granular metrics for your rendering or compute calls, and tune your app as needed.

Optimizing Performance with the Shader Profiler

Discover which lines of shader code take the longest to complete, identify their primary GPU activities, and tune your shaders accordingly.

Optimizing Performance with Pipeline Statistics

Decide how to tune your encoder performance by identifying your app's longest-running encoders and their primary GPU activity.

See Also

Tools

Developing Metal Apps that Run in Simulator

Prototype and test your Metal apps in Simulator.

Supporting Simulator in a Metal App

Modify Metal Apps to Run in Simulator.

Using Metal System Trace in Instruments to Profile Your App

Smooth out your frame rate by checking for issues in your app's CPU and GPU utilization.

Reducing the Memory Footprint of Metal Apps

Learn best practices for using memory efficiently in iOS and tvOS.