XGameRuntime: QueryInterface(IUnknown) on XCL's GDK objects gives one identity #1583
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1593"
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 ivall/xcl. Originally posted by Gruzzberry on 2026-11-24T18:03:05Z.
The objects
QueryApiImplhands out have QueryInterface / AddRef / Release as their first three vtable slots, so they are COM objects. COM requiresQueryInterface(IID_IUnknown)to succeed and to return the same pointer from every interface of the object, since that is how a caller compares identity.query_interfaceonly accepted the class id, the vtable's own interface ids and, on the main vtable, ids the GDK table does not know, so on a non-main vtable (for example XUser's gamertag interface) it was refused withE_NOINTERFACE. IUnknown now answers with the class's main object from every vtable, so two vtables of one object compare equal.What is in it
crates/xcl/src/hle/xgameruntime/api.rs:IID_IUNKNOWNinquery_interfacereturns the class's main object (own(&clsid, &IID_IUNKNOWN),thisif the object is not in the table); testquery_interface_answers_iunknown_with_one_identity(main and gamertag vtables return the same pointer, an unknown id on the non-main vtable is still refused).Tested
main(9e3831e) with only the test added: FAILED (E_NOINTERFACEfor IUnknown); with the one-line "answer withthis" variant: FAILED (the two vtables return different pointers); with the fix: okcargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignoredgpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64,heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowscargo clippy -p xcl --all-targets: no new warnings in the changed linesRegression run (retail title 1.0.2.1, 60 s; first block
mainb7aa9f3, second this PR's head, which is on9e3831e)Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T18:54:37Z.
Full-suite run, since this PR has no test report yet. Tested exact head
f326446(on its base9e3831e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form: 776 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.query_interface_answers_iunknown_with_one_identity.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).heap_window_out_of_memory_falls_back_to_the_switch_formwas skipped with--skip. It fails on main9e3831etoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWSunset). Reported as #1651.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:12:11Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by throny on 2026-11-25T03:01:37Z.
Two contributors checked independently and found that #1610 #1615 solves the same problem (for #1488) in a different way: #1607, group D57. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:09:01Z.
XCL PR #1593 — focused Windows verification
Tested head
f326446781d6336721899335af750aad4acb40c2. The detached worktree was clean before and after the run. The PR changes onlycrates/xcl/src/hle/xgameruntime/api.rs.Tested
dxc.exe --version. Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Unoptimized profiles with debug info and incremental compilation disabled.cargo build --workspacesucceeded.cargo test --workspace --no-runsucceeded and produced 19 test executables.cargo test -p xcl --lib xgameruntime -- --nocapturewithXCL_ADAPTER=NONE_CPU_ONLYreported 74 passed, 0 failed, 0 ignored, and 675 filtered out. The log (pr1593-focused.log) contains 0 lines beginning withSKIPPED. The 74 includes two tests that returned early because the system XGameRuntime DLL and a default Windows audio endpoint were absent.query_interface_answers_iunknown_with_one_identitytest passed. It obtained distinct XUser main and gamertag interface pointers, checked that queryingIID_IUnknownthrough either returnedS_OKand the main object pointer, and checked that an unsupported IID on the gamertag interface returnedE_NOINTERFACEwith a null output.Not tested
Only focused XGameRuntime tests and full workspace compilation were run. The full GPU workspace suite and retail-title smoke runs were omitted. The PC-runtime thunk path and Windows default-audio endpoint assertions were skipped as described above.
AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1593-focused.logand published.Imported from ivall/xcl. Originally posted by Gruzzberry on 2026-11-25T09:31:43Z.
Thanks for the triage hint. On the overlap with #1610 and #1615:
crates/xcl/src/hle/xgameruntime/api.rs.QueryInterface(IID_IUnknown)returns the class's main object from every vtable, so all of an object's interfaces report one identity, as COM requires. #1615 answersIID_IUnknowntoo. #1610 also changes sibling-interface QI and forwarding aliases, which this PR leaves alone.I'm happy to go with whichever the maintainers prefer. If #1610's wider change is wanted, I can close this one, or rebase it to sit under #1610 as the identity part with its test.
AI use: drafted with Claude Code (Claude Opus 5.5) and posted by it at my request, after I reviewed it.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:44:27Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:12:46Z.
Triage (#1607) – head
f326446Overlaps #1610 and #1615 (D57), which answer QueryInterface(IID_IUnknown) in the same function. #1610 gives the same answer (the class's main object,
thisoutside the table) but also adds sibling-interface QI and changes forwarding aliases inQueryApiImpl. #1615 returnsthis, so two vtables of one object give two different IUnknown pointers, which breaks COM identity.This PR is the earliest and smallest of the three and only does the IUnknown part. Main's
query_interfacestill refuses IID_IUnknown on non-main vtables.No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.