fix(gpu,shader): fix compute NaN blotches, DLSS depth/present ghosting, and neutral fallback textures #402

Merged
Androtim merged 2 commits from upstream-pr/402 into main 2026-12-03 19:28:27 +00:00
Androtim commented 2026-12-03 17:36:18 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T17:36:18Z.


Summary

Fixes three real-world visual defects reported from 4K RTX 4060 Ti 8 GB gameplay (v2026.12.03.07):

  1. Pixelated dark lighting / shadow / reflection blotches (RT-SW):

    • Implements VICTORY_NAN_SCRUB (1 = float-aware + safe bit patterns preserving 0xFFFFFFFF integer masks, 2 = scrub all 32-bit image_store as float), VICTORY_NAN_SCRUB_INF, VICTORY_NAN_SCRUB_STORE_INF, and VICTORY_NAN_EXACT across compute textureStore.f32 (image_store) and pixel colour exports in victory-shader (crates/victory-shader/src/emit/hdr.rs, lower.rs). (apps/victory/src/play.rs already enabled VICTORY_NAN_SCRUB=1, which was previously unimplemented in victory-shader.)
    • Adds the VICTORY_NAN_SCRUB* and VICTORY_NAN_EXACT keys to TRANSLATOR_ENV_KEYS and bumps SHADER_CACHE_VERSION from 2 to 3 in crates/victory-gpu/src/shader_cache.rs to invalidate older cached compute DXIL entries.
    • Implements opt-in VICTORY_AMBIENT_RT=<least>[,<most>[,<level>]] in crates/victory-gpu/src/ambient.rs (expanding root constants 17 -> 18 for float least; so max(was, found * least) bounds missing/starved SW-RT diffuse areas while keeping builder_runs() untouched when VICTORY_AMBIENT_RT is unset).
  2. DLSS Super Resolution temporal ghosting & Streamline errors (crates/victory-gpu/src/streamline.rs):

    • Calls camera.planes_in_order() inside record() before camera.constants(...), fixing inverted depth planes (camera_near=10000.0, camera_far=0.15 causing an infinite projection fallback in plan::projection).
    • Defaults VICTORY_STREAMLINE_PRESENT (present_hook) to ON when DLSS SR runs without Frame Generation (=0 disables), eliminating Streamline presentCommon() was not observed errors and enabling per-present retired resource cleanup and VRAM budget tracking.
    • Filters DLSS_ULTRA_QUALITY from record() getOptimalSettings probing to eliminate DLSSContext 'getOptimalSettings' returns invalid size (0 x 0) warnings, and sets camera.reset = true on resolution/mode changes or > 2 skipped-frame gaps (menus/loads).
  3. Neon-green unuploaded / evicted vehicle textures (crates/victory-gpu/src/descriptor/host.rs, crates/victory-gpu/src/resource.rs):

    • Uses neutral_for instead of null (0,0,0,0) (which YCbCr/BC5 shaders decode as neon green) in unmake(), make_at_inner(), and mirror() whenever waits_gray(&view) applies.
    • Extends neutral_of/neutral_for to 1D, 2D, 3D, and Cube textures (resource::default_view_kind), adds [0x80, 0x80, 0x80, 0xff] opaque cutout stand-ins (VICTORY_STANDIN_OPAQUE=0 disables), and excludes integer, depth, float-data, and signed normal formats (integer_format, gray_fits, waits_gray).
    • Stops check_shown_early() (VICTORY_SHOW_UPLOADED=1) from flipping neutral slots to unuploaded pooled textures on UploadWait::GiveUp, releasing NEW_PENDING ownership for the texture pass.

Upstream GPL-3.0-or-later attributions: voidopcode/vilocity, felicienradio/cold-project-vi, Aki-Developer (01f6f31), ReTerryDavis/ReVIctory, lobomfz/VIctory-xmem (#37), and Aleksesipenko/VIctory-RTX.

Rig Specs Tested On

  • GPU & OS: Reported from NVIDIA GeForce RTX 4060 Ti 8 GB (Windows 11 10.0.26300, driver 621.24); unit + D3D12 shader/descriptor tests executed locally with 1.98.1-x86_64-pc-windows-gnu toolchain.

Run Settings & Profile

  • Build & Commit SHA: fix/visuals-ghosting-and-pixelated-lighting @ eb7d35b
  • Automated Checks:
    • cargo clippy --workspace --all-targets --locked -- -D warnings (passed)
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings (passed)
    • cargo xtask policy + cargo xtask policy --staged (353 files ok / 9 files ok)
    • cargo test --locked -p xtask (8 passed; 0 failed)
    • cargo test -p victory-gpu --locked -- --test-threads=1 (868 passed; 0 failed; 39 ignored)
    • Targeted victory-shader GPU/unit tests (image_store_nan_scrub_modes_work_on_gpu, a_packed_word_is_stored_bit_for_bit, clamp: 6 passed; 0 failed; 418 filtered out)
    • Workspace crates (victory, victory-formats, victory-core, victory-hle, victory-pe, victory-pipeline, victory-game, victory-loader --lib all passed)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5631707608 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/402). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T17:36:18Z. --- ## Summary Fixes three real-world visual defects reported from 4K RTX 4060 Ti 8 GB gameplay (`v2026.12.03.07`): 1. **Pixelated dark lighting / shadow / reflection blotches (RT-SW):** - Implements `VICTORY_NAN_SCRUB` (`1` = float-aware + safe bit patterns preserving `0xFFFFFFFF` integer masks, `2` = scrub all 32-bit `image_store` as float), `VICTORY_NAN_SCRUB_INF`, `VICTORY_NAN_SCRUB_STORE_INF`, and `VICTORY_NAN_EXACT` across compute `textureStore.f32` (`image_store`) and pixel colour exports in `victory-shader` (`crates/victory-shader/src/emit/hdr.rs`, `lower.rs`). (`apps/victory/src/play.rs` already enabled `VICTORY_NAN_SCRUB=1`, which was previously unimplemented in `victory-shader`.) - Adds the `VICTORY_NAN_SCRUB*` and `VICTORY_NAN_EXACT` keys to `TRANSLATOR_ENV_KEYS` and bumps `SHADER_CACHE_VERSION` from `2` to `3` in `crates/victory-gpu/src/shader_cache.rs` to invalidate older cached compute DXIL entries. - Implements opt-in `VICTORY_AMBIENT_RT=<least>[,<most>[,<level>]]` in `crates/victory-gpu/src/ambient.rs` (expanding root constants `17 -> 18` for `float least;` so `max(was, found * least)` bounds missing/starved SW-RT diffuse areas while keeping `builder_runs()` untouched when `VICTORY_AMBIENT_RT` is unset). 2. **DLSS Super Resolution temporal ghosting & Streamline errors (`crates/victory-gpu/src/streamline.rs`):** - Calls `camera.planes_in_order()` inside `record()` before `camera.constants(...)`, fixing inverted depth planes (`camera_near=10000.0, camera_far=0.15` causing an infinite projection fallback in `plan::projection`). - Defaults `VICTORY_STREAMLINE_PRESENT` (`present_hook`) to ON when DLSS SR runs without Frame Generation (`=0` disables), eliminating `Streamline presentCommon() was not observed` errors and enabling per-present retired resource cleanup and VRAM budget tracking. - Filters `DLSS_ULTRA_QUALITY` from `record()` `getOptimalSettings` probing to eliminate `DLSSContext 'getOptimalSettings' returns invalid size (0 x 0)` warnings, and sets `camera.reset = true` on resolution/mode changes or `> 2` skipped-frame gaps (menus/loads). 3. **Neon-green unuploaded / evicted vehicle textures (`crates/victory-gpu/src/descriptor/host.rs`, `crates/victory-gpu/src/resource.rs`):** - Uses `neutral_for` instead of null `(0,0,0,0)` (which YCbCr/BC5 shaders decode as neon green) in `unmake()`, `make_at_inner()`, and `mirror()` whenever `waits_gray(&view)` applies. - Extends `neutral_of`/`neutral_for` to 1D, 2D, 3D, and Cube textures (`resource::default_view_kind`), adds `[0x80, 0x80, 0x80, 0xff]` opaque cutout stand-ins (`VICTORY_STANDIN_OPAQUE=0` disables), and excludes integer, depth, float-data, and signed normal formats (`integer_format`, `gray_fits`, `waits_gray`). - Stops `check_shown_early()` (`VICTORY_SHOW_UPLOADED=1`) from flipping neutral slots to unuploaded pooled textures on `UploadWait::GiveUp`, releasing `NEW_PENDING` ownership for the texture pass. *Upstream GPL-3.0-or-later attributions: `voidopcode/vilocity`, `felicienradio/cold-project-vi`, `Aki-Developer` (`01f6f31`), `ReTerryDavis/ReVIctory`, `lobomfz/VIctory-xmem` (#37), and `Aleksesipenko/VIctory-RTX`.* ## Rig Specs Tested On - **GPU & OS:** Reported from NVIDIA GeForce RTX 4060 Ti 8 GB (Windows 11 10.0.26300, driver 621.24); unit + D3D12 shader/descriptor tests executed locally with `1.98.1-x86_64-pc-windows-gnu` toolchain. ## Run Settings & Profile - **Build & Commit SHA:** `fix/visuals-ghosting-and-pixelated-lighting` @ `eb7d35b` - **Automated Checks:** - [x] `cargo clippy --workspace --all-targets --locked -- -D warnings` (passed) - [x] `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` (passed) - [x] `cargo xtask policy` + `cargo xtask policy --staged` (`353 files ok` / `9 files ok`) - [x] `cargo test --locked -p xtask` (`8 passed; 0 failed`) - [x] `cargo test -p victory-gpu --locked -- --test-threads=1` (`868 passed; 0 failed; 39 ignored`) - [x] Targeted `victory-shader` GPU/unit tests (`image_store_nan_scrub_modes_work_on_gpu`, `a_packed_word_is_stored_bit_for_bit`, `clamp`: `6 passed; 0 failed; 418 filtered out`) - [x] Workspace crates (`victory`, `victory-formats`, `victory-core`, `victory-hle`, `victory-pe`, `victory-pipeline`, `victory-game`, `victory-loader --lib` all passed)
Androtim commented 2026-12-03 18:04:03 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T18:04:03Z.


Triage (eb7d35ba, CI check PASS):

  • The three core visual fixes — implementing VICTORY_NAN_SCRUB in victory-shader (already enabled by play.rs), DLSS camera.planes_in_order() + default-on VICTORY_STREAMLINE_PRESENT, and default-on neutral_for stand-in textures stopping neon-green unuploaded vehicles — are high-impact and clean.
  • Marked triage: needs work for one policy violation + cross-PR conflict:
    • VICTORY_AMBIENT_RT=<least>[,<most>[,<level>]] in crates/victory-gpu/src/ambient.rs is a new opt-in toggle (only =0 kill-switches for default-on replacements are allowed) AND its WORDS 17 -> 18 expansion directly collides with #401's chroma_scrub WORDS = 18 in ambient.rs.
    • Please drop opt-in VICTORY_AMBIENT_RT from this PR (or make any verified fix default-on with a =0 kill-switch after coordinating ambient.rs with #401).
  • Also note SHADER_CACHE_VERSION 2 -> 3 in shader_cache.rs overlaps #381 (will need clean bump if #381 lands first). After resolving VICTORY_AMBIENT_RT, proceed to Gate 2 Audit (#282) + Gate 3 plain---release A/B + --features diagnostics visual PNGs.
<!-- greyfinch-sync:Androtim/MiniVI:comment:7387545106 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/402#issuecomment-7387545106). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T18:04:03Z. --- Triage (`eb7d35ba`, **CI `check` PASS**): - The three core visual fixes — implementing `VICTORY_NAN_SCRUB` in `victory-shader` (already enabled by `play.rs`), DLSS `camera.planes_in_order()` + default-on `VICTORY_STREAMLINE_PRESENT`, and default-on `neutral_for` stand-in textures stopping neon-green unuploaded vehicles — are high-impact and clean. - **Marked `triage: needs work` for one policy violation + cross-PR conflict:** - `VICTORY_AMBIENT_RT=<least>[,<most>[,<level>]]` in `crates/victory-gpu/src/ambient.rs` is a **new opt-in toggle** (only `=0` kill-switches for default-on replacements are allowed) AND its `WORDS 17 -> 18` expansion directly collides with `#401`'s `chroma_scrub` `WORDS = 18` in `ambient.rs`. - Please drop opt-in `VICTORY_AMBIENT_RT` from this PR (or make any verified fix default-on with a `=0` kill-switch after coordinating `ambient.rs` with `#401`). - Also note `SHADER_CACHE_VERSION` `2 -> 3` in `shader_cache.rs` overlaps `#381` (will need clean bump if `#381` lands first). After resolving `VICTORY_AMBIENT_RT`, proceed to **Gate 2 Audit (`#282`)** + **Gate 3 plain-`--release` A/B + `--features diagnostics` visual PNGs**.
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
Androtim/MiniVI!402
No description provided.