Game: preserve sample masks in prebuilt graphics pipelines #1864

Open
necrobytes wants to merge 5 commits from upstream-pr/1866 into main
necrobytes commented 2026-11-24 23:47:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by necrobytes on 2026-11-24T23:47:01Z.


translate --cache --pipelines used to write 0xffffffff into every graphics pipeline’s sample-mask field. A four-sample record with mask 0x5 therefore looked the same as one enabling all four samples. The runtime includes the mask in its pipeline cache key, so a request for the partial mask could miss the prebuilt entry.

The prebuilder now copies the mask returned by Graphics::samples() into the creation stream. The existing stream test now checks partial, zero, and full coverage on a four-sample record.

I tested on x86-64 Linux with Rust 1.98.1. A synthetic pack with masks 0, 1, 5, and 0xffffffff produced one distinct stream on 70564ae. With this change, it produced four, each carrying the original mask.

  • All 15 victory-game tests passed natively on Linux. I also cross-compiled the tests for x86_64-pc-windows-gnu and ran the Windows executable under Wine 11.21. All 15 passed there too. The new 0x5 assertion failed on the original implementation.
  • From Linux, cargo clippy --locked --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings passed both with default features and with --all-features. Strict Clippy also passed for victory-game on the Linux target.
  • cargo xtask policy passed for all 174 tracked files.

Tracked as NEW-41. Claim in #1633

Implemented and tested with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5482305168 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1866). Originally posted by [necrobytes](https://github.com/necrobytes) on 2026-11-24T23:47:01Z. --- `translate --cache --pipelines` used to write `0xffffffff` into every graphics pipeline’s sample-mask field. A four-sample record with mask `0x5` therefore looked the same as one enabling all four samples. The runtime includes the mask in its pipeline cache key, so a request for the partial mask could miss the prebuilt entry. The prebuilder now copies the mask returned by `Graphics::samples()` into the creation stream. The existing stream test now checks partial, zero, and full coverage on a four-sample record. I tested on x86-64 Linux with Rust 1.98.1. A synthetic pack with masks `0`, `1`, `5`, and `0xffffffff` produced one distinct stream on `70564ae`. With this change, it produced four, each carrying the original mask. - All 15 `victory-game` tests passed natively on Linux. I also cross-compiled the tests for `x86_64-pc-windows-gnu` and ran the Windows executable under Wine 11.21. All 15 passed there too. The new `0x5` assertion failed on the original implementation. - From Linux, `cargo clippy --locked --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings` passed both with default features and with `--all-features`. Strict Clippy also passed for `victory-game` on the Linux target. - `cargo xtask policy` passed for all 174 tracked files. Tracked as `NEW-41`. [Claim in #1633](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7147691031) Implemented and tested with Codex.
catminou4 commented 2026-11-25 02:09:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:09:57Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (940d32f), cargo test → 15 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows.

victory-game. Game: preserve sample masks in prebuilt graphics…: sample-mask preservation in prebuilt shaders.

<!-- greyfinch-sync:Marvisak/VIctory:review:6050606378 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1866#pullrequestreview-6050606378). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T02:09:57Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (940d32f), cargo test → 15 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows. victory-game. Game: preserve sample masks in prebuilt graphics…: sample-mask preservation in prebuilt shaders.
Marvisak commented 2026-11-25 08:06:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T07:18:36Z.


Automated triage for the maintainers.

Merge candidate. The verdict is unchanged.

Since the last review (1f34644 → 771bb01): the only new commit merges current main into the branch. The PR's own diff against main is the same as before.

stream in crates/victory-game/src/pipelines.rs writes the sample mask from Graphics::samples() (metadata offset 0x1c) into the stream's sample-mask field at 0x1dc, instead of always writing u32::MAX. crates/victory-gpu/src/pipeline/host.rs reads that field into sample_mask and the pipeline key. The test now builds records with masks 0x5, 0 and u32::MAX and checks that each one reaches the stream.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155718348 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1866#issuecomment-7155718348). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T07:18:36Z. --- <!-- victory-triage v1 head=771bb01665ab4209fa321b0f8960dabde5586257 verdict=merge-candidate at=2026-11-25T20:18:54Z --> Automated triage for the maintainers. **Merge candidate.** The verdict is unchanged. **Since the last review (`1f34644` → `771bb01`):** the only new commit merges current `main` into the branch. The PR's own diff against `main` is the same as before. `stream` in `crates/victory-game/src/pipelines.rs` writes the sample mask from `Graphics::samples()` (metadata offset 0x1c) into the stream's sample-mask field at 0x1dc, instead of always writing `u32::MAX`. `crates/victory-gpu/src/pipeline/host.rs` reads that field into `sample_mask` and the pipeline key. The test now builds records with masks 0x5, 0 and `u32::MAX` and checks that each one reaches the stream. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 19:24:09 +00:00 (Migrated from github.com)

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

Review: APPROVED


Verified locally merged onto origin/main (63bcca43, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test --locked -p victory-game — 15 passed, 0 failed (including a_record_becomes_the_engines_creation_stream across sample masks 0x5, 0, and u32::MAX)
  • cargo clippy --locked -p victory-game --all-targets -- -D warnings (default and --all-features) — 0 warnings
  • rustfmt --edition 2024 --check crates/victory-game/src/pipelines.rs — clean
  • cargo xtask policy — ok (191 files ok)

Review notes

  • stream() now forwards the little-endian u32 sample mask from Graphics::samples() (0x1c in metadata) straight into offset 0x1dc instead of overwriting it with u32::MAX, preserving 0, partial masks, and u32::MAX alike.
<!-- greyfinch-sync:Marvisak/VIctory:review:6079495751 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1866#pullrequestreview-6079495751). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T19:24:09Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`63bcca43`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test --locked -p victory-game` — **15 passed, 0 failed** (including `a_record_becomes_the_engines_creation_stream` across sample masks `0x5`, `0`, and `u32::MAX`) - `cargo clippy --locked -p victory-game --all-targets -- -D warnings` (default and `--all-features`) — 0 warnings - `rustfmt --edition 2024 --check crates/victory-game/src/pipelines.rs` — clean - `cargo xtask policy` — ok (`191 files ok`) ### Review notes - `stream()` now forwards the little-endian `u32` sample mask from `Graphics::samples()` (`0x1c` in metadata) straight into offset `0x1dc` instead of overwriting it with `u32::MAX`, preserving `0`, partial masks, and `u32::MAX` alike.
andrewpozdnakov7-jpg commented 2026-11-28 07:18:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T07:18:25Z.


I combined #1866 at 771bb01 with #3690 at f7e419b in a7364db. This retains the prebuilder's sample-mask fix and the byte-identical runtime input descriptions.

On Windows the prebuild stream test preserved zero, partial and full sample masks. A new host test fed 0, 1, 5 and 0xffffffff through the sample-mask subobject of a four-sample graphics state. All four produced distinct runtime cache keys with the same input layout. The game and pipeline-host tests, strict Clippy for both crates and the asset policy passed.

necrobytes or a maintainer can use the additional test if both changes land. This check covers the generated stream and key, without measuring a title's cache hit rate.

Please retain the Git authors on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding this resolution into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7235849389 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1866#issuecomment-7235849389). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T07:18:25Z. --- I combined #1866 at `771bb01` with #3690 at `f7e419b` in [a7364db](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/a7364dbe348ee5b30c4e7bd9c6ce5d8d058b3cbb). This retains the prebuilder's sample-mask fix and the byte-identical runtime input descriptions. On Windows the prebuild stream test preserved zero, partial and full sample masks. A new host test fed `0`, `1`, `5` and `0xffffffff` through the sample-mask subobject of a four-sample graphics state. All four produced distinct runtime cache keys with the same input layout. The game and pipeline-host tests, strict Clippy for both crates and the asset policy passed. necrobytes or a maintainer can use the additional test if both changes land. This check covers the generated stream and key, without measuring a title's cache hit rate. Please retain the Git authors on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding this resolution into another commit. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1866'
git switch 'upstream-pr/1866'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1866'
git switch 'upstream-pr/1866'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1866'
git switch 'main'
git merge --squash 'upstream-pr/1866'
git switch 'main'
git merge --ff-only 'upstream-pr/1866'
git switch 'main'
git merge 'upstream-pr/1866'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1864
No description provided.