VICTORY_PAGE_WRITES=1 removes noise textures (uploaded before the DirectStorage read finished) #821

Open
opened 2026-11-26 03:51:53 +00:00 by github-bot · 2 comments
Owner

@⁠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, with VICTORY_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=1 those 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:

Run Switches Face Frame median
A default still waiting (debug colour) in the frames captured 522 ms
B PAGE_WRITES=1 clean (or still waiting) 509 ms
C TEXTURE_STAGE_MB=768, STAGE_MS=1000 noise in 1 of 2 runs 424–503 ms
D the same + PAGE_WRITES=1 clean in 2 of 3 runs, faint flecks in 1 489–518 ms

The 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.

**@⁠cafeoh** on GitHub · 2026-11-25 08:58 UTC · [original](https://github.com/fxceless/victory-fork/issues/821) On an RTX 2080 Ti (11 GB) + Windows 10, fork main `a26859f` + #784 and a few other PRs, with `VICTORY_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=1` those 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: | Run | Switches | Face | Frame median | |---|---|---|---| | A | default | still waiting (debug colour) in the frames captured | 522 ms | | B | `PAGE_WRITES=1` | clean (or still waiting) | 509 ms | | C | `TEXTURE_STAGE_MB=768`, `STAGE_MS=1000` | noise in 1 of 2 runs | 424–503 ms | | D | the same + `PAGE_WRITES=1` | clean in 2 of 3 runs, faint flecks in 1 | 489–518 ms | The 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:51:53 +00:00
Author
Owner

@⁠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=1 did 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 used VICTORY_RELAY=2 and VICTORY_CARD_FETCH_INFLIGHT=1.

Run VICTORY_PAGE_WRITES Log line at the end What it looked like
A unset (default) 26,810 slots held their bytes, 8,663 of them uploaded before the write (left as they were) blocky purple and green noise on characters' clothing; seen in every run on this build
B 1 24,504 slots held their bytes, 7,910 of them uploaded before the write (made due again) noise still on a sleeve; the room rendered black

At 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 of 1.

**@⁠AsterionXeity** on GitHub · 2026-11-25 11:14 UTC · [original](https://github.com/fxceless/victory-fork/issues/821#issuecomment-7160785049) · edited 2026-11-25 11:16 UTC A data point the other way: on this machine `VICTORY_PAGE_WRITES=1` did 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 used `VICTORY_RELAY=2` and `VICTORY_CARD_FETCH_INFLIGHT=1`. | Run | `VICTORY_PAGE_WRITES` | Log line at the end | What it looked like | |---|---|---|---| | A | unset (default) | 26,810 slots held their bytes, 8,663 of them uploaded before the write (left as they were) | blocky purple and green noise on characters' clothing; seen in every run on this build | | B | `1` | 24,504 slots held their bytes, 7,910 of them uploaded before the write (made due again) | noise still on a sleeve; the room rendered black | At 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 of `1`.
Author
Owner

@⁠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:

  • In 3 runs, each was uploaded once early and once again later, with the same bytes (same hash) each time.
  • There were no disk writes into them after the early load.

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:

  • an empty slot (magenta with VICTORY_DEBUG_NULL_VIEWS), or
  • an old view of something else (noise).

Workaround: a bigger budget, VICTORY_TEXTURE_STAGE_MB=768 and VICTORY_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=1 was on in all these runs, and it is not the fix.

Tested: RTX 2080 Ti, Windows 10, upstream main f85101b plus 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.

**@⁠cafeoh** on GitHub · 2026-11-25 16:03 UTC · [original](https://github.com/fxceless/victory-fork/issues/821#issuecomment-7167550995) **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: - In 3 runs, each was uploaded once early and once again later, with the same bytes (same hash) each time. - There were no disk writes into them after the early load. **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: - an empty slot (magenta with `VICTORY_DEBUG_NULL_VIEWS`), or - an old view of something else (noise). **Workaround:** a bigger budget, `VICTORY_TEXTURE_STAGE_MB=768` and `VICTORY_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=1` was on in all these runs, and it is not the fix. **Tested:** RTX 2080 Ti, Windows 10, upstream main f85101b plus 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.
This discussion has been locked. Commenting is limited to contributors.
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/fxceless--victory-fork#821
No description provided.