Skip to content

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

Closed
wike1701 wants to merge 1 commit into
trustno1-coder:mainfrom
wike1701:feat/wave32-water-light
Closed

wike1701 wants to merge 1 commit into
trustno1-coder:mainfrom
wike1701:feat/wave32-water-light

Conversation

@wike1701

Copy link
Copy Markdown
Contributor

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

@Yoshi-233

Copy link
Copy Markdown

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.

@trustno1-coder

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants