VICTORY_PAGE_WRITES=1 removes noise textures (uploaded before the DirectStorage read finished) #821
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#821
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@cafeoh on GitHub · 2026-11-25 08:58 UTC · original
On an RTX 2080 Ti (11 GB) + Windows 10, fork main
a26859f+ #784 and a few other PRs, withVICTORY_LEVELS_ON_DEMAND=1: in the first cutscene a character's face often showed random noise. The log's own line explains it. In every run about 4,000–5,000 placed-texture slots were "uploaded before the write (left as they were)": the texture pass took the memory while a DirectStorage read was still filling it, and the after-write mark is only counted by default.With
VICTORY_PAGE_WRITES=1those slots are made due again. To check that this matters, I added a local counter: it keeps a fingerprint (texture::fingerprint) of each slot's last whole upload and compares it at the next upload of a slot made due this way. In one run, of 3,956 slots made due again, 2,671 were uploaded again whole: 2,186 had other bytes, 220 the same, 265 had no earlier fingerprint. So about 9 in 10 of these textures really were on the card with stale or half-written data.Pictures agree, but the noise is random from run to run, so they are weaker proof:
PAGE_WRITES=1TEXTURE_STAGE_MB=768,STAGE_MS=1000PAGE_WRITES=1The bigger upload budget makes it worse because textures get uploaded sooner, more often before their read has finished. I saw no queue flood and no frame-time cost here, so
slots(bit 2) may be worth having on by default.Tested: the first cutscene and the cell scene, 8 runs in all. Not tested: later scenes, other cards, the unit tests.
AI use: tested and written with Claude Code.
@AsterionXeity on GitHub · 2026-11-25 11:14 UTC · original · edited 2026-11-25 11:16 UTC
A data point the other way: on this machine
VICTORY_PAGE_WRITES=1did not remove the noise, and the room went black.Setup: RTX 4080 SUPER (16 GB, driver 32.0.16.1088), 28 cores, Windows 10 Pro 19045. Fork main
9376fd6, plus the D3D12 Agility SDK exports needed for SM 6.6 on Windows 10 (upstream #84) and local diagnostic logging that doesn't change behaviour. Series X dump. Both runs usedVICTORY_RELAY=2andVICTORY_CARD_FETCH_INFLIGHT=1.VICTORY_PAGE_WRITES1At the end of each run the texture queue looked about the same: A 6,622 slots (1,597 waiting for their memory, 4,772 uploaded in part), B 8,182 slots (2,055 waiting for their memory, 5,114 uploaded in part). There were no errors and no device loss in either run.
So here, making those slots due again did not clear the noise, and it added black surfaces. That fits the old note about bit 2 flooding the queue, but I haven't confirmed that in the code. I only have two runs, and I didn't add the fingerprint counter from the report above, so I can't say how many of the 7,910 re-uploads had different bytes. The noise may also come from something else, such as textures uploaded in part (about 4,800–5,100 at any time).
Not tested: other scenes, more runs,
slots(bit 2 alone) instead of1.@cafeoh on GitHub · 2026-11-25 16:03 UTC · original
Correction: my first theory was wrong.
The noise on the waitress's face is not caused by her textures being uploaded too early. I followed her 5 face textures by address with a local probe:
What it really is: her pixel shader finds its textures by index into the descriptor heap ("bindless"). The fork fills those heap slots lazily, through a queue with a per-frame budget. On my machine that queue is about 10k slots behind. From the log:
26295 slots, 10121 due (oldest 44 frames ago). Until her slot is filled, the shader reads one of two things:VICTORY_DEBUG_NULL_VIEWS), orWorkaround: a bigger budget,
VICTORY_TEXTURE_STAGE_MB=768andVICTORY_TEXTURE_STAGE_MS=1000. Her face was normal in 3 of 3 runs. In one run you can watch it go magenta → black → normal within the shot. With the defaults (192 / 250) it was magenta or noisy in 8 of 8 runs.A PIX capture of the noisy draw showed it sampling about 30 heap textures: her own, plus about 26 unrelated ones. So the indices may be wrong too, maybe from a stale material buffer. I have not proven that.
@AsterionXeity this fits what you saw:
PAGE_WRITES=1was on in all these runs, and it is not the fix.Tested: RTX 2080 Ti, Windows 10, upstream main
f85101bplus fork PRs, prologue diner scene.Not tested: what the bigger budget costs in frame rate, other cards, other scenes. A dark block at her mouth stays even with the fix.
AI use: investigated and written with Claude Code.