Configures the driver’s GPU hang analysis system to call back into title-specified callbacks when there is a GPU hang.
public:
void SetHangCallbacks(
D3D11XHANGBEGINCALLBACK pBeginCallback,
D3D11XHANGPRINTCALLBACK pPrintCallback,
D3D11XHANGDUMPCALLBACK pDumpCallback
)
pBeginCallback
Type: D3D11XHANGBEGINCALLBACK
[in] The callback to call shortly after a GPU hang is detected. If no Begin callback is specified, a detailed GPU hang will always be generated. D3D11XHANGBEGINCALLBACK is the GPU hang dump callback, declared as follows:
typedef UINT (*D3D11XHANGBEGINCALLBACK) ( UINT64 Flags );
The UINT value returned by the callback determines whether a detailed GPU hang entry is generated to disk. Return 0 for no detailed GPU hang, or 1 to generate a detailed GPU hang.
Flags contains flags that the callback can provide to indicate information about the hang, such as D3D11X_HANG_FENCE_DEADLOCK. The driver will pass a bitwise-OR’d combination of D3D11X_HANG_FLAGS enumeration constants to this callback, indicating the causes of the GPU hang, if the driver was able to positively identify the causes of the hang.
pPrintCallback
Type: D3D11XHANGPRINTCALLBACK
[in] The callback function to call whenever the GPU hang analysis system generates output text. The callback might not be called once per line of text; the callback might be called more or less frequently, because the text may contain newlines. D3D11XHANGPRINTCALLBACK is declared as follows:
typedef void (*D3D11XHANGPRINTCALLBACK) ( const CHAR* strLine );
strLine is the output text from the GPU hang analysis system.
pDumpCallback
Type: D3D11XHANGDUMPCALLBACK
[in] The callback to produce the hang dump. The system will call this callback when the system is finished providing detailed GPU hang information. D3D11XHANGDUMPCALLBACK is declared as follows:
typedef void (*D3D11XHANGDUMPCALLBACK) ( const WCHAR* strFileName );
strFileName is the filename on the development kit where the GPU hang file (XHIT file) can be found. Using your own infrastructure, this file can be copied to a development PC and analyzed further using the XHIT offline GPU hang analysis tool.
This method provides detailed debugging information for GPU hangs. The information is spewed directly to the debugger, provided to the title through optional callbacks passed into this method, and saved to a file that can be analyzed offline using the Xbox Hang Investigation Tool (XHIT).
The information provided includes what blocks are hung, likely causes, and information on the current wave-fronts. The information also includes the PIXBeginEvent/PIXEndEvent hierarchy at the point of the hang, which is useful for understanding and isolating the location and context of where the hang occurred in the frame.
You can use the XHIT file to do postmortem debugging of GPU hangs during development or in automated telemetry collection from end-users. If it’s not possible to discern the cause of the hang using the XHIT tool, the file can be sent to Microsoft for further analysis.
Header: Declared in d3d11_x.h.
Library: Use d3d11_x.lib.