Set up the DXGI Info Queue so we can filter messages without using DirectX Control Panel

d3d11
Caleb Cornett 2024-02-07 09:09:01 -06:00 committed by cosmonaut
parent 5f3dd6ba8a
commit b712bda8a3
1 changed files with 27 additions and 2 deletions

View File

@ -622,7 +622,11 @@ static void D3D11_DestroyDevice(
/* Report leaks and clean up debug objects */
if (renderer->dxgiDebug)
{
IDXGIDebug_ReportLiveObjects(renderer->dxgiDebug, D3D_IID_DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL);
IDXGIDebug_ReportLiveObjects(
renderer->dxgiDebug,
D3D_IID_DXGI_DEBUG_ALL,
DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_DETAIL
);
IDXGIDebug_Release(renderer->dxgiDebug);
}
@ -3114,7 +3118,6 @@ static void D3D11_INTERNAL_TryInitializeDXGIDebug(D3D11Renderer *renderer)
Refresh_LogWarn("Could not get IDXGIDebug interface");
}
/* FIXME: Actually do something with the info queue! */
res = DXGIGetDebugInterfaceFunc(&D3D_IID_IDXGIInfoQueue, &renderer->dxgiInfoQueue);
if (FAILED(res))
{
@ -3277,6 +3280,28 @@ tryCreateDevice:
);
ERROR_CHECK_RETURN("Could not get ID3D11Device1 interface", NULL);
/* Set up the info queue */
if (renderer->dxgiInfoQueue)
{
DXGI_INFO_QUEUE_MESSAGE_SEVERITY sevList[] =
{
DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION,
DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR,
DXGI_INFO_QUEUE_MESSAGE_SEVERITY_WARNING,
// DXGI_INFO_QUEUE_MESSAGE_SEVERITY_INFO, /* This can be a bit much, so toggle as needed for debugging. */
DXGI_INFO_QUEUE_MESSAGE_SEVERITY_MESSAGE
};
DXGI_INFO_QUEUE_FILTER filter = { 0 };
filter.AllowList.NumSeverities = SDL_arraysize(sevList);
filter.AllowList.pSeverityList = sevList;
IDXGIInfoQueue_PushStorageFilter(
renderer->dxgiInfoQueue,
D3D_IID_DXGI_DEBUG_ALL,
&filter
);
}
/* Print driver info */
Refresh_LogInfo("Refresh Driver: D3D11");
Refresh_LogInfo("D3D11 Adapter: %S", adapterDesc.Description);