GPU: GetDeviceRemovedReason returns E_NOTIMPL on a healthy device #900
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T13:46:41Z.
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.Fix
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.The fix is ready on a branch of my fork, since PR creation is limited to collaborators: https://github.com/BastienRodz/VIctory/commits/gpu/device-removed-reason (one commit on
mainffe310e,device.rs+20).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.
Imported from Marvisak/VIctory. Originally posted by DaniiL35 on 2026-11-24T13:48:14Z.
Verified branch
033598b(on top offfe310e):D3D12 ABI Vtable Verification
Checked the
ID3D12DeviceCOM vtable layout:0x120):CreateFence0x128):GetDeviceRemovedReason0x130):GetCopyableFootprints0x138):CreateQueryHeapIn
FUNCTIONS(crates/victory-gpu/src/device.rs), slot 37 was previously skipped, falling through toobject::missingwhich returnsE_NOTIMPL(0x80004001). BecauseFAILED(0x80004001)evaluates to true, any DirectX 12 middleware or title asserting device health viadevice->GetDeviceRemovedReason()would erroneously treat a healthy device as removed/crashed.Code & Concurrency Inspection
removed_reasoncorrectly querieshost.device.GetDeviceRemovedReason()under#[cfg(windows)].S_OK(0x00000000).HRESULT(e.code().0).#[cfg(windows)]check prevents compilation errors or warnings on headless / non-Windows builds, returningS_OK.Tests & Policy
a_healthy_device_reports_no_removalexercises slot0x128directly via the function table and assertsS_OK.device.rs). Pure synthetic unit test, no proprietary assets or SDK headers.cargo xtask policy.Reviewed and verified. AI-assisted with Antigravity.
Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T13:48:33Z.
Independent Wine result on
033598b, RTX 4090 with vkd3d-proton 3.2. A test-only fixture queried the live host device, created the guest device and called slot 37 (0x128) through its vtable. Both calls reported success. The fixture logged after both assertions, confirming this run reached the live-device path. All eight focused device tests passed. This covers the healthy-device case. A removed-device HRESULT and a GTA VI call site remain unverified.