XGameRuntime: answer QueryInterface for IID_IUnknown on runtime objects #1605

Open
OtavioTadeu wants to merge 1 commit from upstream-pr/1615 into main
OtavioTadeu commented 2026-11-24 18:15:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by OtavioTadeu on 2026-11-24T18:15:23Z.


What is in it

  • Addresses XCL-BT-040 (Part of #1488): accept IID_IUnknown ({00000000-0000-0000-C000-000000000046}) in hle::xgameruntime::api::query_interface, and clear *out when non-null before returning E_INVALIDARG or E_NOINTERFACE.
  • Add query_interface_accepts_iunknown unit test covering non-main, built-in fallback, and main XGameRuntime COM objects.

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce GTX 1660 SUPER (driver 32.0.16.1088, Turing wave32), AMD Ryzen 5 5600G, Windows 11 26200, rustc 1.100.0, debug
  • cargo test -p xcl --lib hle::xgameruntime::api: 17 passed, 0 failed
  • cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 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])

Regression run

  • scripts/smoke.ps1 -Game retail_title -Seconds 60 (main baseline vs PR head on NVIDIA GeForce GTX 1660 SUPER):

xcl-smoke v1

commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485

gpu: NVIDIA GeForce GTX 1660 SUPER

title: retail_title

seconds: 60

exit: 0x0

frames shown: 631 (PresentX 631)

presents per 2 s (last 3): 47 47 49

device removals: 0

crashes: 0

peak commit: 15199 MB


xcl-smoke v1

commit: 027232617e7f3223e9bf97e55d822e7a490f1055

gpu: NVIDIA GeForce GTX 1660 SUPER

title: retail_title

seconds: 60

exit: 0x0

frames shown: 749 (PresentX 750)

presents per 2 s (last 3): 52 50 50

device removals: 0

crashes: 0

peak commit: 15267 MB

Not tested

  • AMD / Intel / native wave64 GPUs, Linux/Wine, and extended gameplay past the 60 s smoke window

AI use

  • Antigravity (Gemini 4 Neon) implemented the IID_IUnknown handling, unit test, and commit message; human reviewed.
<!-- greyfinch-sync:ivall/xcl:issue:5477808940 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615). Originally posted by [OtavioTadeu](https://github.com/OtavioTadeu) on 2026-11-24T18:15:23Z. --- **What is in it** - Addresses `XCL-BT-040` (Part of #1488): accept `IID_IUnknown` (`{00000000-0000-0000-C000-000000000046}`) in `hle::xgameruntime::api::query_interface`, and clear `*out` when non-null before returning `E_INVALIDARG` or `E_NOINTERFACE`. - Add `query_interface_accepts_iunknown` unit test covering non-main, built-in fallback, and main XGameRuntime COM objects. **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce GTX 1660 SUPER (driver 32.0.16.1088, Turing wave32), AMD Ryzen 5 5600G, Windows 11 26200, rustc 1.100.0, debug - `cargo test -p xcl --lib hle::xgameruntime::api`: 17 passed, 0 failed - `cargo test --workspace -- --test-threads=4`: 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests: `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]) **Regression run** - `scripts/smoke.ps1 -Game retail_title -Seconds 60` (`main` baseline vs PR head on NVIDIA GeForce GTX 1660 SUPER): ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce GTX 1660 SUPER title: retail_title seconds: 60 exit: 0x0 frames shown: 631 (PresentX 631) presents per 2 s (last 3): 47 47 49 device removals: 0 crashes: 0 peak commit: 15199 MB ``` ``` xcl-smoke v1 commit: 027232617e7f3223e9bf97e55d822e7a490f1055 gpu: NVIDIA GeForce GTX 1660 SUPER title: retail_title seconds: 60 exit: 0x0 frames shown: 749 (PresentX 750) presents per 2 s (last 3): 52 50 50 device removals: 0 crashes: 0 peak commit: 15267 MB ``` **Not tested** - AMD / Intel / native wave64 GPUs, Linux/Wine, and extended gameplay past the 60 s smoke window **AI use** - Antigravity (Gemini 4 Neon) implemented the `IID_IUnknown` handling, unit test, and commit message; human reviewed.
futurepro62 commented 2026-11-24 19:07:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T18:57:54Z.


Full-suite run, since this PR has no test report yet. Tested exact head 0272326 (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_accepts_iunknown.
  • 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.
<!-- greyfinch-sync:ivall/xcl:comment:7141399630 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7141399630). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T18:57:54Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `0272326` (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_accepts_iunknown`. - 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.
DavidM1911 commented 2026-11-24 21:09:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:30:25Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7143650170 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7143650170). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T20:30:25Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
throny commented 2026-11-25 03:05:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-25T03:01:36Z.


Two contributors checked independently and found that #1610 solves the same problem (for #1488) in a different way: #1607, group D47. 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.

<!-- greyfinch-sync:ivall/xcl:comment:7151516009 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7151516009). Originally posted by [throny](https://github.com/throny) on 2026-11-25T03:01:36Z. --- <!-- xcl-1607-hint:D47 --> Two contributors checked independently and found that #1610 solves the same problem (for #1488) in a different way: #1607, group D47. 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 commented 2026-11-25 04:10:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-25T03:12:12Z.


Two contributors checked independently and found that #1593 #1610 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.

<!-- greyfinch-sync:ivall/xcl:comment:7151689810 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7151689810). Originally posted by [throny](https://github.com/throny) on 2026-11-25T03:12:12Z. --- <!-- xcl-1607-hint:D57 --> Two contributors checked independently and found that #1593 #1610 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.
JJAutoCompare commented 2026-11-25 05:08:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:02:11Z.


XCL PR #1615 focused Windows verification

Tested clean detached head 027232617e7f3223e9bf97e55d822e7a490f1055 on STOR-WINLAB. The PR changes only crates/xcl/src/hle/xgameruntime/api.rs.

AMD Ryzen 7 3800X, Intel Arc A770 with driver 32.0.101.9175, Windows 11 Enterprise Evaluation build 26200 (10.0.26200), DXC 1.9.2609.5, and rustc 1.100.0 (0ef1bc386 2026-11-09, x86_64-pc-windows-msvc). Cargo used the dev and test profiles with debug info and incremental compilation disabled.

Tested

  • cargo build --workspace succeeded.
  • cargo test --workspace --no-run compiled the workspace test executables.
  • cargo test -p xcl --lib xgameruntime -- --nocapture with XCL_ADAPTER=NONE_CPU_ONLY reported 74 passed, 0 failed, 0 ignored, 0 lines beginning SKIPPED , and 675 filtered out in 1.91 s. Counts were parsed from pr1615-focused.log. All three commands ran outside the Arc mutex.
  • query_interface_accepts_iunknown passed. IID_IUnknown returned S_OK and the same object pointer on main XUser, XSystem and XNetworking, three non-main XUser/XPackage/XSystem interfaces, and the XAsync and XAccessibility fallbacks. A null IID returned E_INVALIDARG and cleared the output on all eight objects. An unsupported IID returned E_NOINTERFACE and cleared the output on the five non-main and fallback objects.

Not tested

Execution was limited to the focused XGameRuntime tests. The full GPU workspace suite and retail-title smoke runs were omitted. Two existing tests returned early and were counted as passes by the harness. Host-backed queue coverage requires System32\xgameruntime.dll, and default audio endpoint coverage requires an available endpoint.

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 pr1615-focused.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7153389605 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7153389605). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T05:02:11Z. --- # XCL PR #1615 focused Windows verification Tested clean detached head `027232617e7f3223e9bf97e55d822e7a490f1055` on STOR-WINLAB. The PR changes only `crates/xcl/src/hle/xgameruntime/api.rs`. AMD Ryzen 7 3800X, Intel Arc A770 with driver 32.0.101.9175, Windows 11 Enterprise Evaluation build 26200 (10.0.26200), DXC 1.9.2609.5, and rustc 1.100.0 (0ef1bc386 2026-11-09, x86_64-pc-windows-msvc). Cargo used the dev and test profiles with debug info and incremental compilation disabled. **Tested** - `cargo build --workspace` succeeded. - `cargo test --workspace --no-run` compiled the workspace test executables. - `cargo test -p xcl --lib xgameruntime -- --nocapture` with `XCL_ADAPTER=NONE_CPU_ONLY` reported 74 passed, 0 failed, 0 ignored, 0 lines beginning `SKIPPED `, and 675 filtered out in 1.91 s. Counts were parsed from `pr1615-focused.log`. All three commands ran outside the Arc mutex. - `query_interface_accepts_iunknown` passed. `IID_IUnknown` returned `S_OK` and the same object pointer on main XUser, XSystem and XNetworking, three non-main XUser/XPackage/XSystem interfaces, and the XAsync and XAccessibility fallbacks. A null IID returned `E_INVALIDARG` and cleared the output on all eight objects. An unsupported IID returned `E_NOINTERFACE` and cleared the output on the five non-main and fallback objects. **Not tested** Execution was limited to the focused XGameRuntime tests. The full GPU workspace suite and retail-title smoke runs were omitted. Two existing tests returned early and were counted as passes by the harness. Host-backed queue coverage requires System32\xgameruntime.dll, and default audio endpoint coverage requires an available endpoint. **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 `pr1615-focused.log` and published.
upstream-sync closed this pull request 2026-11-25 23:07:29 +00:00
CalvyPZ commented 2026-11-25 23:09:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:41:42Z.


This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.

<!-- greyfinch-sync:ivall/xcl:comment:7176677349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7176677349). Originally posted by [CalvyPZ](https://github.com/CalvyPZ) on 2026-11-25T22:41:42Z. --- This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
upstream-sync reopened this pull request 2026-11-26 00:04:28 +00:00
github-actions[bot] commented 2026-11-29 20:44:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:44:31Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7262321197 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7262321197). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:44:31Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 06:17:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:17:34Z.


Triage (#1607) – head 0272326

#1593 (opened first) and #1610 also answer IID_IUnknown in api.rs:query_interface. Both return the class's main object, so every vtable of a class gives the same IUnknown pointer. This PR returns this, so XUser's gamertag object and the XUser main object give different IUnknown pointers. That breaks the COM identity rule, and a title comparing IUnknown pointers would see two objects.
The added clearing of *out on E_INVALIDARG is fine. The test only checks unk == obj and so does not cover identity.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302706162 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1615#issuecomment-7302706162). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:17:34Z. --- **Triage (#1607)** – head 0272326 #1593 (opened first) and #1610 also answer `IID_IUnknown` in `api.rs:query_interface`. Both return the class's main object, so every vtable of a class gives the same IUnknown pointer. This PR returns `this`, so XUser's gamertag object and the XUser main object give different IUnknown pointers. That breaks the COM identity rule, and a title comparing IUnknown pointers would see two objects. The added clearing of `*out` on `E_INVALIDARG` is fine. The test only checks `unk == obj` and so does not cover identity. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1615:upstream-pr/1615'
git switch 'upstream-pr/1615'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1615'
git switch 'upstream-pr/1615'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1615'
git switch 'upstream-pr/1615'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1615'
git switch 'main'
git merge --squash 'upstream-pr/1615'
git switch 'main'
git merge --ff-only 'upstream-pr/1615'
git switch 'main'
git merge 'upstream-pr/1615'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
xcl-dev/xcl!1605
No description provided.