XGameRuntime: QueryInterface(IUnknown) on XCL's GDK objects gives one identity #1593

Open
github-bot wants to merge 1 commit from github-bot/gh-1593 into main AGit
Owner

@⁠Gruzzberry on GitHub · 2026-11-24 18:03 UTC · original
Gruzzberry:gz/xgameruntime-qi-iunknown → main · +34 −0 · 1 files · 1 commits · open

The objects QueryApiImpl hands out have QueryInterface / AddRef / Release as their first three vtable slots, so they are COM objects. COM requires QueryInterface(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_interface only 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 with E_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_IUNKNOWN in query_interface returns the class's main object (own(&clsid, &IID_IUNKNOWN), this if the object is not in the table); test query_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

  • RTX 4070 (NVIDIA, wave32), i7-13700K, Windows 11 26200, rustc 1.100.0 stable, debug tests / release smoke
  • New test on main (9e3831e) with only the test added: FAILED (E_NOINTERFACE for IUnknown); with the one-line "answer with this" variant: FAILED (the two vtables return different pointers); with the fix: ok
  • cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored
  • SKIPPED: gpu::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 windows
  • cargo clippy -p xcl --all-targets: no new warnings in the changed lines

Regression run (retail title 1.0.2.1, 60 s; first block main b7aa9f3, second this PR's head, which is on 9e3831e)

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 4070
title: 404998dc
seconds: 60
exit: 0x0
frames shown: 1648 (PresentX 1648)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16974 MB
xcl-smoke v1
commit: f326446781d6336721899335af750aad4acb40c2
gpu: NVIDIA GeForce RTX 4070
title: 404998dc
seconds: 60
exit: 0x0
frames shown: 1648 (PresentX 1648)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17003 MB

Not tested

  • AMD / wave64 GPUs, Linux / Wine
  • No title is known to query IUnknown on these objects; the smoke run only shows nothing regressed

AI use

  • Claude Code with Claude Sonnet 5.5 found, wrote and tested it; the user reviews and opens it.

🤖 Generated with Claude Code

**@⁠Gruzzberry** on GitHub · 2026-11-24 18:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1593) `Gruzzberry:gz/xgameruntime-qi-iunknown` → `main` · +34 −0 · 1 files · 1 commits · open The objects `QueryApiImpl` hands out have QueryInterface / AddRef / Release as their first three vtable slots, so they are COM objects. COM requires `QueryInterface(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_interface` only 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 with `E_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_IUNKNOWN` in `query_interface` returns the class's main object (`own(&clsid, &IID_IUNKNOWN)`, `this` if the object is not in the table); test `query_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** - RTX 4070 (NVIDIA, wave32), i7-13700K, Windows 11 26200, rustc 1.100.0 stable, debug tests / release smoke - New test on `main` (9e3831e) with only the test added: FAILED (`E_NOINTERFACE` for IUnknown); with the one-line "answer with `this`" variant: FAILED (the two vtables return different pointers); with the fix: ok - `cargo test --workspace -- --test-threads=4`: 777 passed, 0 failed, 41 ignored - SKIPPED: `gpu::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 windows` - `cargo clippy -p xcl --all-targets`: no new warnings in the changed lines **Regression run** (retail title 1.0.2.1, 60 s; first block `main` b7aa9f3, second this PR's head, which is on 9e3831e) ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: NVIDIA GeForce RTX 4070 title: 404998dc seconds: 60 exit: 0x0 frames shown: 1648 (PresentX 1648) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16974 MB ``` ``` xcl-smoke v1 commit: f326446781d6336721899335af750aad4acb40c2 gpu: NVIDIA GeForce RTX 4070 title: 404998dc seconds: 60 exit: 0x0 frames shown: 1648 (PresentX 1648) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17003 MB ``` **Not tested** - AMD / wave64 GPUs, Linux / Wine - No title is known to query IUnknown on these objects; the smoke run only shows nothing regressed **AI use** - Claude Code with Claude Sonnet 5.5 found, wrote and tested it; the user reviews and opens it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The objects QueryApiImpl hands out lay out QueryInterface / AddRef / Release as
their first three slots, so they are COM objects. COM requires
QueryInterface(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_interface only 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
such as XUserGetGamertag's it was refused with E_NOINTERFACE.

IUnknown now answers with the class's main object from every vtable, so two
vtables of one object compare equal.

Assisted-by: Claude Code (Claude Sonnet 5.5)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:58:44 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 18:54 UTC · original

Full-suite run, since this PR has no test report yet. Tested exact head f326446 (on its base 9e3831e).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_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.
  • The new tests ran and passed: query_interface_answers_iunknown_with_one_identity.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, 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_form was skipped with --skip. It fails on main 9e3831e too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWS unset). Reported as #1651.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 18:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1593#issuecomment-7141322492) Full-suite run, since this PR has no test report yet. Tested exact head `f326446` (on its base `9e3831e`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_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`. - The new tests ran and passed: `query_interface_answers_iunknown_with_one_identity`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `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_form` was skipped with `--skip`. It fails on main `9e3831e` too, not because of this PR: under `XCL_REQUIRE_GPU=mesh`, `runner::skip_test` turns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (`XCL_HEAP_WINDOWS` unset). Reported as #1651. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 20:12 UTC · original

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 unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 20:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1593#issuecomment-7143184521) 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 unmodified `main`.) Thanks!
Author
Owner

@⁠throny on GitHub · 2026-11-25 03:01 UTC · original

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.

**@⁠throny** on GitHub · 2026-11-25 03:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1593#issuecomment-7151516448) <!-- xcl-1607-hint:D57 --> 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.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 05:09 UTC · original

XCL PR #1593 — focused Windows verification

Tested head f326446781d6336721899335af750aad4acb40c2. The detached worktree was clean before and after the run. The PR changes only crates/xcl/src/hle/xgameruntime/api.rs.

Tested

  • STOR-WINLAB, AMD Ryzen 7 3800X and Intel Arc A770 (driver 32.0.101.9175), Windows 11 Enterprise Evaluation x64 (10.0.26200.9974). DXC 1.9.2609.5 verified with dxc.exe --version. Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Unoptimized profiles with debug info and incremental compilation disabled.
  • cargo build --workspace succeeded. cargo test --workspace --no-run succeeded and produced 19 test executables.
  • cargo test -p xcl --lib xgameruntime -- --nocapture with XCL_ADAPTER=NONE_CPU_ONLY reported 74 passed, 0 failed, 0 ignored, and 675 filtered out. The log (pr1593-focused.log) contains 0 lines beginning with SKIPPED . The 74 includes two tests that returned early because the system XGameRuntime DLL and a default Windows audio endpoint were absent.
  • The new query_interface_answers_iunknown_with_one_identity test passed. It obtained distinct XUser main and gamertag interface pointers, checked that querying IID_IUnknown through either returned S_OK and the main object pointer, and checked that an unsupported IID on the gamertag interface returned E_NOINTERFACE with 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.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 05:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1593#issuecomment-7153495564) # XCL PR #1593 — focused Windows verification Tested head `f326446781d6336721899335af750aad4acb40c2`. The detached worktree was clean before and after the run. The PR changes only `crates/xcl/src/hle/xgameruntime/api.rs`. **Tested** - STOR-WINLAB, AMD Ryzen 7 3800X and Intel Arc A770 (driver 32.0.101.9175), Windows 11 Enterprise Evaluation x64 (10.0.26200.9974). DXC 1.9.2609.5 verified with `dxc.exe --version`. Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Unoptimized profiles with debug info and incremental compilation disabled. - `cargo build --workspace` succeeded. `cargo test --workspace --no-run` succeeded and produced 19 test executables. - `cargo test -p xcl --lib xgameruntime -- --nocapture` with `XCL_ADAPTER=NONE_CPU_ONLY` reported 74 passed, 0 failed, 0 ignored, and 675 filtered out. The log (`pr1593-focused.log`) contains 0 lines beginning with `SKIPPED `. The 74 includes two tests that returned early because the system XGameRuntime DLL and a default Windows audio endpoint were absent. - The new `query_interface_answers_iunknown_with_one_identity` test passed. It obtained distinct XUser main and gamertag interface pointers, checked that querying `IID_IUnknown` through either returned `S_OK` and the main object pointer, and checked that an unsupported IID on the gamertag interface returned `E_NOINTERFACE` with 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.log` and published.
Author
Owner

@⁠Gruzzberry on GitHub · 2026-11-25 09:31 UTC · original

Thanks for the triage hint. On the overlap with #1610 and #1615:

  • Order: this PR was opened at 18:03 UTC on 24 Nov; #1610 followed at 18:14 and #1615 at 18:15.
  • Scope: this PR only touches 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 answers IID_IUnknown too. #1610 also changes sibling-interface QI and forwarding aliases, which this PR leaves alone.
  • Tests: it has three independent passing reports above (RTX 5070 Ti, RTX 3060 Ti, Arc A770).

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.

**@⁠Gruzzberry** on GitHub · 2026-11-25 09:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/1593#issuecomment-7158451542) Thanks for the triage hint. On the overlap with #1610 and #1615: - **Order:** this PR was opened at 18:03 UTC on 24 Nov; #1610 followed at 18:14 and #1615 at 18:15. - **Scope:** this PR only touches `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 answers `IID_IUnknown` too. #1610 also changes sibling-interface QI and forwarding aliases, which this PR leaves alone. - **Tests:** it has three independent passing reports above (RTX 5070 Ti, RTX 3060 Ti, Arc A770). 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1593/head:github-bot/gh-1593'
git switch 'github-bot/gh-1593'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1593'
git switch 'github-bot/gh-1593'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1593'
git switch 'github-bot/gh-1593'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1593'
git switch 'main'
git merge --squash 'github-bot/gh-1593'
git switch 'main'
git merge --ff-only 'github-bot/gh-1593'
git switch 'main'
git merge 'github-bot/gh-1593'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.