GPU: every object answers for IUnknown #270
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!270
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/270/head"
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?
@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 UTCWhat
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, ..) throughobject::is, and no list holdsIUnknown(00000000-0000-0000-c000-000000000046). So the answer isE_NOINTERFACEand a null pointer, with anunknown interfacewarning. 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, asComPtr/CComPtrcomparisons do), to hold an object as a plain reference, or to hand it to an API that takes any object.object::isnow also matchesIUnknown; every caller listed above goes through it, and all of them answer with the object that was asked (or, forGetDevice/GetParent, with the object they name), which is right forIUnknowntoo. 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 interfacewith 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_iunknowninobject.rs:QueryInterfaceforIUnknownthrough slot 0 of the device, of a fence, and of the DXGI device returnsS_OK; the device and the fence answer with themselves, the DXGI device with the device. Control: an id no object has still getsE_NOINTERFACEand a nulled pointer from the fence.main(d2a4bae) + the test and the constant only:cargo test -p victory-gpu --lib every_object_answersfails at the device:left: (-2147467262, 0x0)(E_NOINTERFACE, null).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 throughd3d12x).cargo clippy -p victory-gpu --tests: nothing inobject.rs.rustfmt --check object.rs: clean.cargo xtask policy: 151 files ok.git merge-tree) with #32, #153 and #249, which changeobject.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
@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_iunknownpassedobject::tests::every_object_answers_for_iunknown. It checksIUnknownidentity through the device, fence and DXGI-device interfaces, and confirms an unsupported IID still returnsE_NOINTERFACEwith a null output. The coverage is in object.rs. This is a unit test and does not require a GPU or title run.