PIX allows an application to initiate GPU captures programmatically using the IDXGraphicsAnalysis interface.
Note that programmatic timing captures and the PIXBeginCapture/PIXEndCapture APIs, are not currently supported.
Preparing Your App to Use Programmatic Capture
Programmatic capture is controlled through the IDXGraphicsAnalysis interface. This interface can be found in the DXProgrammableCapture.h header, included with the Windows 10 SDK.
#include <DXProgrammableCapture.h>
or:
interface DECLSPEC_UUID("9f251514-9d4d-4902-9d60-18988ab7d4b5") DECLSPEC_NOVTABLE IDXGraphicsAnalysis : public IUnknown { STDMETHOD_(void, BeginCapture)() PURE; STDMETHOD_(void, EndCapture)() PURE; };
IDXGraphicsAnalysis can be retrieved using DXGIGetDebugInterface1. Retrieval of IDXGraphicsAnalysis will only succeed if PIX is attached to the application for GPU capture, otherwise DXGIGetDebugInterface1 will return E_NOINTERFACE.
ComPtr<IDXGraphicsAnalysis> ga; HRESULT hr = DXGIGetDebugInterface1(0, IID_PPV_ARGS(&ga)); // hr will be E_NOINTERFACE if not attached for GPU capture
Using Programmatic Capture
Once an application is setup to use programmatic capture, launch the application for GPU capture from PIX. The application can then call BeginCapture and EndCapture on IDXGraphicsAnalysis to control when a GPU capture is taken.
ga->BeginCapture(); // Perform rendering work // ... ga->EndCapture();