Naively copy pasting from https://devblogs.microsoft.com/directx/dred/
winrt::com_ptr<ID3D12DeviceRemovedExtendedDataSettings> pDredSettings;
winrt::check_hresult(D3D12GetDebugInterface(IID_PPV_ARGS(&pDredSettings)));
pDredSettings->SetAutoBreadcrumbsEnablement(D3D12_DRED_ENABLEMENT_FORCED_ON);
pDredSettings->SetPageFaultEnablement(D3D12_DRED_ENABLEMENT_FORCED_ON);
winrt::com_ptr<ID3D12DeviceRemovedExtendedData> pDred;
winrt::check_hresult(device->QueryInterface(IID_PPV_ARGS(&pDred)));
D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT DredAutoBreadcrumbsOutput;
D3D12_DRED_PAGE_FAULT_OUTPUT DredPageFaultOutput;
winrt::check_hresult(pDred->GetAutoBreadcrumbsOutput(&DredAutoBreadcrumbsOutput)); // error
// 0x887A0004 : 'The specified device interface or feature level is not supported on this system.'.
Any ideas?
Sigh. Once again I debugged what was causing a non-zero hresult
when it was explained in the docs.
I didn't read the fine print
DRED settings must be configure prior to creating a D3D12 Device. Use D3D12GetDebugInterface to get an interface to the ID3D12DeviceRemovedExtendedDataSettings object.
Also GetAutoBreadcrumbsOutput()
will error with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
unless ID3D12::GetDeviceRemovedReason()
is returning DXGI_ERROR_DEVICE_HUNG
so I recommend adding the following line before calling:
_ASSERTE(device->GetDeviceRemovedReason() == DXGI_ERROR_DEVICE_HUNG);