Skip to content

Small fixes found running the tests and the test title under Wine - #270

Merged
ivall merged 6 commits into
ivall:mainfrom
cmt8:wine-fixes
Nov 23, 2026
Merged

ivall merged 6 commits into
ivall:mainfrom
cmt8:wine-fixes

Conversation

@cmt8

@cmt8 cmt8 commented Nov 23, 2026

Copy link
Copy Markdown

Small fixes found running the tests and the test title under Wine. More significant fixes forthcoming, especially in the GPU dept. These are from my very first test run and cross compile. The following is an AI written summary of the changes:

Small fixes to XCL found while running the workspace's test suite and the repository's own test title (tests/testtitle) under Wine, built with the GNU toolchain (x86_64-pc-windows-gnu). Only changes to XCL itself are included: no Linux scripts, documentation or other tooling. Each commit is one fix and is based on current main.

The commits

Commit What was wrong How it shows Test
kernelx: memory in use from PagefileUsage where PrivateUsage is 0 Wine's GetProcessMemoryInfo fills only the PROCESS_MEMORY_COUNTERS fields; PrivateUsage of the _EX form stays 0. TitleMemoryStatus then reported the whole budget as available and XMemGetWorkingSetStatistics a use of 0. PagefileUsage is used when PrivateUsage is 0. Wine only. On Windows PrivateUsage is filled and is still the value used. hle::kernelx::tests::title_memory_status_reports_budget (new assertion: memory in use > 0)
testgame-mw: no unit-test harness The crate has no tests. With the GNU linker its empty test harness keeps the raw-dylib import of kernelx.dll, so the exe cannot start and cargo test --workspace fails on it. test = false in its Cargo.toml. GNU toolchain only (the MSVC linker drops the unused import). The DLL is still built by cargo build --workspace. cargo test -p testgame-mw (nothing to start, exits 0)
d3d12x null device: descriptor heap start handles in rax Console code calls descriptor heap #9 / #10 (GetCPU/GPUDescriptorHandleForHeapStart) with only this and takes the handle in rax, as real.rs (heap_cpu_start_x / heap_gpu_start_x) already answers it. The null device used the PC form and wrote the handle through rdx, i.e. through whatever the caller left there. Wrong on any system where the null device is used. Under Wine 11.22 without a D3D12 device the test title runs its GPU checks on the null device; its rdx pointed into read-only .rdata and the title died with 0xC0000005 in Heap_GetHandleStart. hle::d3d12x::null::tests::heap_start_handles_come_back_in_rax (new)
xgameruntime: say what is missing without System32\xgameruntime.dll The preflight warning said task queues and networking are missing without the PC's XGameRuntime, and the log line said XTaskQueue/XAsync are unavailable. XCL uses its own XAsync / XTaskQueue / XThread then, and XNetworking is always XCL's; what is missing is the XGameUi dialogs, text entry, game invites, game streaming. The module doc is corrected the same way. Wording and comments only, levels unchanged. Any system without Gaming Services; under Wine it is printed on every run. preflight::tests::each_missing_piece_is_reported_with_a_fix (new assertion)
e2e: stage the test title under CARGO_TARGET_TMPDIR The e2e test staged its game and data folders in <repo>/target/e2e regardless of the target directory, so with CARGO_TARGET_DIR set elsewhere it still wrote into the repository. It now uses CARGO_TARGET_TMPDIR. Any system with CARGO_TARGET_DIR set elsewhere (seen under Wine 11.22). e2e test target, see below

Two other fixes from the same work were left out because current main already has an equivalent fix:

How this was tested

Everything was built and run on Linux under Wine with Rust 1.97.0 for x86_64-pc-windows-gnu (mingw-w64 GCC 13), on this branch's final commit. Wine versions: 9.0 (Ubuntu package 9.0~repack-4build3) and 11.22. Tests were run with --test-threads=1, under xvfb-run, with no GPU.

  • cargo build --workspace --target x86_64-pc-windows-gnu (workspace crates rebuilt from clean): no warnings. cargo clippy --workspace --all-targets: no lint on any changed line.
  • Results, identical on Wine 9.0 and Wine 11.22:
Tests Wine 9.0 Wine 11.22
hle::kernelx::tests:: (incl. title_memory_status_reports_budget) 17 passed 17 passed
hle::d3d12x::null::tests:: (incl. heap_start_handles_come_back_in_rax) 2 passed 2 passed
preflight::tests:: 6 passed 6 passed
hle::xgameruntime::api::tests:: 16 passed 16 passed
hle::d3d12x::frame::tests:: 4 passed 4 passed
modules::tests:: 2 passed 2 passed
cargo test -p testgame-mw exits 0 exits 0
frame::tests::statistics_name_each_frames_origin_and_rescheduled_handles_outlive_the_clock_tick, 20 separate runs 20 of 20 passed 20 of 20 passed
  • One Wine 11.22 run of the kernelx test hung before the test harness printed anything and was stopped; the rerun passed. Not looked into further.
  • e2e (cargo test -p xcl --target x86_64-pc-windows-gnu --test e2e, Wine 11.22, once, with CARGO_TARGET_DIR outside the repository): the staging folders were created in <target dir>/x86_64-pc-windows-gnu/tmp/e2e/{game,data}, and no target folder appeared in the checkout. The test itself fails in this setup: there is no D3D12 device and no Gaming Services, 13 of the title's checks that need the GPU or a real window fail, and the title ends with 0xC0000409 after a panic in gpu/tiling.rs:419 (slice index out of range) during the DirectStorage check. tiling.rs is not touched here, but the title only reaches that point now that the null device's descriptor heap crash is fixed; the panic was not investigated.

Not tested: anything on Windows, the MSVC toolchain, and anything on a GPU (there is none in this setup). CI on this PR will be the first Windows / MSVC build of these changes.

Notes for review

  • e2e: on Windows the staging folder moves from target\e2e to target\tmp\e2e (target\<triple>\tmp\e2e with --target). scripts/test.ps1 does not refer to target\e2e; anything local that looks there would need the new path. The debug-layer e2e test still uses target\e2e-debug-layer; it was not changed. CI skips test_title_runs_and_game_folder_is_untouched (ci.yml), so the new staging path is only exercised by scripts\test.ps1 on a PC.
  • Null device: Heap_GetHandleStart now has the same shape as real.rs's heap_cpu_start_x / heap_gpu_start_x (this only, handle in rax). Worth a look with the null device on Windows (no D3D12 device, or graphics = "null").
  • kernelx: PagefileUsage is read only when PrivateUsage is 0. On Windows both are the process's commit charge, so the value used there should not change; please confirm PrivateUsage is non-zero on a real title.
  • testgame-mw: test = false also skips building its (empty) test harness under MSVC; no tests are lost.

Wine's GetProcessMemoryInfo fills PROCESS_MEMORY_COUNTERS only, PrivateUsage of the _EX
form stays 0: TitleMemoryStatus reported the whole budget as available and
XMemGetWorkingSetStatistics a use of 0 (the test title's check wants more than 0).
PagefileUsage is the same number on Windows, where PrivateUsage is never 0: no change
there.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmXSjLgBbFAokwc63ad
The crate has no tests, and with the GNU toolchain (x86_64-pc-windows-gnu) the empty
harness keeps the raw-dylib import of kernelx.dll: the exe cannot start and
`cargo test --workspace` fails on it (the MSVC linker drops the unused import). The DLL
itself is built by `cargo build --workspace` as before.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmXSjLgBbFAokwc63ad
Console code calls descriptor heap ivall#9 / ivall#10 (GetCPU / GetGPUDescriptorHandleForHeapStart)
with only `this` and takes the handle in rax, as the real backend already answers it
(real.rs heap_cpu_start_x). The null device used the PC form and wrote the handle through
rdx, whatever the caller had left there. Under Wine 11.22 with no D3D12 device (no GPU),
the test title runs its GPU checks on the null device: its rdx pointed into its read-only
.rdata and the title ended with 0xC0000005 in Heap_GetHandleStart (where rdx happens to
be writable, the stray write goes unnoticed). The handle now comes back in rax and rdx is
not touched. Windows: the same for the null device (no D3D12 device or graphics = "null");
the real backend is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmXSjLgBbFAokwc63ad
The preflight warning said task queues and networking are missing without the PC's
XGameRuntime, and the runtime log line said XTaskQueue/XAsync are unavailable. XCL uses its
own XAsync / XTaskQueue / XThread then (QueryApiImpl fallback), and XNetworking is always
XCL's. What is missing is what goes to the PC runtime: the XGameUi dialogs and text entry,
game invites, game streaming and the other classes XCL does not implement. The module doc
said XNetworking goes to the PC runtime and did not say what happens without it; it now
says both. Seen under Wine, which has no xgameruntime.dll: the warning is printed on every
run. Wording and comments only, the levels are unchanged. Windows: the same text where
Gaming Services is not installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmXSjLgBbFAokwc63ad
The e2e test staged the game and data folders in <repo>/target/e2e whatever the target
directory was, so with CARGO_TARGET_DIR set elsewhere it still wrote into the repository:
seen under Wine 11.22, where a target/e2e folder appeared in the repository after an e2e
run with CARGO_TARGET_DIR pointing to another folder. Cargo hands integration tests a
scratch folder inside the target directory, CARGO_TARGET_TMPDIR; the staging is now there
(target\tmp\e2e, target\<triple>\tmp\e2e with --target). Windows: the same test, the
folder moves from target\e2e to target\tmp\e2e.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmXSjLgBbFAokwc63ad
@Kalmarv

Kalmarv commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Please tighten the null-heap regression test. Slots 9 and 10 now point to a one-argument function. The test calls them through a two-argument Rust function pointer, which violates Rust’s ABI compatibility rule even on Win64. It also passes if both slots always return 1: I made that substitution locally, and the PR test stayed green while a comparison with the heap’s stored start failed. Call each slot with its actual one-argument signature and check the exact start value. If the test must also inspect a leftover rdx, use a Win64 test shim with a writable sentinel for that check. Test · Rust function-pointer ABI rules

Tested

Windows 11 Pro 26200.9711, Ryzen 9 9950X, RTX 5070 Ti, NVIDIA 610.74, Rust 1.99 MSVC, debug. Tested PR head d54597ac7d1a4b9ae36cc240bec48ec33cc37a65 merged onto 9ab7d763197c7f420bff10cd9bf1310f07e2a9aa at 27dedcf6df22caf65c9f6c78787079ef8b9a9719. Built with cargo build --workspace and cargo test -p xcl --lib --test e2e --no-run using external target directories. Ran the binaries in the GPU queue with --test-threads=1.

Change Windows negative control and result
Null heap ABI The PR test failed on main at slot 9 because the sentinel changed. It passed on the merge.
Memory counters The PR’s budget test passed on both. During the synthetic title run, a sample of the merge’s XCL process showed 2,826,354,688 bytes in both PrivateUsage and PagefileUsage. With a local counter fixture of 0 and 48 MiB respectively, both TitleMemoryStatus and XMemGetWorkingSetStatistics reported 0 on main and 48 MiB on the merge. Both preferred 32 MiB of private usage over 48 MiB of pagefile usage when both were nonzero.
Missing Gaming Services warning The PR’s preflight assertion failed on main and passed on the merge using synthetic missing-runtime input.
Middleware test harness cargo test -p testgame-mw exited 0 on both. Main ran an empty MSVC harness. The merge omitted it and the workspace build still produced the DLL. The reported loader failure is GNU-specific.
E2E staging All three e2e tests passed on both builds. Checking the actual files distinguished the change: main staged under the checkout’s target/e2e; the merge staged under the external target’s tmp/e2e. The debug-layer test still wrote under the checkout on both.

The six unit filters passed 48/48 (kernelx 18, null 2, preflight 6, runtime API 16, frame 4, modules 2). With the three e2e tests, 51 passed, 0 failed, 0 skipped on the merge. The frame-clock control also passed in 20/20 fresh processes. Pairwise git merge-tree checks were clean against #254 (2c5fe3f), #252 (862a0d4) and #283 (94bfcf0).

Not tested

Wine, MinGW, a Windows installation without Gaming Services, the retail game, or runtime behavior of the three merge combinations.

🤖 GPT-6.2 Astra

T-Crypt added a commit to T-Crypt/bathyal that referenced this pull request Nov 23, 2026
@PHeitor1

Copy link
Copy Markdown

Tested d54597a merged onto main 9ab7d76 on RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X (Zen 3), Windows 11 Pro 26300 (native), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*. Baseline main 9ab7d76: 651 passed, 0 failed, 40 ignored.

Pass: 652 passed, 0 failed, 40 ignored. GPU skips: the same 2 as on main (no wave64).

Run and written with Claude Code (Claude Opus 5.5).

…ir real signature

The test for descriptor heap ivall#9 / ivall#10 called them through a two-argument fn pointer
(`this` plus a stray pointer) although they take only `this`: a Rust call through a fn
pointer of another signature is undefined behaviour, even where Win64 lets it pass. Its
checks were also weak: a start that is not 0 and not the stray pointer, so ivall#9 / ivall#10
returning the constant 1 still passed.

The test now creates two heaps and reads each heap's start from the object
(CreateDescriptorHeap's handle range: not 0, a different one per heap), then calls ivall#9 and
ivall#10 as `fn(this) -> u64` and wants exactly that start. On x86_64 Windows it also calls them
through a small asm shim that passes `this` in rcx and leaves a writable sentinel pointer in
rdx, as console code can: the sentinel must be unchanged and rax the exact start. Checked
under Wine: ivall#9 / ivall#10 returning 1 fails the test, and so does the old PC form that wrote the
handle through rdx. Test only, the null device is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmZMiGWQ8zSxFiGaz6b
@cmt8

cmt8 commented Nov 23, 2026

Copy link
Copy Markdown
Author

Please tighten the null-heap regression test. Slots 9 and 10 now point to a one-argument function. The test calls them through a two-argument Rust function pointer, which violates Rust’s ABI compatibility rule even on Win64. It also passes if both slots always return 1: I made that substitution locally, and the PR test stayed green while a comparison with the heap’s stored start failed. Call each slot with its actual one-argument signature and check the exact start value. If the test must also inspect a leftover rdx, use a Win64 test shim with a writable sentinel for that check. Test · Rust function-pointer ABI rules

I've posted a fix for this as a new commit in the PR

@ivall
ivall merged commit ab4324e into ivall:main Nov 23, 2026
1 check failed
@cmt8
cmt8 deleted the wine-fixes branch November 24, 2026 00:26
cmt8 added a commit to cmt8/xcl that referenced this pull request Nov 24, 2026
New section 0: scripts/linux-smoke.sh in the owner's Arch distrobox on a Radeon RX 7900 XTX
(Mesa 26.3.1, Wine 11.22, vkd3d-proton 3.1, DXVK 3.1.1), on wine-bringup rebased onto
upstream a6f5f7a, with the answers to section 5's questions in order and the log each rests
on. Every test of the binaries that aborted was re-run in its own process; all 717 results are
in docs/linux-wine/tests-gpu-radv.tsv (663 pass, 5 fail, 8 abort, 41 ignored).

What it showed: Wine uses its kernel (userfaultfd) write watch in the distrobox (no seccomp
filter), XCL's UMA import check says ok and the 4 GiB window, wave64 and mesh tests pass. The
new blocker is finding 16: vkd3d-proton 3.1 asserts that heaps, fences, resources and root
signatures handed back to it carry its own vtable, and XCL's real backend has replaced it
(real::adopt) - this ends the test title (exit 0x3), the e2e test and 8 more tests. Findings 17
and 18: v_rsq_f64 of a negative number or NaN gives 0, and v_fma_f32 (HLSL mad) is not fused.
Options for 16 are listed, none made. Presentation, submit cost and the shader cache location
were not reached.

A legend entry [ran, GPU] marks what this run observed; [read] / [guess] are changed only where
a line from it supports the statement (findings 1, 4, 7, 8, 9, "What we know now"). Section 4:
the five fixes are now upstream (PR ivall#270), the branch carries none. Section 5: the script's
three fixes from this run. Nothing was run on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmV74bPu5j5TBXjrNug
cmt8 added a commit to cmt8/xcl that referenced this pull request Nov 24, 2026
New section 0: scripts/linux-smoke.sh in the owner's Arch distrobox on a Radeon RX 7900 XTX
(Mesa 26.3.1, Wine 11.22, vkd3d-proton 3.1, DXVK 3.1.1), on wine-bringup rebased onto
upstream a6f5f7a, with the answers to section 5's questions in order and the log each rests
on. Every test of the binaries that aborted was re-run in its own process; all 717 results are
in docs/linux-wine/tests-gpu-radv.tsv (663 pass, 5 fail, 8 abort, 41 ignored).

What it showed: Wine uses its kernel (userfaultfd) write watch in the distrobox (no seccomp
filter), XCL's UMA import check says ok and the 4 GiB window, wave64 and mesh tests pass. The
new blocker is finding 16: vkd3d-proton 3.1 asserts that heaps, fences, resources and root
signatures handed back to it carry its own vtable, and XCL's real backend has replaced it
(real::adopt) - this ends the test title (exit 0x3), the e2e test and 8 more tests. Findings 17
and 18: v_rsq_f64 of a negative number or NaN gives 0, and v_fma_f32 (HLSL mad) is not fused.
Options for 16 are listed, none made. Presentation, submit cost and the shader cache location
were not reached.

A legend entry [ran, GPU] marks what this run observed; [read] / [guess] are changed only where
a line from it supports the statement (findings 1, 4, 7, 8, 9, "What we know now"). Section 4:
the five fixes are now upstream (PR ivall#270), the branch carries none. Section 5: the script's
three fixes from this run. Nothing was run on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmV74bPu5j5TBXjrNug
cmt8 added a commit to cmt8/xcl that referenced this pull request Nov 24, 2026
New section 0: scripts/linux-smoke.sh in the owner's Arch distrobox on a Radeon RX 7900 XTX
(Mesa 26.3.1, Wine 11.22, vkd3d-proton 3.1, DXVK 3.1.1), on wine-bringup rebased onto
upstream a6f5f7a, with the answers to section 5's questions in order and the log each rests
on. Every test of the binaries that aborted was re-run in its own process; all 717 results are
in docs/linux-wine/tests-gpu-radv.tsv (663 pass, 5 fail, 8 abort, 41 ignored).

What it showed: Wine uses its kernel (userfaultfd) write watch in the distrobox (no seccomp
filter), XCL's UMA import check says ok and the 4 GiB window, wave64 and mesh tests pass. The
new blocker is finding 16: vkd3d-proton 3.1 asserts that heaps, fences, resources and root
signatures handed back to it carry its own vtable, and XCL's real backend has replaced it
(real::adopt) - this ends the test title (exit 0x3), the e2e test and 8 more tests. Findings 17
and 18: v_rsq_f64 of a negative number or NaN gives 0, and v_fma_f32 (HLSL mad) is not fused.
Options for 16 are listed, none made. Presentation, submit cost and the shader cache location
were not reached.

A legend entry [ran, GPU] marks what this run observed; [read] / [guess] are changed only where
a line from it supports the statement (findings 1, 4, 7, 8, 9, "What we know now"). Section 4:
the five fixes are now upstream (PR ivall#270), the branch carries none. Section 5: the script's
three fixes from this run. Nothing was run on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmV74bPu5j5TBXjrNug
cmt8 added a commit to cmt8/xcl that referenced this pull request Nov 24, 2026
New section 0: scripts/linux-smoke.sh in the owner's Arch distrobox on a Radeon RX 7900 XTX
(Mesa 26.3.1, Wine 11.22, vkd3d-proton 3.1, DXVK 3.1.1), on wine-bringup rebased onto
upstream a6f5f7a, with the answers to section 5's questions in order and the log each rests
on. Every test of the binaries that aborted was re-run in its own process; all 717 results are
in docs/linux-wine/tests-gpu-radv.tsv (663 pass, 5 fail, 8 abort, 41 ignored).

What it showed: Wine uses its kernel (userfaultfd) write watch in the distrobox (no seccomp
filter), XCL's UMA import check says ok and the 4 GiB window, wave64 and mesh tests pass. The
new blocker is finding 16: vkd3d-proton 3.1 asserts that heaps, fences, resources and root
signatures handed back to it carry its own vtable, and XCL's real backend has replaced it
(real::adopt) - this ends the test title (exit 0x3), the e2e test and 8 more tests. Findings 17
and 18: v_rsq_f64 of a negative number or NaN gives 0, and v_fma_f32 (HLSL mad) is not fused.
Options for 16 are listed, none made. Presentation, submit cost and the shader cache location
were not reached.

A legend entry [ran, GPU] marks what this run observed; [read] / [guess] are changed only where
a line from it supports the statement (findings 1, 4, 7, 8, 9, "What we know now"). Section 4:
the five fixes are now upstream (PR ivall#270), the branch carries none. Section 5: the script's
three fixes from this run. Nothing was run on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019twRmV74bPu5j5TBXjrNug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants