shader: choose the first-lane half with one select (fixes NVIDIA 595.x 24px tile-sort bars) #1518

Open
faycalbaklouti wants to merge 1 commit from upstream-pr/1518 into main
faycalbaklouti commented 2026-11-28 17:35:32 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by faycalbaklouti on 2026-11-28T17:35:32Z.


Problem

When emulating a 64-lane console wave across two 32-lane NVIDIA host waves, readfirstlane (emit/lower.rs) chooses the lower half's value when the lower half has any lane in EXEC, the upper half's when only the upper half has a lane in EXEC, and the lower half's (lane 0) when neither half does.

Previously this was emitted as a nested select (select(in_lo, lo, select(in_hi, hi, lo))). On NVIDIA driver 595.112.07, the DXIL compiler miscompiles that nested select and returns the upper half (hi) even when the lower half has an active lane (in_lo == true). In the title's 80x45 lighting tile-sort pass, the running sum through readfirstlane collapses to a single wave's counts (71 of 1,193 tiles lit), producing severe 24-pixel-tall horizontal orange/amber light bars across hair, faces, and interior walls (620.70.06 handles both forms, while 595.112.07 breaks on the nested select).

Solution

  • Replace the nested select in crates/victory-shader/src/emit/lower.rs with a single select on And(Eq(lo_has, 0), Ne(hi_has, 0)) (select(upper, hi, lo)), which is semantically identical in all four (lo_has, hi_has) truth-table cases and avoids the NVIDIA 595.x DXIL compiler miscompilation.

Verification

  • cargo test -p victory-shader --lib passes with 0 failures on this branch.
  • Verified on Linux + NVIDIA 595.112.07 (RTX 5090) and 620.70.06 across dorm, walk-around, and cafeteria scenes: eliminates 100% of the 24px-row horizontal amber/orange bars on 595.112.07 with zero regression on 620.70.06.

About our fork & censorship-resistant preservation effort:
This fix comes from our open-source Linux (GE-Proton) + NVIDIA porting effort (gta6-vi-port) and censorship-resistant peer-to-peer Radicle archival hub (234+ community porting repos mirrored & seeded on P2P Radicle so community research survives takedowns):

<!-- greyfinch-sync:fxceless/victory-fork:issue:5542869732 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1518). Originally posted by [faycalbaklouti](https://github.com/faycalbaklouti) on 2026-11-28T17:35:32Z. --- ## Problem When emulating a 64-lane console wave across two 32-lane NVIDIA host waves, `readfirstlane` (`emit/lower.rs`) chooses the lower half's value when the lower half has any lane in `EXEC`, the upper half's when only the upper half has a lane in `EXEC`, and the lower half's (lane 0) when neither half does. Previously this was emitted as a nested `select` (`select(in_lo, lo, select(in_hi, hi, lo))`). On NVIDIA driver `595.112.07`, the DXIL compiler miscompiles that nested select and returns the upper half (`hi`) even when the lower half has an active lane (`in_lo == true`). In the title's 80x45 lighting tile-sort pass, the running sum through `readfirstlane` collapses to a single wave's counts (71 of 1,193 tiles lit), producing severe 24-pixel-tall horizontal orange/amber light bars across hair, faces, and interior walls (`620.70.06` handles both forms, while `595.112.07` breaks on the nested select). ## Solution - Replace the nested `select` in `crates/victory-shader/src/emit/lower.rs` with a single `select` on `And(Eq(lo_has, 0), Ne(hi_has, 0))` (`select(upper, hi, lo)`), which is semantically identical in all four `(lo_has, hi_has)` truth-table cases and avoids the NVIDIA `595.x` DXIL compiler miscompilation. ## Verification - `cargo test -p victory-shader --lib` passes with 0 failures on this branch. - Verified on Linux + NVIDIA `595.112.07` (RTX 5090) and `620.70.06` across dorm, walk-around, and cafeteria scenes: eliminates 100% of the 24px-row horizontal amber/orange bars on `595.112.07` with zero regression on `620.70.06`. --- **About our fork & censorship-resistant preservation effort:** This fix comes from our open-source Linux (GE-Proton) + NVIDIA porting effort (`gta6-vi-port`) and censorship-resistant peer-to-peer Radicle archival hub (**234+ community porting repos mirrored & seeded on P2P Radicle** so community research survives takedowns): - **Radicle Project Hub (README, forks, bring-up issues & 234+ P2P mirrors):** https://radicle.network/nodes/rosa.radicle.network/rad:z3rqQw7796wMbgj8RszExtWR4wMSE - **Live 1080p60 Open-Source Development Stream:** linked in the Radicle Project Hub README above.
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/1518:upstream-pr/1518'
git switch 'upstream-pr/1518'

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