Skip to content

GPU: GetDevice and the DXGI device hand out the device at every level - #249

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
Maraco91:gpu/get-device-newer-levels
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
Maraco91:gpu/get-device-newer-levels

Conversation

@Maraco91

Copy link
Copy Markdown
Contributor

What

The device answers QueryInterface for ID3D12Device and for its newer levels, ID3D12Device1 to 8 and 11 (device::is_device; Grand Theft Auto VI creates it as ID3D12Device11). 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: QueryInterface on the DXGI device, which "also answers for the D3D12 device".

Asked for the device by any newer level, both returned E_NOINTERFACE and a null pointer:

ID3D12Device11* device;
fence->GetDevice(IID_PPV_ARGS(&device));   // E_NOINTERFACE, device == nullptr

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_device becomes pub(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 interface on 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's GetDevice for ID3D12Device5 succeeds. Passes on main and with the fix.
  • the_device_is_found_at_every_level_through_others (no GPU): for ID3D12Device and each of the nine newer ids, a fence's GetDevice and the DXGI device's QueryInterface return S_OK and the device. Control: asking the fence's GetDevice for an interface the device is not (the fence's own id) still returns E_NOINTERFACE and nulls the pointer.

Results:

Not tested: a title run.

AI-assisted (Claude Code); the tests above were run on the machine described.

🤖 Generated with Claude Code

The device answers QueryInterface for ID3D12Device and for its newer
levels (Grand Theft Auto VI creates it as ID3D12Device11). A device
child's GetDevice and the DXGI device's QueryInterface knew only the
first: asked for the device by the interface the title holds, they
answered E_NOINTERFACE with a null pointer.

Both now ask the device's own test (is_device).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
muhammed-aksoy pushed a commit to muhammed-aksoy/VIctory that referenced this pull request Nov 24, 2026
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
… at every level

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremygold02

Copy link
Copy Markdown
Contributor

Tested current PR head 717f322c3ced51ea6f4baae4790a83efa2b2e184.

  • cargo test --locked -p victory-gpu --lib the_device -- --test-threads=1: 2 passed, 44 filtered out. The new the_device_is_found_at_every_level_through_others test asks a fence's GetDevice and the DXGI device's QueryInterface for the base device IID and every newer device level, checks that both return the same device, and verifies an unsupported fence IID returns E_NOINTERFACE with 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 for ID3D12Device5; 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.

@ghost ghost mentioned this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit 88b6658 into Marvisak:main Nov 24, 2026
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
GPU: GetDevice and the DXGI device hand out the device at every level
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
…vels

GPU: GetDevice and the DXGI device hand out the device at every level
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.

3 participants