Skip to content

GPU: every object answers for IUnknown - #270

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
Maraco91:gpu/every-object-answers-iunknown
Nov 25, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
Maraco91:gpu/every-object-answers-iunknown

Conversation

@Maraco91

Copy link
Copy Markdown
Contributor

What

QueryInterface(IID_IUnknown) fails on every graphics object: the device, the DXGI objects, fences, queues, lists, allocators, heaps, resources, pipelines, root signatures.

Each object's query matches the id against its own list (FENCE_IIDS, QUEUE_IIDS, ..) through object::is, and no list holds IUnknown (00000000-0000-0000-c000-000000000046). So the answer is E_NOINTERFACE and a null pointer, with an unknown interface warning. The same goes for every other call that hands out an object by interface id (creation, GetDevice, GetParent).

COM requires every object to answer for it, and code relies on that: to compare two interface pointers for identity (QueryInterface(IID_IUnknown) on both, as ComPtr/CComPtr comparisons do), to hold an object as a plain reference, or to hand it to an API that takes any object.

object::is now also matches IUnknown; every caller listed above goes through it, and all of them answer with the object that was asked (or, for GetDevice/GetParent, with the object they name), which is right for IUnknown too. The DXGI device answers with the D3D12 device, as it already does for the device's own id: one pointer whichever of the object's interfaces is asked, which is what identity comparisons need.

I have not seen the title or its middleware ask (I have no game files); it would show in the log as unknown interface with the id above.

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. The test needs no GPU.

New unit test every_object_answers_for_iunknown in object.rs: QueryInterface for IUnknown through slot 0 of the device, of a fence, and of the DXGI device returns S_OK; the device and the fence answer with themselves, the DXGI device with the device. Control: an id no object has still gets E_NOINTERFACE and a nulled pointer from the fence.

Not tested: a title run.

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

🤖 Generated with Claude Code

No graphics object's interface list holds IUnknown, so QueryInterface
for it (and every call that hands out an object by interface id) said
E_NOINTERFACE and returned null. COM code asks for it to compare two
pointers for identity, to keep an object as a plain reference, or to
pass it on to an API that takes any object.

object::is, which all of those go through, now also matches IUnknown.
The DXGI device answers with the D3D12 device, which it already stands
for: one pointer whichever of the object's interfaces is asked.

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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremygold02

Copy link
Copy Markdown
Contributor

Tested this open PR at head 92f2c60c8159e34a47570aa81f3d25624cc6db5c (still current when refreshed before posting).

cargo test --locked -p victory-gpu --lib every_object_answers_for_iunknown passed object::tests::every_object_answers_for_iunknown. It checks IUnknown identity through the device, fence and DXGI-device interfaces, and confirms an unsupported IID still returns E_NOINTERFACE with a null output. The coverage is in object.rs. This is a unit test and does not require a GPU or title run.

@ghost ghost mentioned this pull request Nov 24, 2026

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 92f2c60 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed), including every_object_answers_for_iunknown.

  • COM's rule is that every object answers IUnknown, with the same pointer whichever interface is asked. Putting IUNKNOWN into object::is covers every query path in one place.
  • I checked the identity part. The device's query_interface tries is_device(iid) first, so IUnknown returns the device. The DXGI device's device_query checks [device::IID] first, so its IUnknown also returns the D3D12 device. One pointer, as the test asserts.
  • Callers that use is for something other than a query (the creation paths in device.rs:92 and descriptor.rs:637) now accept IUnknown as a requested interface and hand back the object. That is also what native D3D12 does for CreateX(..., IID_IUnknown, ...).

No issues found.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
…itives, capture), verified together

Merges #124 #119 #515 #934 #484 #143 #1191 #278 #553 #153 #270 #1158 #1204
#1220 #488 #1146 #631 onto main (ffe310e), each head unchanged, no conflicts,
no changes of mine. cargo clippy --workspace --all-targets --locked -- -D
warnings, with and without --all-features, is clean and cargo test
--workspace --locked passes (372 passed, 8 ignored; main has 342 passed,
6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit 38011a0 into Marvisak:main Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
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.

4 participants