feat(shader): wave32 water tile slot allocation and scalar loop skips #326

Closed
github-bot wants to merge 1 commit from github-bot/gh-326 into main AGit
Owner

@⁠wike1701 on GitHub · 2026-11-27 21:02 UTC · original
wike1701:feat/wave32-water-light → main · +255 −14 · 4 files · 1 commits · closed without merging

Summary

Ports Wave32 (NVIDIA) water lighting fixes from xceless/victory-fork (GPL-3.0, commits cd93552 and 299fba, building on xss3009's transmission tile allocation idea):

  1. Per-lane water tile slot allocation (emit/water_tile_slots.rs): rewrites water_shading:CS_TransmissionVolumetrics_GenerateTiles on 32-lane hosts so each lane takes its own slot via uffer_atomic_add 1 instead of letting host wave 1 overwrite host wave 0's tile slots (fixes the 16×16 dark patches on open water; disable with VICTORY_WATER_TILE_SLOTS=0). Also wired into pps/victory/src/translate.rs via emit::host_form.
  2. Scalar-test loop skips kept for wave-wide lowering (ir::without_skips(..., loops_kept)): keeps skips around loops controlled by scalar comparisons (s_cmp_* / s_bitcmp) when lowering wave-wide compute shaders (VICTORY_WAVE_LOOP_SKIPS=0 to disable), preventing empty-EXEC slice loops from spinning to the iteration limit.
  3. CS_TransmissionVolumetrics_VolumePortalsOnly wave-wide: enables wave-wide lowering for the volume-portals-only water transmission shader (10179ab7eda0dc3).

(Note: LDS init hoisting from 299fba is already submitted separately in #35, and thread-ticket group counters from 854f57f are already in main.)

Verification

  • cargo test -p victory-shader --lib -- water_tile_slots:: ir::tests:: — 12 passed, 0 failed
  • cargo check -p victory — ok (0 new warnings)
  • cargo xtask policy — 288 files ok
**@⁠wike1701** on GitHub · 2026-11-27 21:02 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/326) `wike1701:feat/wave32-water-light` → `main` · +255 −14 · 4 files · 1 commits · closed without merging ## Summary Ports Wave32 (NVIDIA) water lighting fixes from xceless/victory-fork (GPL-3.0, commits cd93552 and 299fba, building on xss3009's transmission tile allocation idea): 1. **Per-lane water tile slot allocation (emit/water_tile_slots.rs)**: rewrites water_shading:CS_TransmissionVolumetrics_GenerateTiles on 32-lane hosts so each lane takes its own slot via uffer_atomic_add 1 instead of letting host wave 1 overwrite host wave 0's tile slots (fixes the 16×16 dark patches on open water; disable with VICTORY_WATER_TILE_SLOTS=0). Also wired into pps/victory/src/translate.rs via emit::host_form. 2. **Scalar-test loop skips kept for wave-wide lowering (ir::without_skips(..., loops_kept))**: keeps skips around loops controlled by scalar comparisons (s_cmp_* / s_bitcmp) when lowering wave-wide compute shaders (VICTORY_WAVE_LOOP_SKIPS=0 to disable), preventing empty-EXEC slice loops from spinning to the iteration limit. 3. **CS_TransmissionVolumetrics_VolumePortalsOnly wave-wide**: enables wave-wide lowering for the volume-portals-only water transmission shader (10179ab7eda0dc3). *(Note: LDS init hoisting from 299fba is already submitted separately in #35, and thread-ticket group counters from 854f57f are already in main.)* ## Verification - cargo test -p victory-shader --lib -- water_tile_slots:: ir::tests:: — **12 passed, 0 failed** - cargo check -p victory — **ok** (0 new warnings) - cargo xtask policy — **288 files ok**
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:06:55 +00:00
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-28 08:43 UTC · original

I tried the scalar-loop part independently at this PR’s head, 0b881e0, using synthetic IR and loops_kept=true. All three inputs started with exactly one outer empty-EXEC skip. Both deep=false and deep=true gave the same result:

Loop inside the skip Outer skip after without_skips
v_readfirstlane_b32 supplies the initial value; scalar add, compare, branch on SCC0 Kept
v_cmp_gt_u32 followed by a VCCZ backedge to the compare Removed
Same compare followed by a VCCNZ backedge Removed

The first row verifies the scalar case on your head. The VCC cases give a small additional regression pair: with EXEC empty the comparison clears VCC, so the VCCZ backedge can keep taking the loop while VCCNZ exits immediately. The new fixture in #888 distinguishes them on current main. These are compiler results; I did not test this PR’s water-lighting changes in game.

**@⁠Yoshi-233** on GitHub · 2026-11-28 08:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/326#issuecomment-7236768137) I tried the scalar-loop part independently at this PR’s head, `0b881e0`, using synthetic IR and `loops_kept=true`. All three inputs started with exactly one outer empty-EXEC skip. Both `deep=false` and `deep=true` gave the same result: | Loop inside the skip | Outer skip after `without_skips` | | --- | --- | | `v_readfirstlane_b32` supplies the initial value; scalar add, compare, branch on SCC0 | **Kept** | | `v_cmp_gt_u32` followed by a VCCZ backedge to the compare | Removed | | Same compare followed by a VCCNZ backedge | Removed | The first row verifies the scalar case on your head. The VCC cases give a small additional regression pair: with EXEC empty the comparison clears VCC, so the VCCZ backedge can keep taking the loop while VCCNZ exits immediately. The new fixture in #888 distinguishes them on current main. These are compiler results; I did not test this PR’s water-lighting changes in game.
github-bot closed this pull request 2026-11-28 19:24:59 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-28 19:22 UTC · original

Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

**@⁠trustno1-coder** on GitHub · 2026-11-28 19:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/326#issuecomment-7244500425) Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

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/trustno1-coder--VIctory-NVIDIA!326
No description provided.