Scrub NaN on typed buffer stores too (VICTORY_NAN_SCRUB) #15

Closed
github-bot wants to merge 1 commit from github-bot/gh-15 into main AGit
Owner

@⁠Tissma95 on GitHub · 2026-11-27 03:22 UTC · original
Tissma95:nan-scrub-typed-stores → main · +26 −1 · 1 files · 1 commits · closed without merging

With VICTORY_NAN_SCRUB=1 (the launcher's default), the colours a pixel shader exports and float image stores already get NaN and infinities set to 0. Typed buffer stores of floats did not. A NaN that a compute pass writes through a typed buffer view could still reach the blur, the exposure and the history of the temporal upscaler.

Change (crates/victory-shader/src/emit/lower.rs, +26/−1):

  • With the switch on, the floats of a typed store are now scrubbed the same way (scrub_nan).
  • This only happens where the view-kind bits (integer_view) say the view is not of an integer format.
  • Left as they are, so integer bits are never touched:
    • halves moved as integers (the face network);
    • views of an integer format;
    • views whose kind is not read.
  • d16 data is scrubbed as it is widened.
  • VICTORY_NAN_SCRUB is already part of the shader cache key. The translator change itself renews the cache.

Why: this follows the NaN guard in codec-d/cool_fox (after Neptune-VE). That guard covers typed buffer stores as well as colour exports and image stores, and with it the blotched, painted-looking walls and skin were reported gone there. The README of this fork lists a posterized "oil paint" look that appears in some runs. On an RTX 3060 Ti (Series S, 720p), I saw a pastel look and some inverted colours.

Tested:

  • cargo test -p victory-shader --lib passes (203 passed, 2 ignored).
  • In game, on an RTX 3060 Ti 8 GB with a Ryzen 9 5900X and 32 GB of RAM (Series S, DLSS, the launcher's defaults):
    • the lighting artefacts (pastel look, some inverted colours) were much reduced compared with the run before the change;
    • vegetation still shows some of them, mostly up close;
    • no errors and no device losses;
    • the frame rate is the same (11.6 fps median against 10.9; preparing 47 ms against 54 ms, at fewer draws a frame).

🤖 Generated with Claude Code

https://claude.ai/code/session_01EPTFUmv7kwA2Jtjutdp8Sh

**@⁠Tissma95** on GitHub · 2026-11-27 03:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/15) `Tissma95:nan-scrub-typed-stores` → `main` · +26 −1 · 1 files · 1 commits · closed without merging With `VICTORY_NAN_SCRUB=1` (the launcher's default), the colours a pixel shader exports and float image stores already get NaN and infinities set to 0. Typed buffer stores of floats did not. A NaN that a compute pass writes through a typed buffer view could still reach the blur, the exposure and the history of the temporal upscaler. **Change** (`crates/victory-shader/src/emit/lower.rs`, +26/−1): - With the switch on, the floats of a typed store are now scrubbed the same way (`scrub_nan`). - This only happens where the view-kind bits (`integer_view`) say the view is not of an integer format. - Left as they are, so integer bits are never touched: - halves moved as integers (the face network); - views of an integer format; - views whose kind is not read. - d16 data is scrubbed as it is widened. - `VICTORY_NAN_SCRUB` is already part of the shader cache key. The translator change itself renews the cache. **Why:** this follows the NaN guard in codec-d/cool_fox (after Neptune-VE). That guard covers typed buffer stores as well as colour exports and image stores, and with it the blotched, painted-looking walls and skin were reported gone there. The README of this fork lists a posterized "oil paint" look that appears in some runs. On an RTX 3060 Ti (Series S, 720p), I saw a pastel look and some inverted colours. **Tested:** - `cargo test -p victory-shader --lib` passes (203 passed, 2 ignored). - In game, on an RTX 3060 Ti 8 GB with a Ryzen 9 5900X and 32 GB of RAM (Series S, DLSS, the launcher's defaults): - the lighting artefacts (pastel look, some inverted colours) were much reduced compared with the run before the change; - vegetation still shows some of them, mostly up close; - no errors and no device losses; - the frame rate is the same (11.6 fps median against 10.9; preparing 47 ms against 54 ms, at fewer draws a frame). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EPTFUmv7kwA2Jtjutdp8Sh
With VICTORY_NAN_SCRUB=1 (the launcher's default) the colours pixel
shaders export and float image stores already have NaN and infinities
made 0. Typed buffer stores of floats were left as they were, so a NaN a
compute pass writes through a typed buffer view could still reach the
blur, the exposure and the temporal upscaler's history.

The floats of a typed store are now scrubbed the same way, where the
view-kind bits (integer_view) say the view is not of an integer format.
Halves moved as integers (the face network), integer views and views
whose kind is not read are left as they are, so integer bits are never
touched. d16 data is scrubbed as it is widened.

After codec-d/cool_fox (Neptune-VE's NaN guard), which covers typed
buffer stores beside colour exports and image stores, and with which the
blotched, painted-looking walls and skin were reported gone there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EPTFUmv7kwA2Jtjutdp8Sh
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:26:46 +00:00
Author
Owner

@⁠Tissma95 on GitHub · 2026-11-27 03:56 UTC · original

Follow-up: on a later run the pastel look and the wrong vegetation colours came back with the same build and VICTORY_NAN_SCRUB=1, so the improvement I saw may have been a good run rather than this change. It is still correct as a scrub of typed stores, but I can't claim it fixes the oil-paint look.

**@⁠Tissma95** on GitHub · 2026-11-27 03:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/15#issuecomment-7209385957) Follow-up: on a later run the pastel look and the wrong vegetation colours came back with the same build and VICTORY_NAN_SCRUB=1, so the improvement I saw may have been a good run rather than this change. It is still correct as a scrub of typed stores, but I can't claim it fixes the oil-paint look.
github-bot closed this pull request 2026-11-27 04:20:23 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.