Fix the Linux build and clippy gates #1017

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

@⁠Jitheswar on GitHub · 2026-11-24 15:06 UTC · original
quality/non-windows-build → main · +282 −34 · 22 files · 2 commits · closed without merging

What and why

main doesn't build on non-Windows hosts (CI runs only on windows-latest). On 940d32f, cargo build fails in victory-gpu with cannot find function host_resource, and clippy finds more. This PR brings the workspace to a clean state on Linux:

  • it compiles;
  • it passes cargo clippy --workspace --all-targets --locked [--all-features] -- -D warnings;
  • it passes cargo test --workspace --all-features --locked.

Rebased onto 940d32f as one commit; it now also covers what that base broke.

victory-gpu

  • Gates Windows-only items with #[cfg(windows)] (#[cfg(any(windows, test))] where tests use them): view_format, samplers, index, forget, view, rtv_record, dsv_record, tagged_record, pc_format, SRGB, DEPTH_FORMATS, PlacedFootprint::bytes, texture_memory, take_indirect, UAV_BARRIER, presented, title_format.
  • Some portable helpers are called only from Windows code. They stay built everywhere, because their tests run on every host, and are allowed unused off Windows:
    • the per-memory texture helpers (family, DEPTH, MemoryKey, memory_key, castable);
    • the switch module (the VICTORY_* on/off parser);
    • the loader's publish module.
  • The new root-signature shim tests and the ID3D12Fence1 test drive Windows-only COM objects, so they're Windows-only.
  • Silences unused parameters on the non-Windows paths of close/barrier/execute_indirect, matching reset().

victory-hle

  • Gates function (the System32 loader) and the Windows-only modules' imports.
  • Title paths on non-Windows hosts: already-absolute and Windows-style absolute paths (C:\, \\server\share) are kept as stored, and file names resolve across \ and /.
  • The drive-over-folder mount test is Windows-only.

victory-shader / victory-loader / victory-pe

  • Gates Windows-only imports in the emit tests. Lowered::rovs is read only by GPU tests, and the mesh test's program is only validated on Windows.
  • The tests that read the current executable as PE are Windows-only.

apps/victory

  • translate --cache (the warm-up and pipeline pre-build) fills the host's shader cache and pipeline library, which only a Windows build has. Other hosts get an error that says so.
  • translate: without the Windows DLLs, the validator and host pipelines are skipped with a note instead of failing.

Checks

  • Linux (rust 1.98.1 from rust-toolchain.toml): cargo build --workspace; cargo clippy --workspace --all-targets -D warnings, default and --all-features; cargo test --workspace --all-features passes all 26 suites (394 passed, 8 ignored).
  • Windows target (cargo-xwin): cargo clippy --workspace --all-targets -D warnings, default and --all-features, is clean.
  • cargo xtask policy: 182 files ok.

No behaviour change on Windows. AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠Jitheswar** on GitHub · 2026-11-24 15:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017) `quality/non-windows-build` → `main` · +282 −34 · 22 files · 2 commits · closed without merging ## What and why `main` doesn't build on non-Windows hosts (CI runs only on `windows-latest`). On `940d32f`, `cargo build` fails in `victory-gpu` with `cannot find function host_resource`, and clippy finds more. This PR brings the workspace to a clean state on Linux: - it compiles; - it passes `cargo clippy --workspace --all-targets --locked [--all-features] -- -D warnings`; - it passes `cargo test --workspace --all-features --locked`. Rebased onto `940d32f` as one commit; it now also covers what that base broke. ### victory-gpu - Gates Windows-only items with `#[cfg(windows)]` (`#[cfg(any(windows, test))]` where tests use them): `view_format`, `samplers`, `index`, `forget`, `view`, `rtv_record`, `dsv_record`, `tagged_record`, `pc_format`, `SRGB`, `DEPTH_FORMATS`, `PlacedFootprint::bytes`, `texture_memory`, `take_indirect`, `UAV_BARRIER`, `presented`, `title_format`. - Some portable helpers are called only from Windows code. They stay built everywhere, because their tests run on every host, and are allowed unused off Windows: - the per-memory texture helpers (`family`, `DEPTH`, `MemoryKey`, `memory_key`, `castable`); - the `switch` module (the `VICTORY_*` on/off parser); - the loader's `publish` module. - The new root-signature shim tests and the `ID3D12Fence1` test drive Windows-only COM objects, so they're Windows-only. - Silences unused parameters on the non-Windows paths of `close`/`barrier`/`execute_indirect`, matching `reset()`. ### victory-hle - Gates `function` (the System32 loader) and the Windows-only modules' imports. - Title paths on non-Windows hosts: already-absolute and Windows-style absolute paths (`C:\`, `\\server\share`) are kept as stored, and file names resolve across `\` and `/`. - The drive-over-folder mount test is Windows-only. ### victory-shader / victory-loader / victory-pe - Gates Windows-only imports in the `emit` tests. `Lowered::rovs` is read only by GPU tests, and the mesh test's program is only validated on Windows. - The tests that read the current executable as PE are Windows-only. ### apps/victory - `translate --cache` (the warm-up and pipeline pre-build) fills the host's shader cache and pipeline library, which only a Windows build has. Other hosts get an error that says so. - `translate`: without the Windows DLLs, the validator and host pipelines are skipped with a note instead of failing. ## Checks - **Linux** (rust 1.98.1 from `rust-toolchain.toml`): `cargo build --workspace`; `cargo clippy --workspace --all-targets -D warnings`, default and `--all-features`; `cargo test --workspace --all-features` passes all 26 suites (394 passed, 8 ignored). - **Windows target** (cargo-xwin): `cargo clippy --workspace --all-targets -D warnings`, default and `--all-features`, is clean. - `cargo xtask policy`: 182 files ok. No behaviour change on Windows. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`main` does not build on non-Windows hosts (CI runs only on
windows-latest): `victory-gpu` calls Windows-only items from portable
code, and Windows-only callers leave portable helpers unused.

- victory-gpu: gate Windows-only items (view_format, samplers, index,
  forget, view, rtv_record, dsv_record, tagged_record, pc_format,
  SRGB, DEPTH_FORMATS, PlacedFootprint::bytes, texture_memory,
  take_indirect, UAV_BARRIER, presented, title_format) with
  #[cfg(windows)], some #[cfg(any(windows, test))]; the per-memory
  texture helpers (family, DEPTH, MemoryKey, memory_key, castable), the
  `switch` module and the loader's `publish` module stay built
  everywhere (their tests run on every host) and are allowed unused off
  Windows. The root-signature shim tests and the ID3D12Fence1 test,
  which drive Windows-only COM objects, are Windows-only.
- victory-gpu: silence unused parameters on the non-Windows paths of
  close/barrier/execute_indirect, matching reset().
- victory-hle: gate `function` (the System32 loader) and the
  Windows-only modules' imports; keep already-absolute and
  Windows-style absolute title paths on non-Windows hosts and resolve
  file names across both separators; gate the drive-over-folder mount
  test to Windows.
- victory-shader: gate the Windows-only imports of the emit tests;
  `Lowered::rovs` is read only by the GPU tests; the mesh test's
  program is built for the validator, which only Windows has.
- victory-loader/victory-pe: gate tests that read current_exe as PE.
- apps/victory: `translate --cache` (the warm-up and pre-build) fills
  the host's shader cache and pipeline library and is Windows-only;
  other hosts get an error saying so. Without the Windows DLLs, the
  validator and host pipelines are skipped with a note.

Linux: cargo build, cargo clippy --workspace --all-targets -D warnings
(default and --all-features) and cargo test --workspace --all-features
(26 suites, 394 passed) pass. Windows target (cargo-xwin): clippy
-D warnings, default and --all-features, passes. cargo xtask policy
passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Windows the title-path shortcut returned an already-absolute path
unchanged, where `main` passed every path through `std::path::absolute`
(`GetFullPathNameW`: `/` becomes `\`, `..` is resolved), so a title
started as `C:/games/x/../game.exe` would read that raw string back
from `GetModuleFileName`. The shortcut now runs only on other hosts,
where a Windows-style path must not be joined to the host's current
directory; Windows behaves as before.

Tests: on Windows `C:/games/x/../game.exe` becomes `C:\games\game.exe`;
elsewhere drive-rooted, drive-root and UNC title paths are kept as
stored and a relative one is made absolute.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:16 +00:00
github-bot closed this pull request 2026-11-26 04:17:16 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 15:41 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 118e42f: cargo test does not compile:

error[E0425]: cannot find type `OnceLock` in this scope
  --> crates\victory-gpu\src\pipeline.rs:65:17
65 |     translated: OnceLock<Option<Translated>>,

Probably a missing use std::sync::OnceLock; in pipeline.rs. main (ffe310e) builds and passes on the same machine.

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 15:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7136438391) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 118e42f: `cargo test` does not compile: ``` error[E0425]: cannot find type `OnceLock` in this scope --> crates\victory-gpu\src\pipeline.rs:65:17 65 | translated: OnceLock<Option<Translated>>, ``` Probably a missing `use std::sync::OnceLock;` in `pipeline.rs`. main (ffe310e) builds and passes on the same machine. _Tested with AI assistance (Claude)._
Author
Owner

@⁠pablogonz12 on GitHub · 2026-11-24 16:47 UTC · original

Tested on Linux (Arch, the repo's pinned 1.98.1 toolchain), your head b0933f5 merged on ffe310e.

Before, on plain main: cargo build -p victory-gpu fails with E0425, cannot find function host_resource at crates/victory-gpu/src/resource.rs:284 — view_format calls what only exists under #[cfg(windows)]. It came from 2849477 (the host-texture commit of 23 Nov 23:10); its parent builds clean on Linux, and CI never sees it because every job is windows-latest.

With your head:

  • cargo build --workspace: clean.
  • cargo clippy --workspace --all-targets --locked -- -D warnings (host): clean.
  • cargo test --workspace --locked (host): 217 passed, 0 failed, 5 ignored.
  • cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings, with and without --all-features: clean.

Not tested: Windows hardware, the game itself.

**@⁠pablogonz12** on GitHub · 2026-11-24 16:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7138216375) Tested on Linux (Arch, the repo's pinned 1.98.1 toolchain), your head b0933f5 merged on ffe310e. Before, on plain main: `cargo build -p victory-gpu` fails with E0425, `cannot find function host_resource` at `crates/victory-gpu/src/resource.rs:284` — `view_format` calls what only exists under `#[cfg(windows)]`. It came from 2849477 (the host-texture commit of 23 Nov 23:10); its parent builds clean on Linux, and CI never sees it because every job is `windows-latest`. With your head: - `cargo build --workspace`: clean. - `cargo clippy --workspace --all-targets --locked -- -D warnings` (host): clean. - `cargo test --workspace --locked` (host): 217 passed, 0 failed, 5 ignored. - `cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings`, with and without `--all-features`: clean. Not tested: Windows hardware, the game itself.
Author
Owner

@⁠Jitheswar on GitHub · 2026-11-24 16:58 UTC · original

Thanks @⁠Zipettte. That was the first commit, 118e42f, where the OnceLock import was removed entirely. The current head, b0933f5, puts it back under #[cfg(windows)] next to the translated field that uses it. pablogonz12 confirmed above that cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings is clean at that head, with and without --all-features. If you get a chance to rerun cargo test on Windows at b0933f5, that would confirm it on real hardware.

**@⁠Jitheswar** on GitHub · 2026-11-24 16:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7138483650) Thanks @⁠Zipettte. That was the first commit, `118e42f`, where the `OnceLock` import was removed entirely. The current head, `b0933f5`, puts it back under `#[cfg(windows)]` next to the `translated` field that uses it. pablogonz12 confirmed above that `cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings` is clean at that head, with and without `--all-features`. If you get a chance to rerun `cargo test` on Windows at `b0933f5`, that would confirm it on real hardware.
Author
Owner

@⁠x3ero0 on GitHub · 2026-11-24 19:26 UTC · original

Tested on Linux, b0933f5 cherry-picked onto main ffe310e (applies cleanly). CachyOS, kernel 7.3.5, Rust 1.98.1 from rust-toolchain.toml.

Check ffe310e ffe310e + this PR
cargo build --workspace --locked (native) fails: E0425 host_resource in victory-gpu/src/resource.rs builds
cargo clippy --workspace --all-targets --locked -- -D warnings (native) n/a clean
the same with --all-features n/a clean
cargo test --workspace --locked (native), with and without --all-features n/a 217 passed, 0 failed, 5 ignored
clippy -D warnings for x86_64-pc-windows-msvc (cargo xwin), with and without --all-features clean clean
cargo test --workspace for the Windows target under GE-Proton11-6 332 passed, 10 failed 332 passed, 10 failed, the same ten

The ten failures under Wine are environmental and identical on both trees (repository-path checks, WSAConnectByList, the pipeline library, the container-digest check, the HLSL clamp, the probe fixture), so the Windows side behaves the same there with and without the change.

The native binary also does what the description says on real files: config, inspect and census --missing work, and translate <pack> --validate --pipelines runs through the whole pack (26,084 programs in 35 s here) and prints validator skipped (Windows only) and host pipelines skipped (Windows only) at the top.

Not run on native Windows.

**@⁠x3ero0** on GitHub · 2026-11-24 19:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7142111179) Tested on Linux, `b0933f5` cherry-picked onto `main` `ffe310e` (applies cleanly). CachyOS, kernel 7.3.5, Rust 1.98.1 from `rust-toolchain.toml`. | Check | `ffe310e` | `ffe310e` + this PR | |---|---|---| | `cargo build --workspace --locked` (native) | fails: `E0425` `host_resource` in `victory-gpu/src/resource.rs` | builds | | `cargo clippy --workspace --all-targets --locked -- -D warnings` (native) | n/a | clean | | the same with `--all-features` | n/a | clean | | `cargo test --workspace --locked` (native), with and without `--all-features` | n/a | 217 passed, 0 failed, 5 ignored | | clippy `-D warnings` for `x86_64-pc-windows-msvc` (`cargo xwin`), with and without `--all-features` | clean | clean | | `cargo test --workspace` for the Windows target under GE-Proton11-6 | 332 passed, 10 failed | 332 passed, 10 failed, the same ten | The ten failures under Wine are environmental and identical on both trees (repository-path checks, `WSAConnectByList`, the pipeline library, the container-digest check, the HLSL clamp, the probe fixture), so the Windows side behaves the same there with and without the change. The native binary also does what the description says on real files: `config`, `inspect` and `census --missing` work, and `translate <pack> --validate --pipelines` runs through the whole pack (26,084 programs in 35 s here) and prints `validator skipped (Windows only)` and `host pipelines skipped (Windows only)` at the top. Not run on native Windows.
Author
Owner

@⁠Jitheswar on GitHub · 2026-11-24 22:54 UTC · original

Rebased onto 70564ae (one conflict in victory-hle/src/modules/mod.rs: kept upstream's FidelityFX entry). New commit 2b03b41 covers what 70564ae broke on Linux: castable calling the Windows-only family, the test-only Lowered::rovs, and translate --cache / prebuild using the Windows-only shader cache and pipeline library (now Windows-only, with a clear error elsewhere).

  • Linux: cargo build, cargo clippy --workspace --all-targets -D warnings (default and --all-features), and cargo test --workspace --all-features all pass.
  • Windows target (cargo-xwin): clippy -D warnings passes for default and --all-features; cargo xtask policy passes.

70564ae itself still fails cargo build on Linux (host_resource, then family), so this is still needed. AI-assisted (Claude Code).

**@⁠Jitheswar** on GitHub · 2026-11-24 22:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7146782251) Rebased onto `70564ae` (one conflict in `victory-hle/src/modules/mod.rs`: kept upstream's FidelityFX entry). New commit `2b03b41` covers what `70564ae` broke on Linux: `castable` calling the Windows-only `family`, the test-only `Lowered::rovs`, and `translate --cache` / `prebuild` using the Windows-only shader cache and pipeline library (now Windows-only, with a clear error elsewhere). - Linux: `cargo build`, `cargo clippy --workspace --all-targets -D warnings` (default and `--all-features`), and `cargo test --workspace --all-features` all pass. - Windows target (cargo-xwin): clippy `-D warnings` passes for default and `--all-features`; `cargo xtask policy` passes. `70564ae` itself still fails `cargo build` on Linux (`host_resource`, then `family`), so this is still needed. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:33 UTC · original · edited 2026-11-25 03:21 UTC

Automated triage for the maintainers.

Merge candidate. This makes the workspace build, pass clippy and pass tests on non-Windows hosts. Most of the change is #[cfg(windows)] gating. translate also gets stubs, so the validator and host pipeline checks report "skipped (Windows only)" and --cache errors clearly. The Windows-relevant point from the last triage is fixed in d5de72b: in crates/victory-hle/src/runtime.rs, absolute_title_path applies the title_absolute shortcut only under #[cfg(not(windows))], and Windows keeps std::path::absolute as on main. title_file_name splits on both separators, which matches Path::file_name for the normalized paths Windows stores. No dependencies change. CI passes.

#1183 and #1185 also touch apps/victory/src/translate.rs, so whichever of these merges later will need a rebase.

On your reply: confirmed. The Windows path is unchanged from main, and the new Windows test pins the / and .. normalization.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7148630442) · edited 2026-11-25 03:21 UTC <!-- victory-triage v1 head=d5de72b8b60e415b439a8403bb355a8858882666 verdict=merge-candidate at=2026-11-25T03:21:50Z --> Automated triage for the maintainers. **Merge candidate.** This makes the workspace build, pass clippy and pass tests on non-Windows hosts. Most of the change is `#[cfg(windows)]` gating. `translate` also gets stubs, so the validator and host pipeline checks report "skipped (Windows only)" and `--cache` errors clearly. The Windows-relevant point from the last triage is fixed in d5de72b: in `crates/victory-hle/src/runtime.rs`, `absolute_title_path` applies the `title_absolute` shortcut only under `#[cfg(not(windows))]`, and Windows keeps `std::path::absolute` as on `main`. `title_file_name` splits on both separators, which matches `Path::file_name` for the normalized paths Windows stores. No dependencies change. CI passes. #1183 and #1185 also touch `apps/victory/src/translate.rs`, so whichever of these merges later will need a rebase. On your reply: confirmed. The Windows path is unchanged from `main`, and the new Windows test pins the `/` and `..` normalization. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Jitheswar on GitHub · 2026-11-25 02:32 UTC · original

Fixed in d5de72b, as suggested. The title-path shortcut runs only under #[cfg(not(windows))], so Windows keeps std::path::absolute (GetFullPathNameW) exactly as on main, and title_absolute is non-Windows only.

New tests:

  • windows_title_paths_are_normalized (Windows): C:/games/x/../game.exe → C:\games\game.exe.
  • windows_style_title_paths_stay_absolute_on_other_hosts (non-Windows): drive-rooted, drive-root and UNC paths are kept as stored, and a relative one is made absolute.

Checked:

  • Linux: cargo test -p victory-hle 78 passed; workspace clippy -D warnings clean, default and --all-features.
  • Windows target: clippy -D warnings clean, default and --all-features. victory-hle tests under Proton: the new test passes, and the only 2 failures are the same Wine-host ones main has (only_loopback_is_reachable, a_kept_blob_past_the_link_limit_is_copied).

On the overlap: understood. I'll rebase whichever of #1017, #1183 and #1185 is left after the first one merges. AI-assisted (Claude Code).

**@⁠Jitheswar** on GitHub · 2026-11-25 02:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7150863274) Fixed in `d5de72b`, as suggested. The title-path shortcut runs only under `#[cfg(not(windows))]`, so Windows keeps `std::path::absolute` (`GetFullPathNameW`) exactly as on `main`, and `title_absolute` is non-Windows only. New tests: - `windows_title_paths_are_normalized` (Windows): `C:/games/x/../game.exe` → `C:\games\game.exe`. - `windows_style_title_paths_stay_absolute_on_other_hosts` (non-Windows): drive-rooted, drive-root and UNC paths are kept as stored, and a relative one is made absolute. Checked: - Linux: `cargo test -p victory-hle` 78 passed; workspace clippy `-D warnings` clean, default and `--all-features`. - Windows target: clippy `-D warnings` clean, default and `--all-features`. `victory-hle` tests under Proton: the new test passes, and the only 2 failures are the same Wine-host ones `main` has (`only_loopback_is_reachable`, `a_kept_blob_past_the_link_limit_is_copied`). On the overlap: understood. I'll rebase whichever of #1017, #1183 and #1185 is left after the first one merges. AI-assisted (Claude Code).

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!1017
No description provided.