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 <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
Peng Huang 2023-04-06 17:12:04 +00:00 committed by Dawn LUCI CQ
parent b7a3cbe8ca
commit ac77863352
1 changed files with 22 additions and 0 deletions

View File

@ -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: