GPU: GetDevice and the DXGI device hand out the device at every level #249
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/249"
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 Maraco91 on 2026-11-24T01:48:58Z.
What
The device answers
QueryInterfaceforID3D12Deviceand for its newer levels,ID3D12Device1to8and11(device::is_device; Grand Theft Auto VI creates it asID3D12Device11). Two other ways to reach the device knew only the first interface:object::parent_device:ID3D12DeviceChild::GetDevice, slot 0x38 of every device child (fences, queues, lists, heaps, resources, pipelines, ..);dxgi::device_query:QueryInterfaceon the DXGI device, which "also answers for the D3D12 device".Asked for the device by any newer level, both returned
E_NOINTERFACEand a null pointer:That is the interface the title itself holds, so code that goes from an object back to its device asks with exactly that id; callers rarely check this result, since on the host it cannot fail for an interface the device has.
Both now use the device's own test.
is_devicebecomespub(crate); nothing else changes.I have not seen the title or its middleware make this call (I have no game files); it would show in the log as
unknown interfaceon a device child.Tested
Windows 11 Pro 10.0.26200, NVIDIA RTX 3080 Ti (driver 32.0.16.1656), rustc 1.98.1 (
x86_64-pc-windows-msvc), no game data.Two new unit tests in
device.rs:the_hosts_children_hand_out_newer_device_levels(Windows, needs a host device; I checked it did not take its no-GPU early return here): the reference. On the host device, a fence'sGetDeviceforID3D12Device5succeeds. Passes onmainand with the fix.the_device_is_found_at_every_level_through_others(no GPU): forID3D12Deviceand each of the nine newer ids, a fence'sGetDeviceand the DXGI device'sQueryInterfacereturnS_OKand the device. Control: asking the fence'sGetDevicefor an interface the device is not (the fence's own id) still returnsE_NOINTERFACEand nulls the pointer.Results:
main(d2a4bae) + the tests only:cargo test -p victory-gpu --lib device::tests: the second test fails at the first newer id (ID3D12Device1):left: -2147467262(E_NOINTERFACE),right: 0.cargo test -p victory-gpu --lib: 45 passed, 0 failed, 1 ignored.cargo clippy -p victory-gpu --tests: nothing in the three files.rustfmt --checkon them: clean.cargo xtask policy: 151 files ok.git merge-tree) with #153 and #32, which changeobject.rs: clean.Not tested: a title run.
AI-assisted (Claude Code); the tests above were run on the machine described.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T05:38:27Z.
Tested current PR head
717f322c3ced51ea6f4baae4790a83efa2b2e184.cargo test --locked -p victory-gpu --lib the_device -- --test-threads=1: 2 passed, 44 filtered out. The newthe_device_is_found_at_every_level_through_otherstest asks a fence'sGetDeviceand the DXGI device'sQueryInterfacefor the base device IID and every newer device level, checks that both return the same device, and verifies an unsupported fence IID returnsE_NOINTERFACEwith a null output. The existing device-creation test passed in the same target (interface test).cargo test --locked -p victory-gpu --lib the_hosts_children_hand_out_newer_device_levels -- --test-threads=1: 1 passed. This Windows-only smoke test creates a host fence and asks forID3D12Device5; it returns early when no host D3D12 device is available (host test).The synthetic interface test verifies the COM-style lookup paths; the host check is conditional, and neither test runs a game or title.