Build: gate Windows-only paths so the workspace builds and tests on Linux #235

Closed
github-bot wants to merge 23 commits from gh-pr/235/head into gh-pr/235/base
Owner

@⁠SkippySteve on GitHub · 2026-11-24 01:41 UTC · original
linux-workspace-gates → main · +2301 −18 · 25 files · 23 commits · closed without merging

Makes the workspace check, build and test on x86_64-unknown-linux-gnu. Closes #90.

Credit and context

This is the approach from #39 by @⁠LaunchDoesntCode, rebased as a minimal change onto main (merged up to 58fed37). #39 was marked superseded by #112, which is the larger effort (Linux workspace, contributor setup, CI and a bulk cargo fmt). It currently conflicts with main. This PR doesn't replace #112. It only adds the cfg gates, so main builds and tests on Linux now and #112 can rebase onto it or drop the overlapping parts.

Changes

  • cfg(windows) gates on the remaining Windows-only paths:

    • view_format (D3D12 host copy) in victory-gpu
    • the xgameui host dialog
    • the xmem allocator hookup in D3D12XCreateDevice
    • XLaunchNewGame's relaunch
  • apps/victory/src/translate.rs: on non-Windows hosts, the validator and pipeline checks use an off-host stub that reports them as unavailable.

  • Tests that parse their own test binary as PE, or that depend on Windows path rules, run on Windows only.

  • No cfg-induced warnings on Linux. Once the host paths are gated, a Linux build warned about imports, helpers and console-side state that only those paths use:

    • victory-gpu: off Windows only, dead_code, unused_variables and unused_mut are allowed crate-wide, because the host halves of the objects are gated out there. The OnceLock import and the fence/root test modules (every test in them calls host D3D12) are gated.
    • victory-hle: gates the put import in display, the w test helper in kernel, and XLaunchNewGame's park loop (unreachable after exit off Windows). It also allows the Linux-only unused mut in modules::all and the unused host::function.
    • victory: gates the anyhow::Context import that only run uses.
  • Windows behaviour doesn't change. Every change is a cfg gate or a non-Windows stub. victory run on Linux still bails with "running titles requires Windows".

  • .github/workflows/ci.yml: a linux job on ubuntu-latest next to the Windows one. It runs cargo check --workspace --all-targets --all-features --locked and cargo test --workspace --locked, so a Windows-only path that leaks into shared code fails on the PR that adds it. It needs no titles or game files. It doesn't run clippy with -D warnings yet: two unused test imports in victory-shader/src/emit/mod.rs warn on Linux, and #326 already removes them.

Test plan

Arch Linux, x86_64-unknown-linux-gnu:

  • cargo check --workspace
  • cargo build --workspace
  • cargo test --workspace: 162 passed, 0 failed, 3 ignored
  • cargo clippy --workspace --all-targets (with or without --all-features) shows no errors and one warning: constant_color in victory-shader/src/emit/mod.rs is never used. This PR deliberately doesn't gate that helper. #326 (which folds in #262) keeps it on every host and adds the hermetic constant_color_is_a_well_formed_container test, which clears the warning. Before this PR, Linux showed about 30 warnings.
  • cargo xwin clippy --workspace --all-targets --target x86_64-pc-windows-msvc: no new warnings. The two that remain (gpu/host.rs safety comment, hle/xmem.rs field reassign) are in untouched files and are also on main.
  • cargo fmt --check fails on main in about 30 files that this PR doesn't touch. #112 does the bulk format, so this PR leaves them alone and adds no new drift.
  • Windows build: cargo xwin build --workspace and -p victory --release for x86_64-pc-windows-msvc pass with no warnings, and the workspace test binaries compile (--no-run). See the comment below.
  • Windows test binaries run under Wine (UMU-Proton 11.0): 257 passed, 7 failed, 4 ignored. That matches main exactly, and the 7 failures are Wine/vkd3d or harness gaps (#128, #170, among others). See #235
  • Native Windows or CI run (still not done)
**@⁠SkippySteve** on GitHub · 2026-11-24 01:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/235) `linux-workspace-gates` → `main` · +2301 −18 · 25 files · 23 commits · closed without merging Makes the workspace check, build and test on `x86_64-unknown-linux-gnu`. Closes #90. ## Credit and context This is the approach from #39 by @⁠LaunchDoesntCode, rebased as a minimal change onto `main` (merged up to `58fed37`). #39 was marked superseded by #112, which is the larger effort (Linux workspace, contributor setup, CI and a bulk `cargo fmt`). It currently conflicts with `main`. This PR doesn't replace #112. It only adds the `cfg` gates, so `main` builds and tests on Linux now and #112 can rebase onto it or drop the overlapping parts. ## Changes - `cfg(windows)` gates on the remaining Windows-only paths: - `view_format` (D3D12 host copy) in `victory-gpu` - the xgameui host dialog - the xmem allocator hookup in `D3D12XCreateDevice` - `XLaunchNewGame`'s relaunch - `apps/victory/src/translate.rs`: on non-Windows hosts, the validator and pipeline checks use an off-host stub that reports them as unavailable. - Tests that parse their own test binary as PE, or that depend on Windows path rules, run on Windows only. - No `cfg`-induced warnings on Linux. Once the host paths are gated, a Linux build warned about imports, helpers and console-side state that only those paths use: - `victory-gpu`: off Windows only, `dead_code`, `unused_variables` and `unused_mut` are allowed crate-wide, because the host halves of the objects are gated out there. The `OnceLock` import and the fence/root test modules (every test in them calls host D3D12) are gated. - `victory-hle`: gates the `put` import in `display`, the `w` test helper in `kernel`, and `XLaunchNewGame`'s park loop (unreachable after `exit` off Windows). It also allows the Linux-only unused `mut` in `modules::all` and the unused `host::function`. - `victory`: gates the `anyhow::Context` import that only `run` uses. - Windows behaviour doesn't change. Every change is a `cfg` gate or a non-Windows stub. `victory run` on Linux still bails with "running titles requires Windows". - `.github/workflows/ci.yml`: a `linux` job on `ubuntu-latest` next to the Windows one. It runs `cargo check --workspace --all-targets --all-features --locked` and `cargo test --workspace --locked`, so a Windows-only path that leaks into shared code fails on the PR that adds it. It needs no titles or game files. It doesn't run clippy with `-D warnings` yet: two unused test imports in `victory-shader/src/emit/mod.rs` warn on Linux, and #326 already removes them. ## Test plan Arch Linux, x86_64-unknown-linux-gnu: - [x] `cargo check --workspace` - [x] `cargo build --workspace` - [x] `cargo test --workspace`: 162 passed, 0 failed, 3 ignored - [x] `cargo clippy --workspace --all-targets` (with or without `--all-features`) shows no errors and one warning: `constant_color` in `victory-shader/src/emit/mod.rs` is never used. This PR deliberately doesn't gate that helper. #326 (which folds in #262) keeps it on every host and adds the hermetic `constant_color_is_a_well_formed_container` test, which clears the warning. Before this PR, Linux showed about 30 warnings. - [x] `cargo xwin clippy --workspace --all-targets --target x86_64-pc-windows-msvc`: no new warnings. The two that remain (`gpu/host.rs` safety comment, `hle/xmem.rs` field reassign) are in untouched files and are also on `main`. - [ ] `cargo fmt --check` fails on `main` in about 30 files that this PR doesn't touch. #112 does the bulk format, so this PR leaves them alone and adds no new drift. - [x] Windows build: `cargo xwin build --workspace` and `-p victory --release` for `x86_64-pc-windows-msvc` pass with no warnings, and the workspace test binaries compile (`--no-run`). See the comment below. - [x] Windows test binaries run under Wine (UMU-Proton 11.0): 257 passed, 7 failed, 4 ignored. That matches `main` exactly, and the 7 failures are Wine/vkd3d or harness gaps (#128, #170, among others). See https://git.gtahub.st/github/Marvisak--VIctory/pulls/235 - [ ] Native Windows or CI run (still not done)
Gate the remaining Windows-only paths so the workspace checks, builds and
tests on x86_64-unknown-linux-gnu: view_format (D3D12 host copy), the
xgameui host dialog, the xmem allocator hookup in D3D12XCreateDevice,
XLaunchNewGame's relaunch, and translate's validator/pipeline checks
(stubbed as unavailable). Tests that parse their own test binary as PE or
rely on Windows path rules run on Windows only.

victory run still bails with 'running titles requires Windows'.
With the host paths gated, a Linux build warned about the imports,
helpers and console-side state only those paths use. Gate or allow them
off Windows so `cargo clippy --workspace --all-targets` on Linux reports
only real issues:

- victory-gpu: off Windows, allow dead_code/unused_variables/unused_mut
  crate-wide (the host halves of the objects are gated out); gate the
  OnceLock import and the host-only fence/root test modules.
- victory-hle: gate the `put` import in display, the `w` test helper,
  and XLaunchNewGame's park loop (unreachable after exit off Windows);
  allow the unused `mut` in modules::all and the unused host::function.
- victory: gate the anyhow::Context import used only by `run`.

Windows behaviour and Windows warnings are unchanged.
The emit tests' Attr and Shader imports are used only by the host-validated
(cfg(windows)) tests; gate them with those tests so clippy -D warnings is
clean on Linux, and run the Linux job as clippy rather than a plain check.
The own-binary tests are Windows-only; a hand-built PE32+ title (import,
TLS callback with its DIR64 relocation, bound imports, FORCE_INTEGRITY,
checksum) exercises prepare() on Linux, and the synthetic image covers the
RVA mapping, 4 GiB overflow and machine/PE32 rejections.
The kernel tests for GetModuleFileName and title/pseudo-module lookup use
Windows paths and are gated; these repeat them with Unix paths, adding the
exact-fit/zero-size buffer and forgotten-image edges, every as-data load
flag, a mismatched extension, and pseudo-module GetProcAddress by name and
ordinal.
The pass-through and own-binary import-size tests are gated to Windows.
These check, on any host, that our overrides answer before the policy at
any API-set version and case, that allowed DLLs go Missing with no host,
the policy's exact/prefix/case rules, and that a recorded import size of
zero, one descriptor short or padded all patch to the same terminator.
Formatting the crates touched unrelated sources; restore them.
The synthetic PE gains a delay-import descriptor (its own IAT, checked
against SizeOfImage like the ordinary one), forwarders by name and by
ordinal, the relocation/exception/load-config directory flags with
RELOCS_STRIPPED, every subsystem name, and the CodeView symbol key.
The storage test mounts a drive and is gated to Windows. This one checks,
on any host, that the path calls fail untouched without a drive, that used
space counts files at any depth but not links (a loop ends, an outside
target is not charged), the exact-rest prompt grant, and a quota shrunk
under saved data, set to zero, or a storage path naming a file.
The display test takes a host power request and is gated to Windows. This
one checks, on any host, that each display pair resolves to its object and
crossed pairs do not, that HDR stays SDR for any preference without
writing the info, that URIs and screenshots fail as unsupported, that the
shell table ends at the launch slot off Windows, and that the diagnostic
capture slots are unimplemented rather than crashes.
Off Windows, `run` refuses a title for every console and unimplemented
mode before reading it, and `translate` refuses validation and pipelines
before walking while translation alone still walks unreadable roots. The
host stand-ins (validator, device, stub vertex shader, every pipeline kind)
each report themselves unavailable.
Off Windows the host source reports every pad slot empty and no key down,
and rumble is a no-op, so a hub over it connects only the keyboard and its
idle stand-in pad: the four pad slots answer disconnected, the stand-in
reads at rest and the keyboard reads no keys.
The device-type key was gated to Windows whole, though only its fallthrough
to the host's advapi32 needs Windows. Off Windows there is no host registry
behind our key: other keys are missing and handles we never gave out are
refused. The key's tests now run on any host, with new edges for size-only,
type-only and data-without-size probes, a null value name and a null subkey.
Co-authored-by: Cursor <[email protected]>
The host-only paths stay gated; these cover argument refusals for device
creation, tiled page-pool registration, committed and address-backed
resources, and null pipeline descriptions on any host.

Co-authored-by: Cursor <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:55:53 +00:00
github-bot closed this pull request 2026-11-26 03:55:53 +00:00
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 01:43 UTC · original

Windows target check at head fb59109, cross-compiled from Arch Linux with cargo-xwin (MSVC CRT/SDK via xwin):

Command Result
cargo xwin build -p victory --release --target x86_64-pc-windows-msvc ✅ Finished, 0 warnings, produces a PE32+ x86-64 victory.exe
cargo xwin build --workspace --target x86_64-pc-windows-msvc ✅ Finished, 0 warnings, 0 errors
cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-run ✅ All 13 test binaries compile, including the Windows-only tests this PR gates (victory-loader load_probe / no_dll_planting, victory-pe, victory-gpu, victory-hle)

So the Windows side of every cfg(windows) gate still compiles cleanly. I compiled the tests but didn't run them, because this machine has no Wine. A native Windows cargo test --workspace (or CI) would still be needed to confirm runtime behaviour, though the PR only adds cfg gates and doesn't change any Windows code paths.

**@⁠SkippySteve** on GitHub · 2026-11-24 01:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7119388110) Windows target check at head `fb59109`, cross-compiled from Arch Linux with `cargo-xwin` (MSVC CRT/SDK via xwin): | Command | Result | |---|---| | `cargo xwin build -p victory --release --target x86_64-pc-windows-msvc` | ✅ Finished, 0 warnings, produces a PE32+ x86-64 `victory.exe` | | `cargo xwin build --workspace --target x86_64-pc-windows-msvc` | ✅ Finished, 0 warnings, 0 errors | | `cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-run` | ✅ All 13 test binaries compile, including the Windows-only tests this PR gates (`victory-loader` `load_probe` / `no_dll_planting`, `victory-pe`, `victory-gpu`, `victory-hle`) | So the Windows side of every `cfg(windows)` gate still compiles cleanly. I compiled the tests but didn't run them, because this machine has no Wine. A native Windows `cargo test --workspace` (or CI) would still be needed to confirm runtime behaviour, though the PR only adds `cfg` gates and doesn't change any Windows code paths.
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 01:48 UTC · original

Windows test binaries under Wine (UMU-Proton 11.0-2e)

I ran the x86_64-pc-windows-msvc workspace test binaries under Proton's Wine (wine-11.0). I ran the same binaries from main (d2a4bae) to compare. This is Wine, not native Windows, so it doesn't replace a native or CI run.

Setup: cargo xwin test --no-run --target x86_64-pc-windows-msvc --workspace on fb59109. Each .exe ran under files/bin/wine from its crate directory, in a fresh prefix. The bare Wine prefix has no D3D12 runtime, so I copied in the DLLs the Proton launcher normally installs: DXVK dxgi/d3d11/d3d10core, vkd3d-proton d3d12/d3d12core, and Wine's libvkd3d*. I ran with WINEDLLOVERRIDES=dxgi,d3d11,d3d10core,d3d12,d3d12core=n,b. GPU: RTX 2060 SUPER. No titles or game assets were used.

Result: 257 passed, 7 failed, 4 ignored, the same as main. The same 7 tests fail on both, so this PR adds no regressions under Wine.

binary PR #235 main
victory-core 8 ok 8 ok
victory-formats 20 ok, 3 ignored same
victory-game 2 ok same
victory-pe 7 ok same
victory-pipeline 3 ok same
victory-loader (lib) 18 ok same
victory-loader load_probe 1 ok, 1 fail same
victory-shader 68 ok, 1 fail same
victory-gpu 40 ok, 3 fail, 1 ignored same
victory-hle (lib) 85 ok, 1 fail same
victory-hle no_dll_planting 1 ok same
victory (app) 1 ok same
xtask 3 ok, 1 fail same

Failures. They come from Wine or the test harness, and none of them is in code this PR touches:

  • victory-gpu indirect::tests::argument_clamp_builds: #170, the argument clamp doesn't compile on vkd3d.
  • victory-gpu resource::tests::buffer_data_reaches_the_host_texture: reads back zeros. This looks like #128, where deferred uploads are skipped under Wine/vkd3d.
  • victory-gpu pipeline::library::tests::a_rejected_blob_gives_an_empty_library and victory-shader emit::tests::stub_pipeline_is_created: vkd3d-proton accepts blobs or digests that native D3D12 rejects, for example a zeroed DXIL digest.
  • victory-hle modules::net::tests::only_loopback_is_reachable: Wine's ws2_32.dll lacks WSAConnectByList.
  • victory-loader load_probe::loads_binds_and_calls_probe: the test runs cargo with a Linux CARGO_MANIFEST_DIR joined with \..\.., so the host cargo can't find the manifest. This only happens when cross-compiling.
  • xtask policy::tests::repository_passes_policy: there's no git on the Wine PATH.

I'm ticking the Windows-tests item with the note "under Wine". A native Windows or CI run is still worth doing before merge.

**@⁠SkippySteve** on GitHub · 2026-11-24 01:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7119471652) ## Windows test binaries under Wine (UMU-Proton 11.0-2e) I ran the `x86_64-pc-windows-msvc` workspace test binaries under Proton's Wine (`wine-11.0`). I ran the same binaries from `main` (`d2a4bae`) to compare. This is **Wine, not native Windows**, so it doesn't replace a native or CI run. **Setup:** `cargo xwin test --no-run --target x86_64-pc-windows-msvc --workspace` on `fb59109`. Each `.exe` ran under `files/bin/wine` from its crate directory, in a fresh prefix. The bare Wine prefix has no D3D12 runtime, so I copied in the DLLs the Proton launcher normally installs: DXVK `dxgi`/`d3d11`/`d3d10core`, vkd3d-proton `d3d12`/`d3d12core`, and Wine's `libvkd3d*`. I ran with `WINEDLLOVERRIDES=dxgi,d3d11,d3d10core,d3d12,d3d12core=n,b`. GPU: RTX 2060 SUPER. No titles or game assets were used. **Result: 257 passed, 7 failed, 4 ignored, the same as `main`.** The same 7 tests fail on both, so this PR adds no regressions under Wine. | binary | PR #235 | main | |---|---|---| | victory-core | 8 ok | 8 ok | | victory-formats | 20 ok, 3 ignored | same | | victory-game | 2 ok | same | | victory-pe | 7 ok | same | | victory-pipeline | 3 ok | same | | victory-loader (lib) | 18 ok | same | | victory-loader `load_probe` | 1 ok, 1 fail | same | | victory-shader | 68 ok, 1 fail | same | | victory-gpu | 40 ok, 3 fail, 1 ignored | same | | victory-hle (lib) | 85 ok, 1 fail | same | | victory-hle `no_dll_planting` | 1 ok | same | | victory (app) | 1 ok | same | | xtask | 3 ok, 1 fail | same | **Failures. They come from Wine or the test harness, and none of them is in code this PR touches:** - `victory-gpu indirect::tests::argument_clamp_builds`: #170, the argument clamp doesn't compile on vkd3d. - `victory-gpu resource::tests::buffer_data_reaches_the_host_texture`: reads back zeros. This looks like #128, where deferred uploads are skipped under Wine/vkd3d. - `victory-gpu pipeline::library::tests::a_rejected_blob_gives_an_empty_library` and `victory-shader emit::tests::stub_pipeline_is_created`: vkd3d-proton accepts blobs or digests that native D3D12 rejects, for example a zeroed DXIL digest. - `victory-hle modules::net::tests::only_loopback_is_reachable`: Wine's `ws2_32.dll` lacks `WSAConnectByList`. - `victory-loader load_probe::loads_binds_and_calls_probe`: the test runs `cargo` with a Linux `CARGO_MANIFEST_DIR` joined with `\..\..`, so the host cargo can't find the manifest. This only happens when cross-compiling. - `xtask policy::tests::repository_passes_policy`: there's no `git` on the Wine `PATH`. I'm ticking the Windows-tests item with the note "under Wine". A native Windows or CI run is still worth doing before merge.
Author
Owner

@⁠CesarLopesO on GitHub · 2026-11-24 01:56 UTC · original

Independent Linux validation — Debian 13

I tested this PR on a separate Debian 13 (Trixie) machine.

Environment

  • OS: Debian GNU/Linux 13 (Trixie)
  • rustc: 1.98.1 (48a229cea 2026-09-01)
  • cargo: 1.98.1 (797e8a9bc 2026-08-05)
  • Tested commit: fb59109

Command

cargo test --workspace --locked

Result: 162 passed, 0 failed, 3 ignored.

The workspace compiled and all runnable tests completed successfully. The build emitted compiler warnings, including unused/dead-code warnings and an unreachable-expression warning in crates/victory-hle/src/modules/xgame.rs:94, but no compilation errors.

No game files or game data were used.

Thanks for the Linux portability work!

**@⁠CesarLopesO** on GitHub · 2026-11-24 01:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7119605395) ## Independent Linux validation — Debian 13 I tested this PR on a separate Debian 13 (Trixie) machine. **Environment** - OS: Debian GNU/Linux 13 (Trixie) - rustc: 1.98.1 (48a229cea 2026-09-01) - cargo: 1.98.1 (797e8a9bc 2026-08-05) - Tested commit: `fb59109` **Command** ```sh cargo test --workspace --locked ``` **Result:** 162 passed, 0 failed, 3 ignored. The workspace compiled and all runnable tests completed successfully. The build emitted compiler warnings, including unused/dead-code warnings and an unreachable-expression warning in `crates/victory-hle/src/modules/xgame.rs:94`, but no compilation errors. No game files or game data were used. Thanks for the Linux portability work!
Author
Owner

@⁠LazyHatGuy on GitHub · 2026-11-24 02:54 UTC · original

I have verified #235 on Garuda Linux

Environment

  • Commit: 16704a564b88d7e2b6b5f0e34c7c375c2b25b0c5
  • OS: Garuda Linux x86_64
  • Kernel: Linux 7.3.5-zen1-1-zen
rustc --version
rustc 1.100.0 (0ef1bc386 2026-11-09) (Arch Linux rust 1:1.100.0-1)
rustc --version
rustc 1.100.0 (0ef1bc386 2026-11-09) (Arch Linux rust 1:1.100.0-1)

Results

  • cargo fmt --all -- --check -> Reports format issues
  • cargo-summary test --workspace --locked -> TEST OK total=165 passed=162 failed=0 ignored=3 in 5.6s
  • cargo xtask policy -> asset policy: 151 files ok
  • cargo xtask policy --staged -> asset policy: 0 files ok
**@⁠LazyHatGuy** on GitHub · 2026-11-24 02:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7120591108) I have verified #235 on Garuda Linux ### Environment - Commit: `16704a564b88d7e2b6b5f0e34c7c375c2b25b0c5` - OS: Garuda Linux x86_64 - Kernel: Linux 7.3.5-zen1-1-zen ```shell rustc --version rustc 1.100.0 (0ef1bc386 2026-11-09) (Arch Linux rust 1:1.100.0-1) ``` ```shell rustc --version rustc 1.100.0 (0ef1bc386 2026-11-09) (Arch Linux rust 1:1.100.0-1) ``` ### Results - `cargo fmt --all -- --check` -> Reports format issues - `cargo-summary test --workspace --locked` -> TEST OK total=165 passed=162 failed=0 ignored=3 in 5.6s - `cargo xtask policy` -> asset policy: 151 files ok - `cargo xtask policy --staged` -> asset policy: 0 files ok
Author
Owner

@⁠pedrofort on GitHub · 2026-11-24 03:20 UTC · original

Independent Apple Silicon validation

Tested on Apple M5, macOS 27.2.1, native ARM64, Rust 1.98.1.

Commit tested: 16704a5.

Check | Result -- | -- Main branch workspace check | FAIL PR workspace check | PASS Workspace build | PASS Workspace tests | 162 passed, 0 failed, 3 ignored Native CLI execution | PASS Empty-directory shader-info | PASS Empty-directory translate | PASS Asset policy | 151 files OK

The resulting executable is a native Mach-O 64-bit ARM64 binary.

This confirms that the portability changes also enable the offline tools and runnable workspace tests on Apple Silicon, without Rosetta, Wine or virtualization.

No game files were used. Title execution and GPU rendering were not tested.

Thanks for the portability work!

**@⁠pedrofort** on GitHub · 2026-11-24 03:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7121000647) <h2><span>Independent Apple Silicon validation</span></h2><p><span>Tested on Apple M5, macOS 27.2.1, native ARM64, Rust 1.98.1.</span></p><p><span>Commit tested: </span><code><span>16704a5</span></code><span>.</span></p> Check | Result -- | -- Main branch workspace check | FAIL PR workspace check | PASS Workspace build | PASS Workspace tests | 162 passed, 0 failed, 3 ignored Native CLI execution | PASS Empty-directory shader-info | PASS Empty-directory translate | PASS Asset policy | 151 files OK <p><span>The resulting executable is a native Mach-O 64-bit ARM64 binary.</span></p><p><span>This confirms that the portability changes also enable the offline tools and runnable workspace tests on Apple Silicon, without Rosetta, Wine or virtualization.</span></p><p><span>No game files were used. Title execution and GPU rendering were not tested.</span></p><p><span>Thanks for the portability work!</span></p>
Author
Owner

@⁠0xKaji on GitHub · 2026-11-24 14:14 UTC · original

Found a deadlock + 3 test failures in victory-gpu::queue::host_free_tests when running cargo test --workspace on Linux (CachyOS x86_64, rustc 1.98.1, cargo test --workspace --no-fail-fast, no game data; PR #235 head=5d40ad817c).

Failure output

test queue::host_free_tests::fence_waits_complete_without_blocking_the_queue ... FAILED
test queue::host_free_tests::page_mapping_batches_run_through_the_runtime_mapper ... FAILED
test queue::host_free_tests::present_succeeds_without_copying_to_a_window ... FAILED
test queue::host_free_tests::timestamp_frequency_refuses_null_and_reports_the_rate has been running for over 60 seconds

Note: because device::tests::newer_device_levels_are_the_same_device sorts before queue::host_free_tests::* and mutates process-global state, parallel runs (cargo test) can trigger this depending on thread scheduling (which may explain why other Linux runs passed), whereas sequential execution (cargo test -p victory-gpu -- --test-threads=1) runs device::tests::* before queue::host_free_tests::*.

Root cause

  1. device::tests::newer_device_levels_are_the_same_device (crates/victory-gpu/src/device.rs:461) calls create_as(&LEVEL_IIDS[8]), which flips the process-global atomic device::NEWER (device.rs:153-155) to true.
  2. From that point on, queue::create (crates/victory-gpu/src/queue.rs:57-61) constructs queues with &NEWER_FUNCTIONS, shifting every method at slot >= 14 (0x70+) by +2 slots (+0x10 bytes):
    • signal: 0x70 -> 0x80
    • wait: 0x78 -> 0x88
    • timestamp_frequency: 0x80 -> 0x90
    • copy_page_mappings: 0xe8 -> 0xf8
    • present: 0xf0 -> 0x100
    • signal2_x: 0x100 -> 0x110
  3. queue::tests::queue_signals_complete_at_once already accounts for this with signal_slot(q) (queue.rs:472-480: "Another test may switch layouts while this one runs, so the queue's own table decides"), but queue::host_free_tests hardcodes the pre-newer vtable byte offsets:
    • In timestamp_frequency_refuses_null_and_reports_the_rate (queue.rs:576), slot::<Freq>(q, 0x80) dispatches to queue::signal(q, fence, value) instead of timestamp_frequency. freq(q, ptr::null_mut()) accidentally returns E_INVALIDARG (fence.is_null()), and then freq(q, &mut out) passes &mut out (a stack u64) as fence: This into crate::fence::signal, which dereferences &Fence on stack memory and locks fence.waiters (UB / infinite hang).
    • In the other three host_free_tests, 0x78 / 0xf0 / 0xe8 hit missing table slots (E_NOTIMPL) and 0x100 dispatches to present instead of signal2_x.

Suggested fix

Generalize queue::tests::signal_slot into a shared helper (e.g. slot_for(q: This, old_offset: usize) -> usize) that inspects q's own vtable pointer (table == NEWER_FUNCTIONS.0.as_ptr()) and shifts old_offset >= 0x70 by +0x10 bytes, and use it in queue::host_free_tests (0x80, 0x78, 0x100, 0xf0, 0xe8) — or invoke the queue's Rust handlers directly in host_free_tests.

**@⁠0xKaji** on GitHub · 2026-11-24 14:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7134068705) Found a deadlock + 3 test failures in `victory-gpu::queue::host_free_tests` when running `cargo test --workspace` on Linux (`CachyOS x86_64`, `rustc 1.98.1`, `cargo test --workspace --no-fail-fast`, no game data; PR #235 `head=5d40ad817c`). ### Failure output ``` test queue::host_free_tests::fence_waits_complete_without_blocking_the_queue ... FAILED test queue::host_free_tests::page_mapping_batches_run_through_the_runtime_mapper ... FAILED test queue::host_free_tests::present_succeeds_without_copying_to_a_window ... FAILED test queue::host_free_tests::timestamp_frequency_refuses_null_and_reports_the_rate has been running for over 60 seconds ``` Note: because `device::tests::newer_device_levels_are_the_same_device` sorts before `queue::host_free_tests::*` and mutates process-global state, parallel runs (`cargo test`) can trigger this depending on thread scheduling (which may explain why other Linux runs passed), whereas sequential execution (`cargo test -p victory-gpu -- --test-threads=1`) runs `device::tests::*` before `queue::host_free_tests::*`. ### Root cause 1. `device::tests::newer_device_levels_are_the_same_device` (`crates/victory-gpu/src/device.rs:461`) calls `create_as(&LEVEL_IIDS[8])`, which flips the process-global atomic `device::NEWER` (`device.rs:153-155`) to `true`. 2. From that point on, `queue::create` (`crates/victory-gpu/src/queue.rs:57-61`) constructs queues with `&NEWER_FUNCTIONS`, shifting every method at `slot >= 14` (`0x70+`) by `+2` slots (`+0x10` bytes): - `signal`: `0x70 -> 0x80` - `wait`: `0x78 -> 0x88` - `timestamp_frequency`: `0x80 -> 0x90` - `copy_page_mappings`: `0xe8 -> 0xf8` - `present`: `0xf0 -> 0x100` - `signal2_x`: `0x100 -> 0x110` 3. `queue::tests::queue_signals_complete_at_once` already accounts for this with `signal_slot(q)` (`queue.rs:472-480`: *"Another test may switch layouts while this one runs, so the queue's own table decides"*), but `queue::host_free_tests` hardcodes the pre-`newer` vtable byte offsets: - In `timestamp_frequency_refuses_null_and_reports_the_rate` (`queue.rs:576`), `slot::<Freq>(q, 0x80)` dispatches to **`queue::signal(q, fence, value)`** instead of `timestamp_frequency`. `freq(q, ptr::null_mut())` accidentally returns `E_INVALIDARG` (`fence.is_null()`), and then `freq(q, &mut out)` passes `&mut out` (a stack `u64`) as `fence: This` into `crate::fence::signal`, which dereferences `&Fence` on stack memory and locks `fence.waiters` (UB / infinite hang). - In the other three `host_free_tests`, `0x78` / `0xf0` / `0xe8` hit missing table slots (`E_NOTIMPL`) and `0x100` dispatches to `present` instead of `signal2_x`. ### Suggested fix Generalize `queue::tests::signal_slot` into a shared helper (e.g. `slot_for(q: This, old_offset: usize) -> usize`) that inspects `q`'s own vtable pointer (`table == NEWER_FUNCTIONS.0.as_ptr()`) and shifts `old_offset >= 0x70` by `+0x10` bytes, and use it in `queue::host_free_tests` (`0x80`, `0x78`, `0x100`, `0xf0`, `0xe8`) — or invoke the queue's Rust handlers directly in `host_free_tests`.
Author
Owner

@⁠elgreams on GitHub · 2026-11-24 15:07 UTC · original

Tested 5d40ad817 on Linux Mint 22.1, rustc 1.98.1: the workspace builds, and every crate passes except victory-gpu. There, 3 of the new queue::host_free_tests fail and timestamp_frequency_refuses_null_and_reports_the_rate hangs, but only when they run after device::tests::newer_device_levels_are_the_same_device. Each one passes alone.

That test creates the device as ID3D12Device11, which sets the global NEWER flag (device.rs:154). Queues created after it use the newer layout, so the fixed offsets in host_free_tests (0x78, 0x80, 0x100…) land on different methods. Going through newer_slot / crate::device::newer(), or not sharing the flag between tests, should fix it. Repro and the other Linux PRs' results: #90

**@⁠elgreams** on GitHub · 2026-11-24 15:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7135507787) Tested `5d40ad817` on Linux Mint 22.1, rustc 1.98.1: the workspace builds, and every crate passes except `victory-gpu`. There, 3 of the new `queue::host_free_tests` fail and `timestamp_frequency_refuses_null_and_reports_the_rate` hangs, but only when they run after `device::tests::newer_device_levels_are_the_same_device`. Each one passes alone. That test creates the device as `ID3D12Device11`, which sets the global `NEWER` flag (`device.rs:154`). Queues created after it use the newer layout, so the fixed offsets in `host_free_tests` (0x78, 0x80, 0x100…) land on different methods. Going through `newer_slot` / `crate::device::newer()`, or not sharing the flag between tests, should fix it. Repro and the other Linux PRs' results: https://git.gtahub.st/github/Marvisak--VIctory/issues/90
Author
Owner

@⁠ramenbellic on GitHub · 2026-11-24 17:38 UTC · original

Tested 5d40ad8 on Bazzite (kernel 7.3.4, Ryzen 5 5600X, rustc 1.98.1), no game data.

  • cargo check --workspace --all-targets --all-features --locked: passes, 0 warnings.
  • cargo test --workspace --locked --no-fail-fast: hangs in 3 of 3 runs. Everything except victory-gpu passes (226 passed, 0 failed, 5 ignored).
  • cargo test -p victory-gpu: hangs in 6 of 6 runs here (5 parallel, 1 with --test-threads=1), so on this machine it is not scheduling-dependent. 41 pass, the same three queue::host_free_tests fail as reported above, and timestamp_frequency_refuses_null_and_reports_the_rate never returns.
  • With --skip newer_device_levels_are_the_same_device: 44 passed, 0 failed, parallel and single-threaded. That supports @⁠elgreams' reading that the global NEWER flag set by that test is the cause.

The new linux CI job runs cargo test --workspace --locked, so it would hang on this head as it stands.

Not tested: Windows, Wine, running a title. AI use: Claude Code (Claude Fable 5.2) ran the commands and drafted this; I checked the results.

**@⁠ramenbellic** on GitHub · 2026-11-24 17:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7139486801) Tested `5d40ad8` on Bazzite (kernel 7.3.4, Ryzen 5 5600X, rustc 1.98.1), no game data. - `cargo check --workspace --all-targets --all-features --locked`: passes, 0 warnings. - `cargo test --workspace --locked --no-fail-fast`: hangs in 3 of 3 runs. Everything except `victory-gpu` passes (226 passed, 0 failed, 5 ignored). - `cargo test -p victory-gpu`: hangs in 6 of 6 runs here (5 parallel, 1 with `--test-threads=1`), so on this machine it is not scheduling-dependent. 41 pass, the same three `queue::host_free_tests` fail as reported above, and `timestamp_frequency_refuses_null_and_reports_the_rate` never returns. - With `--skip newer_device_levels_are_the_same_device`: 44 passed, 0 failed, parallel and single-threaded. That supports @⁠elgreams' reading that the global `NEWER` flag set by that test is the cause. The new `linux` CI job runs `cargo test --workspace --locked`, so it would hang on this head as it stands. Not tested: Windows, Wine, running a title. AI use: Claude Code (Claude Fable 5.2) ran the commands and drafted this; I checked the results.
Author
Owner

@⁠elgreams on GitHub · 2026-11-24 18:46 UTC · original

@⁠SkippySteve I opened SkippySteve/VIctory#2 against this branch with a fix for the order-dependent hang: the host_free_tests now find each method in the queue's own table, like tests::signal_slot does. On Linux, victory-gpu passes 45/45 in 15 parallel runs.

**@⁠elgreams** on GitHub · 2026-11-24 18:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7141126414) @⁠SkippySteve I opened SkippySteve/VIctory#2 against this branch with a fix for the order-dependent hang: the `host_free_tests` now find each method in the queue's own table, like `tests::signal_slot` does. On Linux, `victory-gpu` passes 45/45 in 15 parallel runs.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:01 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #523. Linux build gating plus 2,000 lines of Linux-only test modules and a Linux CI job; #523 (clean, 100 lines) gates the same paths without them.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/235#issuecomment-7148043453) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #523. Linux build gating plus 2,000 lines of Linux-only test modules and a Linux CI job; #523 (clean, 100 lines) gates the same paths without them. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!235
No description provided.