From ac77863352486880a03458fa341f44b7c28d3f2c Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Thu, 6 Apr 2023 17:12:04 +0000 Subject: [PATCH] d3d: supports more errors in HRESULTAsString() Bug: dawn:1705 Change-Id: I811ed5867399fa417a0a542f3d4e706e989f0a23 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126660 Reviewed-by: Austin Eng Kokoro: Kokoro Commit-Queue: Peng Huang --- src/dawn/native/d3d/D3DError.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/dawn/native/d3d/D3DError.cpp b/src/dawn/native/d3d/D3DError.cpp index 9b03cef4e6..b7bd0664f5 100644 --- a/src/dawn/native/d3d/D3DError.cpp +++ b/src/dawn/native/d3d/D3DError.cpp @@ -29,6 +29,7 @@ const char* HRESULTAsString(HRESULT result) { case S_FALSE: return "S_FALSE"; + // Generic errors: case E_FAIL: return "E_FAIL"; case E_INVALIDARG: @@ -38,16 +39,37 @@ const char* HRESULTAsString(HRESULT result) { case E_NOTIMPL: return "E_NOTIMPL"; + // DXGI errors: case DXGI_ERROR_INVALID_CALL: return "DXGI_ERROR_INVALID_CALL"; + case DXGI_ERROR_UNSUPPORTED: + return "DXGI_ERROR_UNSUPPORTED"; + case DXGI_ERROR_DEVICE_REMOVED: + return "DXGI_ERROR_DEVICE_REMOVED"; + case DXGI_ERROR_DEVICE_HUNG: + return "DXGI_ERROR_DEVICE_HUNG"; + case DXGI_ERROR_DEVICE_RESET: + return "DXGI_ERROR_DEVICE_RESET"; case DXGI_ERROR_WAS_STILL_DRAWING: return "DXGI_ERROR_WAS_STILL_DRAWING"; + // D3D11 errors: + case D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: + return "D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS"; + case D3D11_ERROR_FILE_NOT_FOUND: + return "D3D11_ERROR_FILE_NOT_FOUND"; + case D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS: + return "D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS"; + case D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD: + return "D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD"; + + // D3D12 errors: case D3D12_ERROR_ADAPTER_NOT_FOUND: return "D3D12_ERROR_ADAPTER_NOT_FOUND"; case D3D12_ERROR_DRIVER_VERSION_MISMATCH: return "D3D12_ERROR_DRIVER_VERSION_MISMATCH"; + // Fake errors used for testing: case E_FAKE_ERROR_FOR_TESTING: return "E_FAKE_ERROR_FOR_TESTING"; case E_FAKE_OUTOFMEMORY_ERROR_FOR_TESTING: