Fix the Linux build and clippy gates #1017

Closed
Jitheswar wants to merge 2 commits from upstream-pr/1017 into main
Jitheswar commented 2026-11-24 15:06:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jitheswar on 2026-11-24T15:06:29Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6584859841 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017). Originally posted by [Jitheswar](https://github.com/Jitheswar) on 2026-11-24T15:06:29Z. --- ## 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)
Zipettte commented 2026-11-24 16:05:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:41:04Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136438391 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7136438391). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:41:04Z. --- 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)._
pablogonz12 commented 2026-11-24 17:04:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-24T16:47:39Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7138216375 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7138216375). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-24T16:47:39Z. --- 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.
Jitheswar commented 2026-11-24 17:04:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jitheswar on 2026-11-24T16:58:07Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7138483650 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7138483650). Originally posted by [Jitheswar](https://github.com/Jitheswar) on 2026-11-24T16:58:07Z. --- 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.
x3ero0 commented 2026-11-24 20:03:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by x3ero0 on 2026-11-24T19:26:54Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142111179 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7142111179). Originally posted by [x3ero0](https://github.com/x3ero0) on 2026-11-24T19:26:54Z. --- 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.
Jitheswar commented 2026-11-24 23:06:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jitheswar on 2026-11-24T22:54:27Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146782251 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7146782251). Originally posted by [Jitheswar](https://github.com/Jitheswar) on 2026-11-24T22:54:27Z. --- 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).
Marvisak commented 2026-11-25 01:08:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:33:19Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148630442 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7148630442). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:33:19Z. --- <!-- 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)_
Jitheswar commented 2026-11-25 03:03:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jitheswar on 2026-11-25T02:32:54Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150863274 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#issuecomment-7150863274). Originally posted by [Jitheswar](https://github.com/Jitheswar) on 2026-11-25T02:32:54Z. --- 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).
astrosteveo commented 2026-11-25 06:01:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by astrosteveo on 2026-11-25T05:43:48Z.

Review: APPROVED


Read the diff at d5de72b and ran it merged onto main 940d32f (no conflicts), natively on Arch Linux with the pinned Rust 1.98.1. The earlier Linux reports here were on older heads.

main with this PR
cargo build --workspace --locked fails: E0425, host_resource builds
cargo clippy --workspace --all-targets --locked -- -D warnings not run clean
the same with --all-features not run clean
cargo test --workspace --all-features --locked not run 395 passed, 0 failed, 8 ignored

From reading: nearly all of it is gating. The one line that can differ on Windows is image_named, which takes the text after the last separator instead of Path::file_name; for the absolute paths set_image_path stores there, that is the same name. set_image_path itself is unchanged on Windows.

I have a branch for the same thing on my fork (build/native-linux, not opened here). It overlaps this one, and nothing in it speaks against this PR.

Not checked: a Windows run (CI is green at this head).


Co-Authored-By: Claude Opus 5.5 <[email protected]>

<!-- greyfinch-sync:Marvisak/VIctory:review:6052438631 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1017#pullrequestreview-6052438631). Originally posted by [astrosteveo](https://github.com/astrosteveo) on 2026-11-25T05:43:48Z. **Review:** APPROVED --- Read the diff at `d5de72b` and ran it merged onto `main` `940d32f` (no conflicts), natively on Arch Linux with the pinned Rust 1.98.1. The earlier Linux reports here were on older heads. | | `main` | with this PR | |---|---|---| | `cargo build --workspace --locked` | fails: E0425, `host_resource` | builds | | `cargo clippy --workspace --all-targets --locked -- -D warnings` | not run | clean | | the same with `--all-features` | not run | clean | | `cargo test --workspace --all-features --locked` | not run | 395 passed, 0 failed, 8 ignored | From reading: nearly all of it is gating. The one line that can differ on Windows is `image_named`, which takes the text after the last separator instead of `Path::file_name`; for the absolute paths `set_image_path` stores there, that is the same name. `set_image_path` itself is unchanged on Windows. I have a branch for the same thing on my fork (`build/native-linux`, not opened here). It overlaps this one, and nothing in it speaks against this PR. Not checked: a Windows run (CI is green at this head). --- <sub>Co-Authored-By: Claude Opus 5.5 &lt;[email protected]&gt;</sub>
upstream-sync closed this pull request 2026-11-25 10:05:50 +00:00

Pull request closed

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