GPU: every object answers for IUnknown #270

Manually merged
github merged 1 commit from gh-pr/270/head into gh-pr/270/base 2026-11-26 03:57:22 +00:00
Owner

@⁠Maraco91 on GitHub · 2026-11-24 01:56 UTC · original
Maraco91:gpu/every-object-answers-iunknown → main · +37 −2 · 1 files · 1 commits · merged 2026-11-25 00:19 UTC

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.

  • main (d2a4bae) + the test and the constant only: cargo test -p victory-gpu --lib every_object_answers fails at the device: left: (-2147467262, 0x0) (E_NOINTERFACE, null).
  • with the fix: cargo test -p victory-gpu --lib: 44 passed, 0 failed, 1 ignored; cargo test -p victory-hle --lib: 86 passed, 0 failed (it drives these objects through d3d12x).
  • cargo clippy -p victory-gpu --tests: nothing in object.rs. rustfmt --check object.rs: clean.
  • cargo xtask policy: 151 files ok.
  • Trial merges (git merge-tree) with #32, #153 and #249, which change object.rs: all clean.

Not tested: a title run.

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

🤖 Generated with Claude Code

**@⁠Maraco91** on GitHub · 2026-11-24 01:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/270) `Maraco91:gpu/every-object-answers-iunknown` → `main` · +37 −2 · 1 files · 1 commits · merged 2026-11-25 00:19 UTC ## 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. - `main` (d2a4bae) + the test and the constant only: `cargo test -p victory-gpu --lib every_object_answers` **fails** at the device: `left: (-2147467262, 0x0)` (`E_NOINTERFACE`, null). - with the fix: `cargo test -p victory-gpu --lib`: **44 passed, 0 failed, 1 ignored**; `cargo test -p victory-hle --lib`: **86 passed, 0 failed** (it drives these objects through `d3d12x`). - `cargo clippy -p victory-gpu --tests`: nothing in `object.rs`. `rustfmt --check object.rs`: clean. - `cargo xtask policy`: 151 files ok. - Trial merges (`git merge-tree`) with #32, #153 and #249, which change `object.rs`: all clean. Not tested: a title run. AI-assisted (Claude Code); the tests above were run on the machine described. 🤖 Generated with [Claude Code](https://claude.com/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 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:19 +00:00
github manually merged commit 92f2c60c81 into gh-pr/270/base 2026-11-26 03:57:22 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:05 UTC · original

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.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/270#issuecomment-7121691477) 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](https://github.com/Marvisak/VIctory/blob/92f2c60c8159e34a47570aa81f3d25624cc6db5c/crates/victory-gpu/src/object.rs). This is a unit test and does not require a GPU or title run.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!270
No description provided.