Repository navigation
D3D12: check device removal before using GPU readbacks - #109
Merged
Merged
Conversation
Collaborator
This was referenced Nov 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When D3D12 removes the device, GetCompletedValue returns UINT64_MAX and an event registered on the fence can wake. The old comparisons accepted that value as a completed copy and proceeded to map the readback buffer.
Check the completion value before registering the event and again after waiting. Return the device's removal reason when available. The compute, draw and texture helpers now stop before mapping an unconfirmed readback, including timestamp results. The presenter retains its copy resources until completion and skips an unconfirmed frame dump. The shutdown queue drain also distinguishes removal from a pending fence.
Five deterministic tests cover completion, removal before registration or after wake, a stale event, timeout resampling and registration failure. They use synthetic fence values without resetting either GPU.
On Windows with Agility SDK 620, the RTX 5070 and Ryzen 9800X3D Radeon iGPU each passed the library suite (434 passed, 16 ignored), both launcher tests and the synthetic compute dispatch/readback test. Each configuration also passed with XCL_SPLIT_WAVE64=1. Builds used two jobs and tests ran on a single thread.
The RTX compute integration test with the inbox D3D12 runtime fails during root-signature creation (0x80070057) on both upstream 60599a9 and the patched code; Agility passes. Sparse-memory staging and one-shot resource lifetime after an ordinary timeout are separate from this readback fix.