Shaders: pair surface water lighting on Wave32 for F1 and CLI #1935

Open
github-bot wants to merge 9 commits from github-bot/gh-1935 into main AGit
Owner

@⁠xss3009 on GitHub · 2026-11-29 03:24 UTC · original
xss3009:fix/wave32-water-menu-main → main · +2875 −530 · 41 files · 9 commits · open

Supersedes #742 on current main, based on 568c5e5. The Wave32 tile allocator from #45 is already in the base and is unchanged.

Changes

  • Use paired Wave64 lowering for the exact surface-light programs 5dc3b25986622949 and 6f225b641c5b0708 on Wave32. Keep the existing wave-wide fallback, underwater path, and separate volume-portal switch.
  • Use one water-light predicate for pipeline creation and paired lowering. Saving F1 Water Light On writes an empty value, which victory play unsets. An unset value and explicit 1 both enable the paired route. Saved 0 still skips both water passes on Wave32.
  • Include the water switches in the shader cache key. VICTORY_WATER_WAVE_PAIRS=0 keeps the passes enabled and selects the existing lowering for comparison.

RTX 5070 Ti verification

Windows 11, driver 621.24, Wave32, Series X, 1080p internal resolution and 1440p output. DLSS, frame generation, and the BVH builder were off. I loaded copies of the same first-boat checkpoint and used the aft camera at the bridge approach, then the same two-second forward input. The capture times within the mission differ.

Start path Runtime switches and pipeline result Bridge and moving water samples
F1 Water Light On, saved and restarted without a CLI override Both consumers used paired lowering and created D3D12 compute PSOs 48 presented frames, no rectangular waterline flicker observed
Saved Off plus --set VICTORY_WATER_LIGHT=1 Both consumers used paired lowering and created D3D12 compute PSOs 48 presented frames, no rectangular waterline flicker observed

The setup run with F1 Off logged both surface-light pipelines as excluded. The two On routes produced identical bytecode for both consumers in offline DXIL validation. The generator and both consumers passed that validation. Two synthetic paired-lowering tests also passed on the 5070 Ti against CPU reference results. Frame captures and added logging were local diagnostics.

Baseline checks

The Windows diagnostics build passed. The emitter suite had 263 passes and one failure on this Windows installation. The same D3D12 WARP test fails on unmodified 568c5e5 because its software adapter exposes SM 6.2. The asset-policy size check also fails on the base for emit/lower.rs (711,512 bytes against 655,360), and still fails after the port (722,507 bytes). The patch contains source and README changes only.

Paired lowering comes from Geckomacabre and TaynanGT (Vice-Tay #208). Yoshi-233 identified the F1/CLI mismatch in #742. Codex (GPT-6.2-sol) assisted with the port and verification.

**@⁠xss3009** on GitHub · 2026-11-29 03:24 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1935) `xss3009:fix/wave32-water-menu-main` → `main` · +2875 −530 · 41 files · 9 commits · open Supersedes #742 on current `main`, based on `568c5e5`. The Wave32 tile allocator from #45 is already in the base and is unchanged. ## Changes - Use paired Wave64 lowering for the exact surface-light programs `5dc3b25986622949` and `6f225b641c5b0708` on Wave32. Keep the existing wave-wide fallback, underwater path, and separate volume-portal switch. - Use one water-light predicate for pipeline creation and paired lowering. Saving F1 Water Light On writes an empty value, which `victory play` unsets. An unset value and explicit `1` both enable the paired route. Saved `0` still skips both water passes on Wave32. - Include the water switches in the shader cache key. `VICTORY_WATER_WAVE_PAIRS=0` keeps the passes enabled and selects the existing lowering for comparison. ## RTX 5070 Ti verification Windows 11, driver 621.24, Wave32, Series X, 1080p internal resolution and 1440p output. DLSS, frame generation, and the BVH builder were off. I loaded copies of the same first-boat checkpoint and used the aft camera at the bridge approach, then the same two-second forward input. The capture times within the mission differ. | Start path | Runtime switches and pipeline result | Bridge and moving water samples | | --- | --- | --- | | F1 Water Light On, saved and restarted without a CLI override | Both consumers used paired lowering and created D3D12 compute PSOs | 48 presented frames, no rectangular waterline flicker observed | | Saved Off plus `--set VICTORY_WATER_LIGHT=1` | Both consumers used paired lowering and created D3D12 compute PSOs | 48 presented frames, no rectangular waterline flicker observed | The setup run with F1 Off logged both surface-light pipelines as excluded. The two On routes produced identical bytecode for both consumers in offline DXIL validation. The generator and both consumers passed that validation. Two synthetic paired-lowering tests also passed on the 5070 Ti against CPU reference results. Frame captures and added logging were local diagnostics. ## Baseline checks The Windows diagnostics build passed. The emitter suite had 263 passes and one failure on this Windows installation. The same D3D12 WARP test fails on unmodified `568c5e5` because its software adapter exposes SM 6.2. The asset-policy size check also fails on the base for `emit/lower.rs` (711,512 bytes against 655,360), and still fails after the port (722,507 bytes). The patch contains source and README changes only. Paired lowering comes from Geckomacabre and TaynanGT (Vice-Tay #208). Yoshi-233 identified the F1/CLI mismatch in #742. **Codex (GPT-6.2-sol)** assisted with the port and verification.
Rework #742 on current main after #45. Use the paired Wave64
lowering for the two known surface lighting compute programs on
32-lane hosts. Keep #45's tile append rewrite and the separate
volume-portals setting.

Share the water light predicate between pipeline creation and shader
translation. F1 On saves an empty value that play unsets. An unset value
and explicit 1 take the same paired route, and explicit 0 still skips
both surface lighting passes on Wave32.

Paired lowering is from Geckomacabre and TaynanGT (Vice-Tay #208).
Yoshi-233 identified the menu and command-line mismatch in #742.
Codex (GPT-6.2-sol) assisted with the port and verification.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 03:28:06 +00:00
Use checked division and fix the remaining Clippy warnings in the live
GPU crate. Move image lowering and the inline lowering tests into child
modules so the shader emitter respects the existing 640 KiB policy.

Always validate the wave-width-neutral fixture and its barrier counts.
When WARP is below SM 6.6, use compatible hardware for execution when
available. Account for both test-only shader switches in the cache audit,
and hold the guard lock while observing the synthetic late fault.

The three water shader DXIL hashes match the prior revision with F1 On,
CLI On and Off. Codex (GPT-6.2-sol) assisted with this follow-up.
Always lower and validate every NV05D1 case. Run the readback comparison
when a compatible device is available, and keep pipeline creation,
dispatch and output mismatches fatal on that device.
Keep the current shader analysis and image lowering, and integrate the
paired water entry points and cache switches. Keep upstream's fallback
present unlock and the regression tests from both branches.

Use the widened vector register indices for paired LDS reads. Lower
atomic subtraction as an add of the negated operand, following main's
removal of the unsupported DXIL atomic subtraction.

Water source fixtures validate with F1 and CLI taking the same paired
route. The RTX 5070 Ti passed the focused Wave32 readback tests.
Codex (GPT-6.2-sol) assisted with the merge resolution.
Keep both Windows Clippy configurations clean. Fix the diagnostics-only
build errors and use the Win32 file lock so the pipeline cache still
supports the declared Rust 1.88 minimum.

Derive the frame-user test selection from its existing setup table,
excluding the same five sites as before. This preserves all 298 tested
sites and removes the duplicated offset list that tripped the asset
scanner. The asset policy and the runtime hook tables are unchanged.

Codex (GPT-6.2-sol) assisted with the CI repair and verification.
Update the independent BCPack oracle to read the corrected BC7 dictionary
layout. The production decoder stays unchanged.

Launch Windows PowerShell by its system path when restarting the menu.
Isolate the range-lock test in its own process. Keep the cross-wave UAV
barrier checks independent of whether both SM 6.6 backends are present,
and compare every lane on each backend that is available.
Keep lowering and DXIL checks on all runners. If WARP refuses a Wave32
pipeline, compare a known-good control with and without WaveSize(32)
before treating the refusal as a backend limitation. A device that can
run the fixture must execute it. VICTORY_REQUIRE_HW_GPU still requires
a real hardware readback.
Author
Owner

@⁠nick0451 on GitHub · 2026-11-29 13:26 UTC · original

Checked against current main, alongside #1926 (which turns these programs off instead). RTX 3090 (32-lane), Windows 11, this PR merged onto main 829188e9 (+ a local 2-line start fix, #1625).

  • victory translate --list, VICTORY_HOST_WAVE=32, every output hash against main: of 25,789 shaders, exactly 2 differ: water_shading:CS_TransmissionVolumetrics_Tiled (5dc3b25986622949) and _Tiled_LocalLights (6f225b641c5b0708), the two #1926 leaves out. Nothing else changes and nothing new is refused.
  • In game, VICTORY_WATER_LIGHT unset so both programs run (both logged as made), a save looking over open water at 100-300 m, 2 rounds each: 25.2 fps against main's 25.0, the same lit turquoise water, and no blocks in view in either. The blocks of #739 are reported close to boats and under water. I couldn't get the camera there, so that part is untested here.

So if the close-up blocks are gone with this, it keeps the lit water that #1926 would trade away. (On this card the programs cost nothing measurable at this distance: #1926 comment.)

🤖 Generated with Claude Code

**@⁠nick0451** on GitHub · 2026-11-29 13:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1935#issuecomment-7256534493) Checked against current main, alongside #1926 (which turns these programs off instead). RTX 3090 (32-lane), Windows 11, this PR merged onto main `829188e9` (+ a local 2-line start fix, #1625). - **`victory translate --list`, `VICTORY_HOST_WAVE=32`, every output hash against main:** of 25,789 shaders, **exactly 2 differ**: `water_shading:CS_TransmissionVolumetrics_Tiled` (`5dc3b25986622949`) and `_Tiled_LocalLights` (`6f225b641c5b0708`), the two #1926 leaves out. Nothing else changes and nothing new is refused. - **In game**, `VICTORY_WATER_LIGHT` unset so both programs run (both logged as made), a save looking over open water at 100-300 m, 2 rounds each: 25.2 fps against main's 25.0, the same lit turquoise water, and no blocks in view in either. The blocks of #739 are reported close to boats and under water. I couldn't get the camera there, so that part is untested here. So if the close-up blocks are gone with this, it keeps the lit water that #1926 would trade away. (On this card the programs cost nothing measurable at this distance: #1926 comment.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠sergiogbrox on GitHub · 2026-11-30 20:09 UTC · original

A data point from a game run, for comparison with this PR's route.

I built v2026.11.30.03 with the water changes from the foxhound fork's 85b56b9 (readmet3xt-lab/foxhound, GPL-3.0, co-authored with xss3009) instead of this PR: every lane of the slab loop stores the column in 5dc3b25986622949 and 6f225b641c5b0708 (s_and_saveexec -> s_mov exec, VICTORY_WATER_ALL_WRITE), and GenerateTiles puts the local-light tiles in the plain list (VICTORY_WATER_LOCAL_PLAIN). That commit was checked only in a capture replay ("Not yet seen in a run of the game"), so this is its first run in the game that I know of.

RTX 5060 Ti 16 GB (32-lane), driver 621.40, Ryzen 7 5700X, Windows 11, 2560x1440, DLSS Balanced, frame generation 2x, VICTORY_WATER_LIGHT=1.

  • Both programs ran; the run logged pipeline failures: 0 host pipelines failed, 0 shaders do not translate.
  • Shoreline, open sea and the water close beside a boat: the water is lit and no dark blocks were seen. Not checked underwater.
  • Against .30.02 with the water light left out (the 32-lane default), from the same save, played freely (not a fixed route): median 18.1 fps in both, 10th percentile 14.6 against 14.1. This machine is CPU-bound (about 38 ms a frame preparing), so a GPU cost under that would not show here.

The cost of this route: the local-light tiles lose the local lights' glow in the water volume, because _Tiled_LocalLights still does not finish on 32 lanes there. If this PR's paired lowering makes _Tiled_LocalLights finish, it keeps that glow, so this is mostly useful as a second way to check the same blocks, close to a boat, where the check in the comment above could not get the camera. The build also carries foxhound 4ec928a (GpuParticleEmit _AttachMesh widened to 64), which does not touch water.

🤖 Generated with Claude Code

**@⁠sergiogbrox** on GitHub · 2026-11-30 20:09 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1935#issuecomment-7290503175) A data point from a game run, for comparison with this PR's route. I built `v2026.11.30.03` with the water changes from the foxhound fork's 85b56b9 (readmet3xt-lab/foxhound, GPL-3.0, co-authored with xss3009) instead of this PR: every lane of the slab loop stores the column in `5dc3b25986622949` and `6f225b641c5b0708` (`s_and_saveexec` -> `s_mov exec`, `VICTORY_WATER_ALL_WRITE`), and GenerateTiles puts the local-light tiles in the plain list (`VICTORY_WATER_LOCAL_PLAIN`). That commit was checked only in a capture replay ("Not yet seen in a run of the game"), so this is its first run in the game that I know of. RTX 5060 Ti 16 GB (32-lane), driver 621.40, Ryzen 7 5700X, Windows 11, 2560x1440, DLSS Balanced, frame generation 2x, `VICTORY_WATER_LIGHT=1`. - Both programs ran; the run logged `pipeline failures: 0 host pipelines failed, 0 shaders do not translate`. - Shoreline, open sea and the water close beside a boat: the water is lit and no dark blocks were seen. Not checked underwater. - Against `.30.02` with the water light left out (the 32-lane default), from the same save, played freely (not a fixed route): median 18.1 fps in both, 10th percentile 14.6 against 14.1. This machine is CPU-bound (about 38 ms a frame preparing), so a GPU cost under that would not show here. The cost of this route: the local-light tiles lose the local lights' glow in the water volume, because `_Tiled_LocalLights` still does not finish on 32 lanes there. If this PR's paired lowering makes `_Tiled_LocalLights` finish, it keeps that glow, so this is mostly useful as a second way to check the same blocks, close to a boat, where the check in the comment above could not get the camera. The build also carries foxhound 4ec928a (GpuParticleEmit `_AttachMesh` widened to 64), which does not touch water. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/victory-formats/src/bcpack.rs
  • crates/victory-gpu/src/copystat.rs
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/host/panel.rs
  • crates/victory-gpu/src/host/recycle.rs
  • crates/victory-gpu/src/memory.rs
  • crates/victory-gpu/src/pipeline.rs
  • crates/victory-gpu/src/pipeline/library.rs
  • crates/victory-gpu/src/pipeline/make.rs
  • crates/victory-gpu/src/resource.rs
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-gpu/src/shadow.rs
  • crates/victory-gpu/src/streamline.rs
  • crates/victory-hle/src/modules/gameinput.rs
  • crates/victory-hle/src/modules/lifecycle.rs
  • crates/victory-loader/src/crash.rs
  • crates/victory-shader/src/emit/intersect_tests.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
  • crates/victory-shader/src/emit/wave64_tests.rs
  • crates/victory-shader/src/native.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1935/head:github-bot/gh-1935'
git switch 'github-bot/gh-1935'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1935'
git switch 'github-bot/gh-1935'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1935'
git switch 'github-bot/gh-1935'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1935'
git switch 'main'
git merge --squash 'github-bot/gh-1935'
git switch 'main'
git merge --ff-only 'github-bot/gh-1935'
git switch 'main'
git merge 'github-bot/gh-1935'
git push origin 'main'
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!1935
No description provided.