Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d3d12: Include device removal reason when ERROR_DEVICE_REMOVED is raised #262

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

MarijnS95
Copy link
Member

Our "painful" Error::Internal(String) design for useful errors makes it impossible for downstream crates to retrieve the original HRESULT and match on it as necessary to action on stringified error codes like DXGI_ERROR_DEVICE_REMOVED, which print:

ID3D12Device::CreatePlacedResource failed: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887A0005)

Without rearchitecting our Error type, the nicest middle ground is anyway for gpu-allocator to already add the error message from GetDeviceRemovedReason() to the Result so that downstream crates can immediately see in their error messages why the device is or was removed/suspended when they make an allocation.

@MarijnS95 MarijnS95 changed the title dx12: Include device removal reason when ERROR_DEVICE_REMOVED is raised d3d12: Include device removal reason when ERROR_DEVICE_REMOVED is raised Jan 30, 2025
…aised

Our "painful" `Error::Internal(String)` design for useful errors makes
it impossible for downstream crates to retrieve the original `HRESULT`
and match on it as necessary to action on stringified error codes like
`DXGI_ERROR_DEVICE_REMOVED`, which print:

    ID3D12Device::CreatePlacedResource failed: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887A0005)

Without rearchitecting our `Error` type, the nicest middle ground
is anyway for `gpu-allocator` to already add the error message from
`GetDeviceRemovedReason()` to the `Result` so that downstream crates
can immediately see in their error messages _why_ the device is or was
removed/suspended when they make an allocation.
@MarijnS95 MarijnS95 enabled auto-merge (squash) January 30, 2025 21:40
@MarijnS95 MarijnS95 merged commit 5d4b861 into main Jan 30, 2025
26 checks passed
@MarijnS95 MarijnS95 deleted the dx12-remove branch January 30, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants