Skip to content

D3D12: check device removal before using GPU readbacks - #109

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
certified-retart:fix/d3d12-fence-removal
Nov 23, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
certified-retart:fix/d3d12-fence-removal

Conversation

@certified-retart

Copy link
Copy Markdown
Contributor

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.

@ivall
ivall merged commit 5ec6570 into xcl-dev:main Nov 23, 2026
ivall added a commit that referenced this pull request Nov 23, 2026
…s a gamepad), "What is missing" removed; HANDOFF: PRs #107-#109
@ivall

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Merged. Checked on Windows 11 with an RX 9070: cargo test --workspace green with the retail samples (shader pack, console DLLs, texture archive), lib tests also with XCL_SPLIT_WAVE64=1; Unicorn Overlord runs with #107–#109 merged. Thanks!

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