Sample Code

Capturing Metal Commands Programmatically

Invoke Metal’s frame capture from your app, then save the resulting GPU trace to a file or view it in Xcode.

Download

Overview

Configure the Sample Code Project

To run the app:

  • Build the project with Xcode 11 or later.

See Also

Capturing a Frame Programmatically

Capturing GPU Command Data Programmatically

Invoke Metal’s frame capture from your app under the specific runtime conditions you choose.

Creating a Custom Capture Scope

Use custom capture scopes to control which commands get captured.

MTLCaptureManager

An object you use to capture Metal command data in your app.

MTLCaptureScope

An object that defines custom boundaries for a GPU frame capture.

MTLCaptureDescriptor

A configuration for a Metal capture session.

MTLCaptureDestination

The kinds of destinations for captured command data.

MTLCaptureErrorDomain

The error domain for capture errors.

MTLCaptureError

Errors returned by capture sessions.