1D, 3D and cube slots waiting for their texture show a gray stand-in of their kind, not black (VICTORY_NEUTRAL_ALL_KINDS) #3780
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3780"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Mikey970 on 2026-11-30T06:51:32Z.
[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.rsneutral_forgives 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 getsnull_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:
neutral()intoneutral_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 areR8G8B8A8_UNORM0x80 with one level, and are uploaded the way the 2D one already is (a copy queue,crate::host::before_send, a fence wait).neutral_forgive 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.VICTORY_NEUTRAL_ALL_KINDS, which is on by default.=0keeps only 2D views and arrays, which is what happens now.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 theVICTORY_GONE_NEUTRALcount incopystat::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) andcrates/victory-gpu/src/copystat.rs(one log line). Nothing invictory-shaderorshader_cache.rschanges, so the shader cache key stays the same.How it was tested
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 onmainthese slots were null (black) while their textures streamed. The run reached the shore (373.8 s) and then ended witha host command list did not close (0x80070057); the same error ends some runs of plainmaintoo (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-boundsCopyTextureRegioninto a BC7 texture (see #2914), which this PR does not touch.textures: gray stand-in made for Volume views (VICTORY_NEUTRAL_ALL_KINDS=0: a null view). There areLineandCubeversions 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.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.VICTORY_NEUTRAL_ALL_KINDS=0, then the default, comparing the streaming moments where black blotches were seen.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.b4c33f1bon41adb551; 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 onmain:method mirror_for_pass is never used(descriptor/host.rs). Clippy with-D warningsstops invictory-shaderonmaineven without this PR (unused importsPAIR_MEETINGSandanalysis::lane_regions, andwhile_immutable_condition).VICTORY_WARP=1 cargo test -p victory-gpu --lib -- neutral: 3 passed. The same test withVICTORY_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 testpassed for the crates it touches: yes, for the tests run above. The whole workspace suite was not run. Onmain,every_switch_of_the_translator_is_in_the_keyand a menu test fail without this PR. The new switch is read invictory-gpu, not by the translator, so it does not need to be in that test's list.Checked for overlap
main(41adb551),neutral_forhas stand-ins only for 2D views (TEXTURE2D) and 2D arrays (TEXTURE2D_ARRAY). Every other dimension goes tonull_for. Its test asserts that cube (9) and 3D (8) views getNone.STOOD_INcounter inneutral_for, plus a per-frame "glitch line". It does not add stand-ins of other kinds. If both are merged,STOOD_INis the sum ofNEUTRAL_KINDS.VICTORY_GONE_NEUTRAL) sends streamed-out slots throughneutral_for. This change extends that path to non-2D slots with nothing more needed.neutral_probethat usesTEXTURE3Dfor a different purpose (probe lighting). It does not overlap.neutral_for's dimensions.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-11-30T07:47:18Z.
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_forand reads every subresource from the returned 1x1 resource. It checks the D3D12 resource dimension and format before recording the copies.41adb551returned the two 2D stand-ins, both[0x80, 0x80, 0x80, 0x80]. The five new SRV dimensions had no stand-in.b4c33f1returned all seven stand-ins when enabled. All 17 readbacks were RGBA0x80, including each of the six faces through the cube and cube-array cases.VICTORY_NEUTRAL_ALL_KINDS=0again 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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-30T08:55:44Z.
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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Mikey970 on 2026-11-30T13:54:36Z.
@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=0gives back exactlymain'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
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Mikey970 on 2026-11-30T14:44:21Z.
Note: this PR had already been merged into
mainbefore this follow-up was pushed, so82b8e7d6is only on the fork branch, not inmain. It will come as a separate PR.Small follow-up
82b8e7d6:VICTORY_NEUTRAL_ALL_KINDSis now read through the crate'stoggled!macro instead of a hand-rolledOnceLock. Behaviour is unchanged (on unless0), and the switch can now be flipped withVICTORY_ABin diagnostics builds. Doc comments indescriptor/host.rsanddraw.rsthat still named the removedneutral()now sayneutral_of(). Tested:--lib neutral3 passed, andcargo check/clippy with and without--all-featuresare clean in the touched code.🤖 Generated with Claude Code