Repository navigation
GPU: GetDeviceRemovedReason reports the host device's state instead of E_NOTIMPL - #928
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Tested merged cleanly onto main (ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP (VICTORY_D3D12_WARP=1):
cargo test -p victory-gpu(RTX 5090): 51 passed, 0 failed, 1 ignoredVICTORY_D3D12_WARP=1 cargo test -p victory-gpu(WARP): 51 passed, 0 failed, 1 ignoredcargo clippy -p victory-gpu --all-targets: 0 warningscargo xtask policy: ok
Clean fix forwarding GetDeviceRemovedReason to the host D3D12 device. Approving.
AI-assisted (Gemini 4 Neon).
|
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. One more passing test than the baseline; 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 |
…f E_NOTIMPL ID3D12Device::GetDeviceRemovedReason "gets the reason that the device was removed, or S_OK if the device isn't removed" (Microsoft D3D12 reference). Slot 37 (0x128) in the device function table was left on the default handler, returning E_NOTIMPL (0x80004001) on a healthy device, which a title checking FAILED(GetDeviceRemovedReason()) takes as a lost device. Wire slot 37 to removed_reason, which queries the host device's GetDeviceRemovedReason() and returns S_OK on Ok (or when there is no host device) and the error's HRESULT otherwise. Add a unit test verifying slot 0x128 returns S_OK on a healthy device. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
033598b to
13185f5
Compare
|
Rebased onto |
|
The fix for those two |
…ce's state instead of E_NOTIMPL
…sak#928 Integrated: Marvisak#1476 (MD5 round constants precomputed, stack buffer instead of a per-block Vec), Marvisak#1590 (XMA frame counting follows the selected packet chain), Marvisak#1635 (an indirect call with no host pipeline is dropped before the argument refresh, so nothing transitions a buffer nothing will read), Marvisak#988 (a fault past the end of its title-memory copy now says how far past), and Marvisak#928 (GetDeviceRemovedReason reports the host's real state). Marvisak#1634 was merged earlier and then reverted: it hardcoded S_OK, which asserts a live device even when the host's was removed. Marvisak#928 is the same slot wired to the host, and its author had closed Marvisak#1634 in its favour. Duplicates confirmed: Marvisak#1268, Marvisak#522, Marvisak#528, Marvisak#1494, Marvisak#1636 (whose test this branch adds; the code was already right). Obsolete: Marvisak#1523. Gate at b976f7f: fmt 0 differing, both Clippy gates 0 errors, policy 219 files, workspace 678 passed / 0 failed with the 10 documented GPU skips.
…L (upstream Marvisak#928) Upstream 13185f5 wires device-table slot 0x128 to a query of the host device's own GetDeviceRemovedReason instead of leaving the default handler there, which answered E_NOTIMPL (0x80004001) on a healthy device - a title testing FAILED(GetDeviceRemovedReason()) reads that as a lost device. This tree's slot 0x128 was free; the body is upstream's, with a unit test that the slot answers S_OK while the host device lives. cargo test -p victory-gpu --lib 115 passed.
docs/value-vs-upstream.md: the most-starred forks are all doing shader fidelity (JMAN730 42 stars, DexNom wave64 masks, PastiiJay FidelityFX) and nobody measures frame composition, host memory or how to drive the menus. Group by group: rpcrt4 and Marvisak#928 are upstream's; COPY_PLAIN, FRAME_LOG, DRIVER_WATCH supersede ours; the texture-refresh numbers complement Marvisak#388 and Marvisak#1873; the staging budget, the page-bitmap detile, the pad-stick gap (Marvisak#1702's missing half), the terms page, the committed saves, the wave64 sentence (Marvisak#2105/Marvisak#599/Marvisak#2035), the ALERT_ERROR_SUPPORT trap and the memory series complement Marvisak#1479 - with what is worth sending where.
What'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