| 17 | namespace TEN::Renderer::Utils |
| 18 | { |
| 19 | std::string GetHResultDescription(HRESULT hr) |
| 20 | { |
| 21 | switch (hr) |
| 22 | { |
| 23 | case E_OUTOFMEMORY: |
| 24 | return "E_OUTOFMEMORY: Out of memory. The GPU or system does not have enough memory to allocate the resource."; |
| 25 | case E_INVALIDARG: |
| 26 | return "E_INVALIDARG: Invalid argument. One or more parameters passed to the function are invalid."; |
| 27 | case E_FAIL: |
| 28 | return "E_FAIL: Unspecified failure."; |
| 29 | case E_NOINTERFACE: |
| 30 | return "E_NOINTERFACE: The requested COM interface is not supported."; |
| 31 | case DXGI_ERROR_DEVICE_REMOVED: |
| 32 | return "DXGI_ERROR_DEVICE_REMOVED: The GPU device has been removed (driver crash or hardware failure)."; |
| 33 | case DXGI_ERROR_DEVICE_RESET: |
| 34 | return "DXGI_ERROR_DEVICE_RESET: The GPU device has been reset (driver issue)."; |
| 35 | case DXGI_ERROR_DEVICE_HUNG: |
| 36 | return "DXGI_ERROR_DEVICE_HUNG: The GPU device is hung (likely a long-running shader or driver bug)."; |
| 37 | case DXGI_ERROR_DRIVER_INTERNAL_ERROR: |
| 38 | return "DXGI_ERROR_DRIVER_INTERNAL_ERROR: Internal driver error."; |
| 39 | case DXGI_ERROR_INVALID_CALL: |
| 40 | return "DXGI_ERROR_INVALID_CALL: The method call is invalid (e.g. parameter mismatch or wrong calling order)."; |
| 41 | case DXGI_ERROR_WAS_STILL_DRAWING: |
| 42 | return "DXGI_ERROR_WAS_STILL_DRAWING: The GPU is still busy with a previous operation."; |
| 43 | case DXGI_ERROR_UNSUPPORTED: |
| 44 | return "DXGI_ERROR_UNSUPPORTED: The requested functionality is not supported by the device or driver."; |
| 45 | default: |
| 46 | { |
| 47 | std::ostringstream oss; |
| 48 | oss << "HRESULT 0x" << std::uppercase << std::hex << std::setfill('0') << std::setw(8) << static_cast<unsigned long>(hr) |
| 49 | << ": " << std::system_category().message(hr); |
| 50 | return oss.str(); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | std::string GetDeviceDebugMessages(ID3D11Device* device, HRESULT originalHr) |
| 56 | { |
no test coverage detected