D3D12: check device removal before using GPU readbacks #108
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/109"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by certified-retart on 2026-11-23T11:23:27Z.
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
60599a9and the patched code; Agility passes. Sparse-memory staging and one-shot resource lifetime after an ordinary timeout are separate from this readback fix.Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T11:32:53Z.
Merged. Checked on Windows 11 with an RX 9070:
cargo test --workspacegreen with the retail samples (shader pack, console DLLs, texture archive), lib tests also withXCL_SPLIT_WAVE64=1; Unicorn Overlord runs with #107–#109 merged. Thanks!