Capturing Metal commands programmatically
Invoke a Metal frame capture from your app, then save the resulting GPU trace to a file or view it in Xcode.
Overview
Configure the sample code project
To run the app:
Build the project with Xcode 11 or later.