1D, 3D and cube slots waiting for their texture show a gray stand-in of their kind, not black (VICTORY_NEUTRAL_ALL_KINDS) #3780

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

@⁠Mikey970 on GitHub · 2026-11-30 06:51 UTC · original
Mikey970:pr/neutral-all-kinds → main · +210 −95 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC

[pr-fix] Textures: 1D, 3D and cube slots waiting for their texture show a gray stand-in of their kind, not black (VICTORY_NEUTRAL_ALL_KINDS)

Fixes #

What it changes

When a texture slot has no texture to show yet (its texture is still waiting for its upload, was never made, or was let go), descriptor/host.rs neutral_for gives it the 1x1 gray (0x80) stand-in. That only works for 2D views and 2D arrays. A 1D, 1D-array, 3D, cube or cube-array view gets null_for, a null view of its kind. A null SRV reads as zeros, so a material sampling a volume or a cube at that moment reads black, where a 2D texture in the same state already reads gray.

This change:

  • makes neutral() into neutral_of(kind), which makes each stand-in once (OnceLock, as before): the 1x1 2D one (unchanged), a 1-texel 1D one, a 1x1x1 3D one, and a 1x1 cube (a 2D texture with six slices, every face filled from the same gray texel). All are R8G8B8A8_UNORM 0x80 with one level, and are uploaded the way the 2D one already is (a copy queue, crate::host::before_send, a fence wait).
  • has neutral_for give 1D/1D-array, 3D and cube/cube-array views a view of the slot's own dimension of the matching stand-in. Multisampled views, buffers and everything else still get their null view, as before.
  • adds a switch, VICTORY_NEUTRAL_ALL_KINDS, which is on by default. =0 keeps only 2D views and arrays, which is what happens now.
  • adds a counter, descriptor::host::NEUTRAL_KINDS: how many slots were given each kind of stand-in since the start (2D, 1D, 3D, cube). It is logged next to the VICTORY_GONE_NEUTRAL count in copystat::log_memory, so it shows only in a diagnostics build. Any build also logs one line the first time each non-2D stand-in is made.

What it targets, plainly: in our runs we saw black, hard-edged blotches while textures stream in, for example on a boat deck. We have not yet shown that this change is what removes them. It is defensive: it makes 1D, 3D and cube slots behave the way 2D slots already do upstream (black becomes neutral gray), and the counter shows how many slots it covers.

Files: crates/victory-gpu/src/descriptor/host.rs (Neutral, neutral_all_kinds, neutral_of, make_neutral, neutral_for, NEUTRAL_KINDS, the test) and crates/victory-gpu/src/copystat.rs (one log line). Nothing in victory-shader or shader_cache.rs changes, so the shader cache key stays the same.

How it was tested

  • In game on main (41adb551 + this change), RTX 4080, Series X profile, DLSS Performance via Streamline, 375 s Chapter 1 route: within the first seconds of the world all three new kinds were needed — textures: gray stand-in made for Line views, … for Cube views, … for Volume views — so on main these slots were null (black) while their textures streamed. The run reached the shore (373.8 s) and then ended with a host command list did not close (0x80070057); the same error ends some runs of plain main too (it appeared in 3 of 5 of our runs that reached the shore, with and without this change), and the debug layer names an out-of-bounds CopyTextureRegion into a BC7 texture (see #2914), which this PR does not touch.
    • What to look for (any build): textures: gray stand-in made for Volume views (VICTORY_NEUTRAL_ALL_KINDS=0: a null view). There are Line and Cube versions of the same line. Each is printed once, the first time a slot of that kind is given its stand-in. If none of these lines appears, the title never had a non-2D slot waiting, and this change did nothing in that run.
    • What to look for (diagnostics build): texture slots shown a gray stand-in since the start, by kind: 2D <n> 1D <n> 3D <n> cube <n> (VICTORY_NEUTRAL_ALL_KINDS=0: 1D, 3D and cubes a null view, as before). The 1D/3D/cube counts are the slots that read black before this change.
    • A/B: the same route with VICTORY_NEUTRAL_ALL_KINDS=0, then the default, comparing the streaming moments where black blotches were seen.
  • GPU and profile: RTX 4080 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows, Series X profile.
  • Before / after (our fork, not this branch): our fork has carried this change since its commit 66b36a12, on by default. We have no measured before/after for the blotches. Seeing them is what led us to the null-view path, but we have not tied them to it.
  • New/updated unit test: descriptor::host::tests::a_texture_not_there_yet_has_a_neutral_stand_in (VICTORY_WARP=1). It checks that 2D and 2D-array views get a stand-in, that 1D, 1D-array, 3D, cube and cube-array views get one when the switch is on (and a null view when it is off), that multisampled views never get one, and that the device is not removed after the views are made.
  • CI-equivalent commands on this branch (b4c33f1b on 41adb551; offline, --locked):
    • cargo clippy -p victory-gpu --all-targets, and the same with --all-features: exit 0, with no warning in the lines this adds. The only warning in a touched file is one already on main: method mirror_for_pass is never used (descriptor/host.rs). Clippy with -D warnings stops in victory-shader on main even without this PR (unused imports PAIR_MEETINGS and analysis::lane_regions, and while_immutable_condition).
    • VICTORY_WARP=1 cargo test -p victory-gpu --lib -- neutral: 3 passed. The same test with VICTORY_NEUTRAL_ALL_KINDS=0: passed.
    • VICTORY_WARP=1 cargo test -p victory-gpu --lib -- descriptor::: 104 passed, 2 ignored.
    • cargo xtask policy --staged: "asset policy: 2 files ok".
  • cargo test passed for the crates it touches: yes, for the tests run above. The whole workspace suite was not run. On main, every_switch_of_the_translator_is_in_the_key and a menu test fail without this PR. The new switch is read in victory-gpu, not by the translator, so it does not need to be in that test's list.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1925.
    • On main (41adb551), neutral_for has stand-ins only for 2D views (TEXTURE2D) and 2D arrays (TEXTURE2D_ARRAY). Every other dimension goes to null_for. Its test asserts that cube (9) and 3D (8) views get None.
    • #1925 (open) adds a single STOOD_IN counter in neutral_for, plus a per-frame "glitch line". It does not add stand-ins of other kinds. If both are merged, STOOD_IN is the sum of NEUTRAL_KINDS.
    • #1551 (merged, VICTORY_GONE_NEUTRAL) sends streamed-out slots through neutral_for. This change extends that path to non-2D slots with nothing more needed.
    • #2334 (draft) has a neutral_probe that uses TEXTURE3D for a different purpose (probe lighting). It does not overlap.
    • Searched for: "neutral", "stand-in cube", "null view black", "TEXTURE3D neutral", "gray stand-in", "neutral cube", "neutral 3D volume". Nothing else changes neutral_for's dimensions.

🤖 Generated with Claude Code

**@⁠Mikey970** on GitHub · 2026-11-30 06:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3780) `Mikey970:pr/neutral-all-kinds` → `main` · +210 −95 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC [pr-fix] Textures: 1D, 3D and cube slots waiting for their texture show a gray stand-in of their kind, not black (VICTORY_NEUTRAL_ALL_KINDS) Fixes # ## What it changes When a texture slot has no texture to show yet (its texture is still waiting for its upload, was never made, or was let go), `descriptor/host.rs` `neutral_for` gives it the 1x1 gray (0x80) stand-in. That only works for 2D views and 2D arrays. A 1D, 1D-array, 3D, cube or cube-array view gets `null_for`, a null view of its kind. A null SRV reads as zeros, so a material sampling a volume or a cube at that moment reads black, where a 2D texture in the same state already reads gray. This change: - makes `neutral()` into `neutral_of(kind)`, which makes each stand-in once (`OnceLock`, as before): the 1x1 2D one (unchanged), a 1-texel 1D one, a 1x1x1 3D one, and a 1x1 cube (a 2D texture with six slices, every face filled from the same gray texel). All are `R8G8B8A8_UNORM` 0x80 with one level, and are uploaded the way the 2D one already is (a copy queue, `crate::host::before_send`, a fence wait). - has `neutral_for` give 1D/1D-array, 3D and cube/cube-array views a view **of the slot's own dimension** of the matching stand-in. Multisampled views, buffers and everything else still get their null view, as before. - adds a switch, `VICTORY_NEUTRAL_ALL_KINDS`, which is **on by default**. `=0` keeps only 2D views and arrays, which is what happens now. - adds a counter, `descriptor::host::NEUTRAL_KINDS`: how many slots were given each kind of stand-in since the start (2D, 1D, 3D, cube). It is logged next to the `VICTORY_GONE_NEUTRAL` count in `copystat::log_memory`, so it shows only in a diagnostics build. Any build also logs one line the first time each non-2D stand-in is made. What it targets, plainly: in our runs we saw black, hard-edged blotches while textures stream in, for example on a boat deck. **We have not yet shown that this change is what removes them.** It is defensive: it makes 1D, 3D and cube slots behave the way 2D slots already do upstream (black becomes neutral gray), and the counter shows how many slots it covers. Files: `crates/victory-gpu/src/descriptor/host.rs` (`Neutral`, `neutral_all_kinds`, `neutral_of`, `make_neutral`, `neutral_for`, `NEUTRAL_KINDS`, the test) and `crates/victory-gpu/src/copystat.rs` (one log line). Nothing in `victory-shader` or `shader_cache.rs` changes, so the shader cache key stays the same. ## How it was tested - **In game on `main` (41adb551 + this change), RTX 4080, Series X profile, DLSS Performance via Streamline, 375 s Chapter 1 route:** within the first seconds of the world all three new kinds were needed — `textures: gray stand-in made for Line views`, `… for Cube views`, `… for Volume views` — so on `main` these slots were null (black) while their textures streamed. The run reached the shore (373.8 s) and then ended with `a host command list did not close (0x80070057)`; the same error ends some runs of plain `main` too (it appeared in 3 of 5 of our runs that reached the shore, with and without this change), and the debug layer names an out-of-bounds `CopyTextureRegion` into a BC7 texture (see #2914), which this PR does not touch. - What to look for (any build): `textures: gray stand-in made for Volume views (VICTORY_NEUTRAL_ALL_KINDS=0: a null view)`. There are `Line` and `Cube` versions of the same line. Each is printed once, the first time a slot of that kind is given its stand-in. If none of these lines appears, the title never had a non-2D slot waiting, and this change did nothing in that run. - What to look for (diagnostics build): `texture slots shown a gray stand-in since the start, by kind: 2D <n> 1D <n> 3D <n> cube <n> (VICTORY_NEUTRAL_ALL_KINDS=0: 1D, 3D and cubes a null view, as before)`. The 1D/3D/cube counts are the slots that read black before this change. - A/B: the same route with `VICTORY_NEUTRAL_ALL_KINDS=0`, then the default, comparing the streaming moments where black blotches were seen. - GPU and profile: RTX 4080 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows, Series X profile. - Before / after (our fork, not this branch): our fork has carried this change since its commit 66b36a12, on by default. We have no measured before/after for the blotches. Seeing them is what led us to the null-view path, but we have not tied them to it. - New/updated unit test: `descriptor::host::tests::a_texture_not_there_yet_has_a_neutral_stand_in` (`VICTORY_WARP=1`). It checks that 2D and 2D-array views get a stand-in, that 1D, 1D-array, 3D, cube and cube-array views get one when the switch is on (and a null view when it is off), that multisampled views never get one, and that the device is not removed after the views are made. - CI-equivalent commands on this branch (b4c33f1b on 41adb551; offline, `--locked`): - `cargo clippy -p victory-gpu --all-targets`, and the same with `--all-features`: exit 0, with no warning in the lines this adds. The only warning in a touched file is one already on `main`: `method mirror_for_pass is never used` (`descriptor/host.rs`). Clippy with `-D warnings` stops in `victory-shader` on `main` even without this PR (unused imports `PAIR_MEETINGS` and `analysis::lane_regions`, and `while_immutable_condition`). - `VICTORY_WARP=1 cargo test -p victory-gpu --lib -- neutral`: 3 passed. The same test with `VICTORY_NEUTRAL_ALL_KINDS=0`: passed. - `VICTORY_WARP=1 cargo test -p victory-gpu --lib -- descriptor::`: 104 passed, 2 ignored. - `cargo xtask policy --staged`: "asset policy: 2 files ok". - `cargo test` passed for the crates it touches: yes, for the tests run above. The whole workspace suite was not run. On `main`, `every_switch_of_the_translator_is_in_the_key` and a menu test fail without this PR. The new switch is read in `victory-gpu`, not by the translator, so it does not need to be in that test's list. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1925. - On `main` (41adb551), `neutral_for` has stand-ins only for 2D views (`TEXTURE2D`) and 2D arrays (`TEXTURE2D_ARRAY`). Every other dimension goes to `null_for`. Its test asserts that cube (9) and 3D (8) views get `None`. - #1925 (open) adds a single `STOOD_IN` counter in `neutral_for`, plus a per-frame "glitch line". It does not add stand-ins of other kinds. If both are merged, `STOOD_IN` is the sum of `NEUTRAL_KINDS`. - #1551 (merged, `VICTORY_GONE_NEUTRAL`) sends streamed-out slots through `neutral_for`. This change extends that path to non-2D slots with nothing more needed. - #2334 (draft) has a `neutral_probe` that uses `TEXTURE3D` for a different purpose (probe lighting). It does not overlap. - Searched for: "neutral", "stand-in cube", "null view black", "TEXTURE3D neutral", "gray stand-in", "neutral cube", "neutral 3D volume". Nothing else changes `neutral_for`'s dimensions. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
neutral_for gave only 2D views and 2D arrays the 1x1 gray (0x80)
stand-in; 1D, 3D and cube views (and their arrays) got a null view, which
reads as zeros: black where a material samples a volume or a cube whose
texture is waiting, unmade or let go, while a 2D slot in the same state
reads gray. Now a 1-texel 1D, a 1x1x1 3D and a 1x1 six-face cube texture
of 0x80 are made once and shown through a view of the slot's own
dimension. Multisampled views and buffers keep their null views.
VICTORY_NEUTRAL_ALL_KINDS=0: a null view, as before.

Defensive: which in-game black blotches this accounts for is not yet
attributed. NEUTRAL_KINDS counts the slots given each kind of stand-in
(logged beside the VICTORY_GONE_NEUTRAL count in a diagnostics build);
any build logs once "textures: gray stand-in made for <Line|Volume|Cube>
views" when the first one is made.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 06:51:54 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-30 07:47 UTC · original

I checked the actual texel contents on Windows using app-local WARP 1.0.22 and Agility 1.620.2. The same fixture calls neutral_for and reads every subresource from the returned 1x1 resource. It checks the D3D12 resource dimension and format before recording the copies.

  • Main/release 41adb551 returned the two 2D stand-ins, both [0x80, 0x80, 0x80, 0x80]. The five new SRV dimensions had no stand-in.
  • Exact PR head b4c33f1 returned all seven stand-ins when enabled. All 17 readbacks were RGBA 0x80, including each of the six faces through the cube and cube-array cases.
  • The same PR build with VICTORY_NEUTRAL_ALL_KINDS=0 again returned only the two 2D stand-ins. Both retained the same color.

This verifies the generated fallback resources and the opt-out. Whether these slots account for the reported in-game black blotches still needs the same-route A/B.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-30 07:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3780#issuecomment-7272122952) I checked the actual texel contents on Windows using app-local WARP 1.0.22 and Agility 1.620.2. The same fixture calls `neutral_for` and reads every subresource from the returned 1x1 resource. It checks the D3D12 resource dimension and format before recording the copies. - Main/release `41adb551` returned the two 2D stand-ins, both `[0x80, 0x80, 0x80, 0x80]`. The five new SRV dimensions had no stand-in. - Exact PR head `b4c33f1` returned all seven stand-ins when enabled. All 17 readbacks were RGBA `0x80`, including each of the six faces through the cube and cube-array cases. - The same PR build with `VICTORY_NEUTRAL_ALL_KINDS=0` again returned only the two 2D stand-ins. Both retained the same color. This verifies the generated fallback resources and the opt-out. Whether these slots account for the reported in-game black blotches still needs the same-route A/B. AI-assisted with OpenAI Codex.
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 08:55 UTC · original

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.

**@⁠dyshay** on GitHub · 2026-11-30 08:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3780#issuecomment-7273517922) Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.
Author
Owner

@⁠Mikey970 on GitHub · 2026-11-30 13:54 UTC · original

@⁠andrewpozdnakov7-jpg thanks for reading back the texels: that covers what the unit tests did not, namely that all seven stand-ins are 0x80 gray on every face and slice and that VICTORY_NEUTRAL_ALL_KINDS=0 gives back exactly main's two. Agreed that whether these slots explain the in-game black blotches still needs a same-route A/B.

@⁠dyshay thanks for the review and for queueing the RTX 4090 run.

🤖 Generated with Claude Code

**@⁠Mikey970** on GitHub · 2026-11-30 13:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3780#issuecomment-7280547023) @⁠andrewpozdnakov7-jpg thanks for reading back the texels: that covers what the unit tests did not, namely that all seven stand-ins are 0x80 gray on every face and slice and that `VICTORY_NEUTRAL_ALL_KINDS=0` gives back exactly `main`'s two. Agreed that whether these slots explain the in-game black blotches still needs a same-route A/B. @⁠dyshay thanks for the review and for queueing the RTX 4090 run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github manually merged commit 3496e74269 into main 2026-11-30 14:14:21 +00:00
Author
Owner

@⁠Mikey970 on GitHub · 2026-11-30 14:44 UTC · original

Note: this PR had already been merged into main before this follow-up was pushed, so 82b8e7d6 is only on the fork branch, not in main. It will come as a separate PR.

Small follow-up 82b8e7d6: VICTORY_NEUTRAL_ALL_KINDS is now read through the crate's toggled! macro instead of a hand-rolled OnceLock. Behaviour is unchanged (on unless 0), and the switch can now be flipped with VICTORY_AB in diagnostics builds. Doc comments in descriptor/host.rs and draw.rs that still named the removed neutral() now say neutral_of(). Tested: --lib neutral 3 passed, and cargo check/clippy with and without --all-features are clean in the touched code.

🤖 Generated with Claude Code

**@⁠Mikey970** on GitHub · 2026-11-30 14:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3780#issuecomment-7281852475) **Note:** this PR had already been merged into `main` before this follow-up was pushed, so `82b8e7d6` is only on the fork branch, not in `main`. It will come as a separate PR. Small follow-up `82b8e7d6`: `VICTORY_NEUTRAL_ALL_KINDS` is now read through the crate's `toggled!` macro instead of a hand-rolled `OnceLock`. Behaviour is unchanged (on unless `0`), and the switch can now be flipped with `VICTORY_AB` in diagnostics builds. Doc comments in `descriptor/host.rs` and `draw.rs` that still named the removed `neutral()` now say `neutral_of()`. Tested: `--lib neutral` 3 passed, and `cargo check`/clippy with and without `--all-features` are clean in the touched code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!3780
No description provided.