GPU: reuse weighted terms in ambient light gather #2336

Merged
yumaste merged 1 commit from upstream-pr/2336 into main 2026-11-30 14:12:03 +00:00
yumaste commented 2026-11-29 12:08:02 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by yumaste on 2026-11-29T12:08:02Z.


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.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5550550498 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2336). Originally posted by [yumaste](https://github.com/yumaste) on 2026-11-29T12:08:02Z. --- ## 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.
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
trustno1-coder/VIctory-NVIDIA!2336
No description provided.