GPU: GetDeviceRemovedReason reports the host device's state instead of E_NOTIMPL #928
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!928
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/928/head"
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?
@BastienRodz on GitHub · 2026-11-24 14:17 UTC · original
BastienRodz:gpu/device-removed-reason→main· +20 −0 · 1 files · 1 commits · merged 2026-11-25 00:24 UTCWhat's wrong
Microsoft's
ID3D12Device::GetDeviceRemovedReasonreference (https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-getdeviceremovedreason):In
crates/victory-gpu/src/device.rs(FUNCTIONS), the PC-order device table wires slot 36 (0x120,CreateFence, line 380) and slot 38 (0x130,GetCopyableFootprints, line 381), leaving slot 37 (0x128,GetDeviceRemovedReason) onobject::missing(crates/victory-gpu/src/object.rs:282-292), which logsmethod not implementedonce and returnsE_NOTIMPL.Calling slot
0x128on a fresh device:S_OK(0x00000000)E_NOTIMPL(0x80004001)Impact
A title that checks
FAILED(device->GetDeviceRemovedReason())treatsE_NOTIMPLas a lost device and enters device-loss recovery on a healthy device. No tester log so far showsslot=0x128, so Grand Theft Auto VI apparently does not call it.What the fix does
Add
removed_reasonincrates/victory-gpu/src/device.rsand wire it at slot 37 (0x128): queryhost.device.GetDeviceRemovedReason()when a host device exists, returningS_OKonOk(or when there is no host device) and the error'sHRESULT(e.code().0) otherwise. Add a unit test verifying slot0x128returnsS_OKon a healthy device.Tests
a_healthy_device_reports_no_removalcalls slot0x128on the device and expectsS_OK.main: it fails withleft: -2147467263(0x80004001,E_NOTIMPL),right: 0.windows-latestwith the upstream CI's commands (clippy-D warningswith and without--all-features, thencargo test --workspace --locked), everything passes;victory-gpu51 passed, 0 failed (https://github.com/BastienRodz/VIctory/actions/runs/45406532329). The runner has a host D3D12 device, so the call goes through the host'sGetDeviceRemovedReason.Not tested: a removed host device, where the host's reason is returned.
No game data used. AI-assisted: found with GPT-6.2 Astra, written with Gemini 4 Neon, reviewed and verified with Claude Code.
Fixes #900.
🤖 Generated with Claude Code
@dcastell1 on GitHub · 2026-11-24 14:28 UTC · original
Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build.
main@ffe310ebaseline on this box: 342 passed, 0 failed, 6 ignored.One more passing test than the baseline;
GetDeviceRemovedReasonreporting the host's reason is exercised and green.Tree restored afterwards (full diff against a clean checkout); no game data, the tests are synthetic. AI-assisted (opencode): applied the patch to a built tree, ran
cargo test --workspace, reverted it.@Zipettte on GitHub · 2026-11-24 15:40 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 033598b:
cargo test -p victory-gpupasses, 51 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@BastienRodz on GitHub · 2026-11-24 21:50 UTC · original
Rebased onto
main70564ae; the only conflicts were test blocks added on both sides at the end of the file. Onwindows-latestthe run is red, but only onemit::synthetic_tests::gathers_at_a_level_match_the_hardwareandpermutes_read_the_lane_named_and_zero_from_lanes_left_out.mainalone fails those two the same way, in its own CI (https://github.com/Marvisak/VIctory/actions/runs/45492970391) and on our fork (https://github.com/BastienRodz/VIctory/actions/runs/45494314536): the runner's adapter is a software one. This PR's own tests pass there. A fix for those two tests is on its way as a separate PR.@BastienRodz on GitHub · 2026-11-24 21:59 UTC · original
The fix for those two
maintests is #1752 (windows-latestgreen with it).