D3D12: Prevent crash due to missing debug layer

Destroying the adapter without the debug layer installed
would crash the process upon access of the debug filters.

Bug: dawn:460
Change-Id: I04819c5136af780fd3b981857bd87d69d4abc9c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45560
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Bryan Bernhart 2021-03-22 18:35:16 +00:00 committed by Commit Bot service account
parent 3e4b57b77e
commit a9b211d202
1 changed files with 6 additions and 1 deletions

View File

@ -191,8 +191,13 @@ namespace dawn_native { namespace d3d12 {
if (!GetInstance()->IsBackendValidationEnabled()) {
return;
}
// If the debug layer is not installed, return immediately to avoid crashing the process.
ComPtr<ID3D12InfoQueue> infoQueue;
ASSERT_SUCCESS(mD3d12Device.As(&infoQueue));
if (FAILED(mD3d12Device.As(&infoQueue))) {
return;
}
infoQueue->PopRetrievalFilter();
infoQueue->PopStorageFilter();
}