Shaders: a lane mask's high dword is the pair's own #3926

Open
kotekompotek wants to merge 2 commits from upstream-pr/3926 into main
kotekompotek commented 2026-12-01 03:27:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-12-01T03:27:39Z.


Summary

Two fixes to paired lane-mask tracking on wave32:

  • c027a6a: a lane mask's high dword is the pair's own — previously the high dword was guessed from the register next to the low one, which misidentified pairs when the console compiler allocated non-adjacent halves.
  • 5b737de: the translate pass counts an opaque mask through its two-field pattern, so the stats cover masks written via pair operations.

With these, console lane masks held as 64-bit pairs resolve to the right lanes; the remaining consumers (pixel-stage EXEC traffic through _b64 ops) are fixed in #3924.

Test plan

  • cargo test -p victory-shader suite green.
  • GTA VI boot on GTX 1050: compute ce047486 and friends translate; the mask consumers render.

AI-assisted change.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5578376270 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3926). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-12-01T03:27:39Z. --- ## Summary Two fixes to paired lane-mask tracking on wave32: - `c027a6a`: a lane mask's high dword is the pair's own — previously the high dword was guessed from the register next to the low one, which misidentified pairs when the console compiler allocated non-adjacent halves. - `5b737de`: the translate pass counts an opaque mask through its two-field pattern, so the stats cover masks written via pair operations. With these, console lane masks held as 64-bit pairs resolve to the right lanes; the remaining consumers (pixel-stage EXEC traffic through `_b64` ops) are fixed in #3924. #### Test plan - [x] `cargo test -p victory-shader` suite green. - [x] GTA VI boot on GTX 1050: compute `ce047486` and friends translate; the mask consumers render. AI-assisted change.
cloph-dsp commented 2026-12-01 12:23:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-12-01T12:23:49Z.


Verification of this PR (AI-assisted: Hy4 flash), source only, no game data.

Windows / rustc 1.100.0 / MSVC. Worktree at head 5b737dea, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\target-3926), nothing shared.

Negative control on base 63bcca43:

  • git grep -F a_half_written_mask_tests_its_high_dword 63bcca43 -- . -> exit 1 (test is new).
    Whitespace: git diff --check 63bcca43..5b737dea -> exit 0, clean.
cargo test --locked -p victory-shader --lib -- emit::valu_tests::a_half_written_mask_tests_its_high_dword --exact --test-threads=1 --quiet

-> test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out, exit 0.

Note: the test lives in crates/victory-shader/src/emit/valu_tests.rs, declared as mod valu_tests; at emit/mod.rs:228, so the filter needs the emit:: prefix — valu_tests::<name> alone matches 0 tests.

GPU/driver: N/A (lowering test, opens no device).

Verdict: PASS for the new synthetic test on this host.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7311071757 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3926#issuecomment-7311071757). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-12-01T12:23:49Z. --- Verification of this PR (AI-assisted: Hy4 flash), source only, no game data. Windows / rustc 1.100.0 / MSVC. Worktree at head 5b737dea, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\target-3926), nothing shared. Negative control on base 63bcca43: - `git grep -F a_half_written_mask_tests_its_high_dword 63bcca43 -- .` -> exit 1 (test is new). Whitespace: `git diff --check 63bcca43..5b737dea` -> exit 0, clean. ``` cargo test --locked -p victory-shader --lib -- emit::valu_tests::a_half_written_mask_tests_its_high_dword --exact --test-threads=1 --quiet ``` -> `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out`, exit 0. Note: the test lives in `crates/victory-shader/src/emit/valu_tests.rs`, declared as `mod valu_tests;` at emit/mod.rs:228, so the filter needs the `emit::` prefix — `valu_tests::<name>` alone matches 0 tests. GPU/driver: N/A (lowering test, opens no device). Verdict: PASS for the new synthetic test on this host.
passerbyyhx commented 2026-12-01 14:03:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-12-01T14:03:11Z.


I added a source-register control at 5b737dea. The mask consumer reads s[12:13], copied from s20 and s26. With the low half fixed, I independently toggled the actual high source (s26) and the unused neighbor (s21) between 0 and −1. Only s26 changed the generated DXIL. At merge-base f3578e38, changing either value left the DXIL unchanged. The SDK validator accepted all four head variants. This checks the generated code's dependence on the high source. I did not dispatch this fixture.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7313616561 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3926#issuecomment-7313616561). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-12-01T14:03:11Z. --- I added a source-register control at `5b737dea`. The mask consumer reads `s[12:13]`, copied from `s20` and `s26`. With the low half fixed, I independently toggled the actual high source (`s26`) and the unused neighbor (`s21`) between 0 and −1. Only `s26` changed the generated DXIL. At merge-base `f3578e38`, changing either value left the DXIL unchanged. The SDK validator accepted all four head variants. This checks the generated code's dependence on the high source. I did not dispatch this fixture.
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/3926:upstream-pr/3926'
git switch 'upstream-pr/3926'

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/3926'
git switch 'upstream-pr/3926'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3926'
git switch 'upstream-pr/3926'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3926'
git switch 'main'
git merge --squash 'upstream-pr/3926'
git switch 'main'
git merge --ff-only 'upstream-pr/3926'
git switch 'main'
git merge 'upstream-pr/3926'
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!3926
No description provided.