GPU: reuse weighted terms in ambient light gather #2336

Manually merged
github merged 1 commit from github-bot/gh-2336 into main 2026-11-30 14:17:29 +00:00 AGit
Owner

@⁠yumaste on GitHub · 2026-11-29 12:08 UTC · original
yumaste:nvidia/perf-ambient-gather → main · +137 −21 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC

What it changes

The ambient estimate gathers 2,304 cells at each of 14,400 points. This pass is used by the regular victory play lighting estimate when ray tracing is off. It runs during diffuse resolve and can also run for the optional reflection estimate.

Compute the weighted direction once per cell and re-use it for the RGB moments. Accumulate each colour's scalar weight in the fourth component of its moment. Process two consecutive cells per iteration to reduce loop bookkeeping. The grid, dispatch geometry and order of accumulation stay the same. Floating-point reassociation can change the low bits.

GPU timing

D3D12 timestamps around the production gather dispatch on Intel Graphics, Windows, driver 32.0.101.8826. Both PSOs used the same synthetic 1280 × 720 depth texture and all 2,304 input cells. Each run used four warm-up samples and 19 timed samples per variant with rotated order.

Run Baseline median Candidate median Saved per dispatch
1 1.521 ms 1.356 ms 0.165 ms
2 1.486 ms 1.351 ms 0.135 ms
3 1.484 ms 1.352 ms 0.132 ms

NVIDIA timing and in-game frame times remain unmeasured.

How it was tested

  • Compared every component of the full output grid against the original shader on Intel Graphics and WARP. The largest absolute component difference in the dense fixture was about 7e-8 on both.
  • Added a WARP regression test that checks all 14,400 points against a CPU reference and uses active cells at both ends of the loop.
  • cargo test --locked -p victory-gpu --lib ambient::tests -- --test-threads=1 passed all 15 tests. The staged asset-policy check passed.

Checked for overlap

  • Checked related ambient PRs. #1736 adds an opt-in tiled mean and gather using group-shared memory. This PR reduces arithmetic in the standard gather with the existing thread layout.
**@⁠yumaste** on GitHub · 2026-11-29 12:08 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2336) `yumaste:nvidia/perf-ambient-gather` → `main` · +137 −21 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC ## What it changes The ambient estimate gathers 2,304 cells at each of 14,400 points. This pass is used by the regular `victory play` lighting estimate when ray tracing is off. It runs during diffuse resolve and can also run for the optional reflection estimate. Compute the weighted direction once per cell and re-use it for the RGB moments. Accumulate each colour's scalar weight in the fourth component of its moment. Process two consecutive cells per iteration to reduce loop bookkeeping. The grid, dispatch geometry and order of accumulation stay the same. Floating-point reassociation can change the low bits. ## GPU timing D3D12 timestamps around the production `gather` dispatch on Intel Graphics, Windows, driver 32.0.101.8826. Both PSOs used the same synthetic 1280 × 720 depth texture and all 2,304 input cells. Each run used four warm-up samples and 19 timed samples per variant with rotated order. | Run | Baseline median | Candidate median | Saved per dispatch | |---|---:|---:|---:| | 1 | 1.521 ms | 1.356 ms | 0.165 ms | | 2 | 1.486 ms | 1.351 ms | 0.135 ms | | 3 | 1.484 ms | 1.352 ms | 0.132 ms | NVIDIA timing and in-game frame times remain unmeasured. ## How it was tested - Compared every component of the full output grid against the original shader on Intel Graphics and WARP. The largest absolute component difference in the dense fixture was about `7e-8` on both. - Added a WARP regression test that checks all 14,400 points against a CPU reference and uses active cells at both ends of the loop. - `cargo test --locked -p victory-gpu --lib ambient::tests -- --test-threads=1` passed all 15 tests. The staged asset-policy check passed. ## Checked for overlap - [x] Checked related ambient PRs. #1736 adds an opt-in tiled mean and gather using group-shared memory. This PR reduces arithmetic in the standard gather with the existing thread layout.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 12:10:54 +00:00
github manually merged commit ac22b7a89c into main 2026-11-30 14:17:29 +00:00
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!2336
No description provided.