ambient,play: scrub NaN/Inf probes in raise and reserve VRAM headroom for multi-FG #521

Merged
Wiktorxd-1 merged 2 commits from upstream-pr/521 into main 2026-11-28 19:39:39 +00:00
Wiktorxd-1 commented 2026-11-27 23:58:03 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Wiktorxd-1 on 2026-11-27T23:58:03Z.


What this fixes

  1. Rectangular light/bloom artifacts in ambient::raise (crates/victory-gpu/src/ambient.rs): 826ba15 already drops magenta/violet probe garbage in was = unpack(light[p]), but NaN, Inf, or negative values in was or found bypass both inequalities (NaN < ... and NaN > ... are false in HLSL) and get written back to light[p], where bloom/blur spreads them into bright/dark rectangular blocks across characters and surfaces.
  2. Texture queue backup & VRAM spill with multi-frame generation (scripts/play-foxhound.ps1): On a 12 GB RTX 5070 with FrameGenX > 2 (up to 6x), VICTORY_TEXTURE_ROOM_PERCENT=80 + render targets + Streamline buffers exceeded the 10.8 GB budget, spilling 5–6 GB into shared system RAM while 11,299 textures waited in the queue at 16 ms/pass.

The commits

  1. Scrub NaN, Inf, and negative values in ambient::raise (if (any(isnan(...)) || any(isinf(...)) || any(... < 0.0)) ... = 0.0;) on both found and was.
  2. Reserve 74% texture room for FrameGenX > 2 and raise VICTORY_TEXTURE_STAGE_MS to 32 in play-foxhound.ps1.

Tests

  • cargo test --locked -p victory-gpu --lib ambient (passed, 0 failed)
  • cargo build --release --locked -p victory (succeeded)
  • Launched target\release\victory.exe via scripts\play-nvidia.ps1 (35s, ALIVE_AFTER_35S=True, warns=0, crashes.log=False).

Setup

NVIDIA GeForce RTX 5070, driver 621.14.0, Windows 11 (10.0.26300). Series S profile, DLSS Performance, Frame Generation 6x. My own dump: <game dir>. No game files are attached or quoted.

This change and its testing were done with an AI assistant (Antigravity), and I checked the results on my machine.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5534678594 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/521). Originally posted by [Wiktorxd-1](https://github.com/Wiktorxd-1) on 2026-11-27T23:58:03Z. --- ## What this fixes 1. **Rectangular light/bloom artifacts in `ambient::raise` (`crates/victory-gpu/src/ambient.rs`)**: `826ba15` already drops magenta/violet probe garbage in `was = unpack(light[p])`, but `NaN`, `Inf`, or negative values in `was` or `found` bypass both inequalities (`NaN < ...` and `NaN > ...` are `false` in HLSL) and get written back to `light[p]`, where bloom/blur spreads them into bright/dark rectangular blocks across characters and surfaces. 2. **Texture queue backup & VRAM spill with multi-frame generation (`scripts/play-foxhound.ps1`)**: On a 12 GB RTX 5070 with `FrameGenX > 2` (up to `6x`), `VICTORY_TEXTURE_ROOM_PERCENT=80` + render targets + Streamline buffers exceeded the `10.8 GB` budget, spilling `5–6 GB` into shared system RAM while `11,299` textures waited in the queue at `16 ms/pass`. ## The commits 1. **Scrub `NaN`, `Inf`, and negative values in `ambient::raise`** (`if (any(isnan(...)) || any(isinf(...)) || any(... < 0.0)) ... = 0.0;`) on both `found` and `was`. 2. **Reserve `74%` texture room for `FrameGenX > 2` and raise `VICTORY_TEXTURE_STAGE_MS` to `32` in `play-foxhound.ps1`**. ## Tests - `cargo test --locked -p victory-gpu --lib ambient` (passed, 0 failed) - `cargo build --release --locked -p victory` (succeeded) - Launched `target\release\victory.exe` via `scripts\play-nvidia.ps1` (`35s`, `ALIVE_AFTER_35S=True`, `warns=0`, `crashes.log=False`). ## Setup NVIDIA GeForce RTX 5070, driver `621.14.0`, Windows 11 (`10.0.26300`). Series S profile, DLSS Performance, Frame Generation 6x. My own dump: `<game dir>`. No game files are attached or quoted. This change and its testing were done with an AI assistant (Antigravity), and I checked the results on my machine.
Machad3x commented 2026-11-28 01:27:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Machad3x on 2026-11-28T01:27:43Z.


Tested in a batch on an RTX 3080 Ti + Ryzen 7 5700X, 1440p, DLSS Quality, title ray tracing on (VICTORY_BVH_BUILDER=1), 240 s run into the prison cell scene. Batch: #516, #501, #498, #497, #532, #521.
Result: alive for the whole run, 61.5-63.9 ms/frame, 1 draw/frame dropped (not from this batch), no shader or pipeline refused.

Bug found: with this PR the right side of the cell went darker. When raise saw a NaN/Inf in any one channel of the probe result, it zeroed the whole result. The fix scrubs each channel on its own:

found = (isnan(found) || isinf(found)) ? 0.0 : max(found, 0.0);

(the same for was), with a test that a single bad channel leaves the other channels alone. After the fix the picture matched the run without the PR, and frame time was unchanged. Commit: Machad3x/VIctory-nvidia@cd1731ad

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7231681881 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/521#issuecomment-7231681881). Originally posted by [Machad3x](https://github.com/Machad3x) on 2026-11-28T01:27:43Z. --- Tested in a batch on an RTX 3080 Ti + Ryzen 7 5700X, 1440p, DLSS Quality, title ray tracing on (VICTORY_BVH_BUILDER=1), 240 s run into the prison cell scene. Batch: #516, #501, #498, #497, #532, #521. Result: alive for the whole run, 61.5-63.9 ms/frame, 1 draw/frame dropped (not from this batch), no shader or pipeline refused. Bug found: with this PR the right side of the cell went darker. When `raise` saw a NaN/Inf in any one channel of the probe result, it zeroed the whole result. The fix scrubs each channel on its own: ``` found = (isnan(found) || isinf(found)) ? 0.0 : max(found, 0.0); ``` (the same for `was`), with a test that a single bad channel leaves the other channels alone. After the fix the picture matched the run without the PR, and frame time was unchanged. Commit: Machad3x/VIctory-nvidia@cd1731ad
Wiktorxd-1 commented 2026-11-28 12:25:30 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Wiktorxd-1 on 2026-11-28T12:25:30Z.


Good catch @Machad3x — updated
aise\ to scrub each channel independently (isnan || isinf) ? 0.0 : max(..., 0.0) for both \ ound\ and \was, and added \scrub_channel_keeps_valid_channels. Verified with \cargo test -p victory-gpu ambient\ (6 passed, including \ he_passes_build).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239217866 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/521#issuecomment-7239217866). Originally posted by [Wiktorxd-1](https://github.com/Wiktorxd-1) on 2026-11-28T12:25:30Z. --- Good catch @Machad3x — updated \ aise\ to scrub each channel independently (\(isnan || isinf) ? 0.0 : max(..., 0.0)\) for both \ ound\ and \was\, and added \scrub_channel_keeps_valid_channels\. Verified with \cargo test -p victory-gpu ambient\ (6 passed, including \ he_passes_build\).
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!521
No description provided.