Invoke the Metal frame debugger from your app under the specific runtime conditions you choose.
MTLCapture to programmatically control GPU frame capture.
When you stop the capture, Xcode halts your app and presents its results in the Metal frame debugger. Depending on the runtime conditions you choose to stop the capture, it enables you to capture a specific frame, just a part of a frame, or implement a custom UI that triggers a capture.
Capture a Device or Command Queue
To start capturing commands for a specific
MTLCommand, call the
start method. To stop capturing commands, call the
The capture manager only captures commands within
MTLCommand objects that are created after the capture starts and are committed before the capture stops.
Capture a Custom Scope
To define boundaries for a
MTLCapture, call the
end() methods just before and after the commands that you want to capture. To start capturing commands for a specific capture scope, call the
start method. The capture stops when your app reaches the corresponding
end() method of the given capture scope.
The capture scope only captures commands within
MTLCommand objects that are created after the scope begins and are committed before the scope ends.
Capture Multiple Frames
When you capture a frame programmatically, you can capture Metal commands that span multiple frames by using a custom capture scope. For example, by calling
begin() at the start of frame 1 and
end() after frame 3, the trace will contain command data from all the buffers that were committed in the three frames.