From b712bda8a3a8d56158e475f63c5ca41d81fae0d9 Mon Sep 17 00:00:00 2001 From: Caleb Cornett Date: Wed, 7 Feb 2024 09:09:01 -0600 Subject: [PATCH] Set up the DXGI Info Queue so we can filter messages without using DirectX Control Panel --- src/Refresh_Driver_D3D11.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/Refresh_Driver_D3D11.c b/src/Refresh_Driver_D3D11.c index 602ce10..bfc4ece 100644 --- a/src/Refresh_Driver_D3D11.c +++ b/src/Refresh_Driver_D3D11.c @@ -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);