Textures: a prelude upload checks again at submission that the host has not written the texture (confetti faces) #33

Merged
Ahyildiz merged 1 commit from upstream-pr/33 into main 2026-11-28 19:01:28 +00:00
Ahyildiz commented 2026-11-27 11:40:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Ahyildiz on 2026-11-27T11:40:19Z.


What it fixes

In the diner cutscene the bartender's face is drawn as coloured specks (or once as a blue face with lines) for the
whole scene, in about half the runs (Series S, DLSS off, RTX 5080). Everything else on her is right. It looks like the
"coloured specks all over the waitress's face" that draw.rs already describes for run n01.

Cause

With VICTORY_PRELUDE_UPLOADS=1, upload_from checks host_written when the list is recorded, but the upload itself
is decided at submission in PreludeUpload::finish_refresh, and that check isn't repeated there. With lists recorded on
several threads (VICTORY_THIN), a list that samples a texture can be recorded just before the list whose copy writes
that texture, and then be submitted after it. Here the writing list is the title's decoration bake, which copies a
character's baked skin into a 1024x1024 BC3 texture.

The prelude then copies the title's memory over what the host wrote. The title never fills that memory (on the console
the GPU copy did), so it holds whatever was there before. After that, no list uploads a host-written texture again, so
the wrong contents stay.

Change

finish_refresh now leaves the upload out when the texture is host-written. It logs a warning with the texture's size
and format for the first eight and then at powers of two. VICTORY_PRELUDE_RECHECK=0 gives the old behaviour.

How it was checked

  • Unattended runs (VICTORY_KEYS), the launcher's settings, VICTORY_CAPTURE_FRAMES every 100 frames through the diner.
  • Before: broken in about 5 of 10 runs. The stock build was clean in 4 runs, which still fits a timing race.
  • After: clean in 5 of 5 runs, about 20 frames showing her. The new check fired about 10 times per run, including on
    1024x1024 textures of format 78.
  • Frame rate unchanged: 24–25 fps in that scene.
  • Rebased on current main (959dcaf) and checked again: clean in the valid runs. The check fired 9–10 times per
    run, with 0 errors logged, at 25.6–27.5 fps. One run shared the machine with a shader warm-up and doesn't count for
    speed.
  • Also tried with #30 on top: clean in 2 of 2 runs. One of those runs showed a character's grey hoodie much darker
    than usual, which I haven't seen in any run without #30. Two runs aren't enough to blame it on #30. I'm mentioning
    it in case it helps whoever reviews #30.
  • cargo clippy -p victory-gpu --all-targets gives the same warnings as main and adds none. Workspace tests not run.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5526003015 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/33). Originally posted by [Ahyildiz](https://github.com/Ahyildiz) on 2026-11-27T11:40:19Z. --- ## What it fixes In the diner cutscene the **bartender's face is drawn as coloured specks** (or once as a blue face with lines) for the whole scene, in about half the runs (Series S, DLSS off, RTX 5080). Everything else on her is right. It looks like the "coloured specks all over the waitress's face" that `draw.rs` already describes for run n01. ## Cause With `VICTORY_PRELUDE_UPLOADS=1`, `upload_from` checks `host_written` when the list is recorded, but the upload itself is decided at submission in `PreludeUpload::finish_refresh`, and that check isn't repeated there. With lists recorded on several threads (`VICTORY_THIN`), a list that samples a texture can be recorded just before the list whose copy writes that texture, and then be submitted after it. Here the writing list is the title's decoration bake, which copies a character's baked skin into a 1024x1024 BC3 texture. The prelude then copies the title's memory over what the host wrote. The title never fills that memory (on the console the GPU copy did), so it holds whatever was there before. After that, no list uploads a host-written texture again, so the wrong contents stay. ## Change `finish_refresh` now leaves the upload out when the texture is host-written. It logs a warning with the texture's size and format for the first eight and then at powers of two. `VICTORY_PRELUDE_RECHECK=0` gives the old behaviour. ## How it was checked - Unattended runs (`VICTORY_KEYS`), the launcher's settings, `VICTORY_CAPTURE_FRAMES` every 100 frames through the diner. - **Before:** broken in about 5 of 10 runs. The stock build was clean in 4 runs, which still fits a timing race. - **After:** clean in 5 of 5 runs, about 20 frames showing her. The new check fired about 10 times per run, including on 1024x1024 textures of format 78. - Frame rate unchanged: 24–25 fps in that scene. - **Rebased on current `main` (959dcaf) and checked again:** clean in the valid runs. The check fired 9–10 times per run, with 0 errors logged, at 25.6–27.5 fps. One run shared the machine with a shader warm-up and doesn't count for speed. - **Also tried with #30 on top:** clean in 2 of 2 runs. One of those runs showed a character's grey hoodie much darker than usual, which I haven't seen in any run without #30. Two runs aren't enough to blame it on #30. I'm mentioning it in case it helps whoever reviews #30. - `cargo clippy -p victory-gpu --all-targets` gives the same warnings as `main` and adds none. Workspace tests not run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CaitoV4 commented 2026-11-27 18:06:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CaitoV4 on 2026-11-27T18:06:56Z.


I'm testing VIctory-NVIDIA with an RTX 5070 and a Ryzen 7 7800X3D.

I'm also experiencing texture-related graphical issues during gameplay.

Some textures do not appear to load or render correctly. Certain surfaces look visually broken or have incorrect appearance, affecting the visual quality of the game.

Performance and Frame Generation have improved significantly in the latest build, but texture rendering issues are still present.

Are these texture issues already known? Is there any diagnostic information or testing procedure that could help identify the cause?

I'm happy to provide screenshots, logs, and additional testing results.

Thanks for your work on this project!

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7225140212 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/33#issuecomment-7225140212). Originally posted by [CaitoV4](https://github.com/CaitoV4) on 2026-11-27T18:06:56Z. --- I'm testing VIctory-NVIDIA with an RTX 5070 and a Ryzen 7 7800X3D. I'm also experiencing texture-related graphical issues during gameplay. Some textures do not appear to load or render correctly. Certain surfaces look visually broken or have incorrect appearance, affecting the visual quality of the game. Performance and Frame Generation have improved significantly in the latest build, but texture rendering issues are still present. Are these texture issues already known? Is there any diagnostic information or testing procedure that could help identify the cause? I'm happy to provide screenshots, logs, and additional testing results. Thanks for your work on this project!
dcastell1 commented 2026-11-27 18:42:08 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dcastell1 on 2026-11-27T18:42:08Z.


Testing note & fix for black NPC faces caused by same-list self-cancellation

While testing this PR on Windows 11 (i9-12900K, 64 GB RAM, RTX 5090 32 GB, driver 621.40, Series X profile, --res 4k --dlss quality), we ran into a subtle interaction with CopyTextureRegion in crates/victory-gpu/src/list.rs that turns some NPC faces pitch black ((0, 0, 0)):

  1. In list.rs (CopyTextureRegion, around lines 1195–1215), when a partial copy writes onto a staged title-written texture dst (e.g. a small patch onto a character's BC1/BC3_SRGB/BC7_SRGB skin texture), line 1204 calls crate::texture::upload(list, dst.resource, to) first so the base texture is uploaded before the copy overwrites part of it. With VICTORY_PRELUDE_UPLOADS=1, that queues a PreludeUpload on that same list.
  2. Eleven lines later in the same CopyTextureRegion call (line 1215), crate::texture::host_written(dst.resource) inserts dst.resource into HOST_WRITTEN at recording time.
  3. When list itself is submitted, PreludeUpload::finish_refresh() checks is_host_written(self.resource), sees true (set by list itself 11 lines later during recording!), and cancels list's own prelude upload (WARN prelude upload left out: n=1..128, formats 71, 78, 99), leaving the uncopied texels of the fresh DEFAULT texture at zero (black face on the prison intake officer, while eyes/lips/hair render normally).

Fix: Separate recording-time HOST_WRITTEN from submission-time HOST_WRITTEN_SUBMITTED:

  • Record list.defer_host_written(dst as usize) on HostList during CopyResource / CopyTextureRegion / ResolveSubresource (mark_host_written_submitted immediately only for external::output_written).
  • In Host::submit, commit list.commit_host_written() into HOST_WRITTEN_SUBMITTED immediately after let uploads = list.prelude_uploads(&mut batch); (and clear on forget()).
  • Check HOST_WRITTEN_SUBMITTED in PreludeUpload::finish_refresh().

That way a list's own CopyTextureRegion never cancels the base-texture prelude upload queued in front of it, while any out-of-order sampling list submitted after the bake list still skips overwriting the GPU-written texture.

(Note: Made with AI assistance and reviewed, built, and tested by a human.)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7225774605 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/33#issuecomment-7225774605). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-27T18:42:08Z. --- ### Testing note & fix for black NPC faces caused by same-list self-cancellation While testing this PR on Windows 11 (i9-12900K, 64 GB RAM, RTX 5090 32 GB, driver 621.40, Series X profile, `--res 4k --dlss quality`), we ran into a subtle interaction with `CopyTextureRegion` in `crates/victory-gpu/src/list.rs` that turns some NPC faces pitch black (`(0, 0, 0)`): 1. In `list.rs` (`CopyTextureRegion`, around lines 1195–1215), when a partial copy writes onto a staged title-written texture `dst` (e.g. a small patch onto a character's `BC1`/`BC3_SRGB`/`BC7_SRGB` skin texture), line 1204 calls `crate::texture::upload(list, dst.resource, to)` first so the base texture is uploaded before the copy overwrites part of it. With `VICTORY_PRELUDE_UPLOADS=1`, that queues a `PreludeUpload` on **that same `list`**. 2. Eleven lines later in the **same** `CopyTextureRegion` call (line 1215), `crate::texture::host_written(dst.resource)` inserts `dst.resource` into `HOST_WRITTEN` at **recording time**. 3. When `list` itself is submitted, `PreludeUpload::finish_refresh()` checks `is_host_written(self.resource)`, sees `true` (set by `list` itself 11 lines later during recording!), and cancels `list`'s own prelude upload (`WARN prelude upload left out: n=1..128`, formats `71`, `78`, `99`), leaving the uncopied texels of the fresh `DEFAULT` texture at zero (black face on the prison intake officer, while eyes/lips/hair render normally). **Fix:** Separate recording-time `HOST_WRITTEN` from submission-time `HOST_WRITTEN_SUBMITTED`: - Record `list.defer_host_written(dst as usize)` on `HostList` during `CopyResource` / `CopyTextureRegion` / `ResolveSubresource` (`mark_host_written_submitted` immediately only for `external::output_written`). - In `Host::submit`, commit `list.commit_host_written()` into `HOST_WRITTEN_SUBMITTED` **immediately after** `let uploads = list.prelude_uploads(&mut batch);` (and clear on `forget()`). - Check `HOST_WRITTEN_SUBMITTED` in `PreludeUpload::finish_refresh()`. That way a list's own `CopyTextureRegion` never cancels the base-texture prelude upload queued in front of it, while any out-of-order sampling list submitted *after* the bake list still skips overwriting the GPU-written texture. *(Note: Made with AI assistance and reviewed, built, and tested by a human.)*
bentsignal commented 2026-11-27 21:41:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by bentsignal on 2026-11-27T21:41:27Z.


Confirmed on an RTX 5070 Ti (Series X, 1440p, DLSS Quality, launcher defaults with VICTORY_PRELUDE_UPLOADS=1 and VICTORY_THIN=1): the coloured specks on the waitress's face, and later on other characters' skin in the prison, showed up in play. With this branch merged, the new check fired at least 5 times in the first 100 s of the cutscene (2048x2048 format 78, 64x128 format 28, 5808x5808 format 71, 256x256 format 78). Merged in our fork; thanks.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7228668885 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/33#issuecomment-7228668885). Originally posted by [bentsignal](https://github.com/bentsignal) on 2026-11-27T21:41:27Z. --- Confirmed on an RTX 5070 Ti (Series X, 1440p, DLSS Quality, launcher defaults with VICTORY_PRELUDE_UPLOADS=1 and VICTORY_THIN=1): the coloured specks on the waitress's face, and later on other characters' skin in the prison, showed up in play. With this branch merged, the new check fired at least 5 times in the first 100 s of the cutscene (2048x2048 format 78, 64x128 format 28, 5808x5808 format 71, 256x256 format 78). Merged in our fork; thanks.
JoeY54 commented 2026-11-28 09:32:11 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by JoeY54 on 2026-11-28T09:32:11Z.


I tested this PR on an RTX 5090 together with #703. With the recheck on and a warm pipeline cache, world textures went black. With VICTORY_PRELUDE_RECHECK=0 and nothing else changed, they did not. This looks like the same-list self-cancellation that dcastell1 described above.

Setup

  • Base: main at 63b902f (v2026.11.28.01), plus #703 (3a9f195) and this PR (3f6ba01), cherry-picked cleanly. Locked release build.
  • Hardware: RTX 5090 32 GB, driver 621.24, Ryzen 9 9950X3D, Windows 11 build 26300.
  • Title: own copy of v1.0.2.1.
  • Launcher: play-nvidia.ps1 -FrameGen -FgType dlss, which gives Series X, 2560x1440, DLSS Quality and FG 2x with the launcher defaults, including VICTORY_PRELUDE_UPLOADS=1. Same F1 settings in every run.
Run Recheck Pipeline cache at exit (made / loaded) prelude upload left out warnings What was on screen
A1 on 2,344 / 209 (cold) 2 (256x256, format 78) no black, no speckles, faces present
B off (VICTORY_PRELUDE_RECHECK=0) 1,416 / 1,142 (warm) 0 no black, no speckles, faces present
A2 on 1,426 / 1,144 (warm) at least 64, including 5808x5808 format 71, 2048x2048 format 78, 512x512 formats 71/78, 256x256 formats 71/78 faces fine, world textures black

A2 and B differ only in the recheck switch. A2 has the warning at n=1..8, 16, 32 and 64, which is the warning's own power-of-two throttling. The black textures appeared only in A2.

On current main, CopyTextureRegion in list.rs still does two things in the same call:

  1. It queues the base upload for a partial copy onto a staged texture (crate::texture::upload(list, dst.resource, to), around line 1252).
  2. It then marks that texture host-written (crate::texture::host_written(dst.resource), around line 1264).

So when that list is submitted, finish_refresh sees the texture as host-written and drops the list's own upload. The DEFAULT texture then keeps zeros where the partial copy did not write. Marking host writes only at submission, as suggested above (HOST_WRITTEN_SUBMITTED), would keep the check for out-of-order lists without cancelling a list's own upload.

The speckles this PR targets did not show up in any of these runs, including B without the recheck. So I can't confirm the fix itself from here, only the regression.

Not tested:

  • Series S;
  • DLSS off;
  • VICTORY_THIN=1;
  • other GPUs;
  • the suggested HOST_WRITTEN_SUBMITTED change.

Raw logs stay local.

AI-assisted (Claude); runs on my own hardware.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7237302479 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/33#issuecomment-7237302479). Originally posted by [JoeY54](https://github.com/JoeY54) on 2026-11-28T09:32:11Z. --- I tested this PR on an RTX 5090 together with #703. With the recheck on and a warm pipeline cache, world textures went black. With `VICTORY_PRELUDE_RECHECK=0` and nothing else changed, they did not. This looks like the same-list self-cancellation that dcastell1 described above. **Setup** - Base: `main` at `63b902f` (v2026.11.28.01), plus #703 (`3a9f195`) and this PR (`3f6ba01`), cherry-picked cleanly. Locked release build. - Hardware: RTX 5090 32 GB, driver 621.24, Ryzen 9 9950X3D, Windows 11 build 26300. - Title: own copy of v1.0.2.1. - Launcher: `play-nvidia.ps1 -FrameGen -FgType dlss`, which gives Series X, 2560x1440, DLSS Quality and FG 2x with the launcher defaults, including `VICTORY_PRELUDE_UPLOADS=1`. Same F1 settings in every run. | Run | Recheck | Pipeline cache at exit (made / loaded) | `prelude upload left out` warnings | What was on screen | |---|---|---|---|---| | A1 | on | 2,344 / 209 (cold) | 2 (256x256, format 78) | no black, no speckles, faces present | | B | off (`VICTORY_PRELUDE_RECHECK=0`) | 1,416 / 1,142 (warm) | 0 | no black, no speckles, faces present | | A2 | on | 1,426 / 1,144 (warm) | at least 64, including 5808x5808 format 71, 2048x2048 format 78, 512x512 formats 71/78, 256x256 formats 71/78 | faces fine, **world textures black** | A2 and B differ only in the recheck switch. A2 has the warning at n=1..8, 16, 32 and 64, which is the warning's own power-of-two throttling. The black textures appeared only in A2. On current `main`, `CopyTextureRegion` in `list.rs` still does two things in the same call: 1. It queues the base upload for a partial copy onto a staged texture (`crate::texture::upload(list, dst.resource, to)`, around line 1252). 2. It then marks that texture host-written (`crate::texture::host_written(dst.resource)`, around line 1264). So when that list is submitted, `finish_refresh` sees the texture as host-written and drops the list's own upload. The `DEFAULT` texture then keeps zeros where the partial copy did not write. Marking host writes only at submission, as suggested above (`HOST_WRITTEN_SUBMITTED`), would keep the check for out-of-order lists without cancelling a list's own upload. The speckles this PR targets did not show up in any of these runs, including B without the recheck. So I can't confirm the fix itself from here, only the regression. Not tested: - Series S; - DLSS off; - `VICTORY_THIN=1`; - other GPUs; - the suggested `HOST_WRITTEN_SUBMITTED` change. Raw logs stay local. _AI-assisted (Claude); runs on my own hardware._
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
trustno1-coder/VIctory-NVIDIA!33
No description provided.