GPU: a texture read back again after its memory is reused is re-registered (port of fxceless#1376) #686

Merged
kibagami-nc merged 1 commit from upstream-pr/686 into main 2026-11-28 19:39:38 +00:00
kibagami-nc commented 2026-11-28 03:33:05 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T03:33:05Z.


The problem

The title sometimes reuses or remaps the memory a back-copied texture tiles into. The texture's read-back ticket then goes stale (texback::replaced).

A later write of the same texture in the same list found the old entry in back_wanted (HostList, crates/victory-gpu/src/host.rs) and registered nothing. The read-back was dropped, and the title read back nothing for that texture. In the game, this was the ocean's height map.

The change

A stale entry is replaced in place by a fresh target. A fresh entry is kept, and a texture still gets one entry per list.

This is a port of spk-c's fix (fxceless/victory-fork#1376). The only conflict was two tests next to each other in list.rs; both are kept.

Tests

  • New list::tests::a_rewritten_back_texture_after_reuse_is_read_back: a synthetic R32_FLOAT texture is written, its memory reused, then written again. It is read back exactly once at the list's close.
    • It runs on the host device (RTX 5070 Ti here).
    • With the old dedup put back, it fails: "the second write re-registered the read-back".
  • cargo test -p victory-gpu --locked --lib: 453 passed, 0 failed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without --all-features: nothing in the changed files. main's own findings are fixed by #665.

Checked by others

  • Yoshi-233 (Windows, RTX 4070 Ti SUPER, driver 617.42):
    • Test: the new test reached its GPU assertions and passed. With only the replacement turned off, it failed at the second write's assertion, as it should.
    • In the game: on v2026.11.27.10, at an open-water motorboat checkpoint (DLSS Quality, 2560x1440 for 3840x2160), 429 texture read-backs were recorded. The stale-entry branch ran 0 times with the switch either way. Median frame times: 46.1 / 45.9 / 45.5 ms with re-registration on / off / on. That route never takes the new path, so it shows no change in the waves either way.
  • ArturoWolff (Linux, GE-Proton11-14 with vkd3d-proton 3.2.0, RTX 4060 8 GB):
    • Test: the new test passed on the card.
    • In the game: a launch with this change against main (63b902f) with the same settings: no guard stop, no out-of-memory, no GPU fault. Both stop at the same first-story loading failure, which this change is not about.

No game files, dumps or extracted data are included.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5536265919 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T03:33:05Z. --- ## The problem The title sometimes reuses or remaps the memory a back-copied texture tiles into. The texture's read-back ticket then goes stale (`texback::replaced`). A later write of the same texture in the same list found the old entry in `back_wanted` (`HostList`, `crates/victory-gpu/src/host.rs`) and registered nothing. The read-back was dropped, and the title read back nothing for that texture. In the game, this was the ocean's height map. ## The change A stale entry is replaced in place by a fresh target. A fresh entry is kept, and a texture still gets one entry per list. This is a port of spk-c's fix ([fxceless/victory-fork#1376](https://github.com/fxceless/victory-fork/pull/1376)). The only conflict was two tests next to each other in `list.rs`; both are kept. ## Tests - New `list::tests::a_rewritten_back_texture_after_reuse_is_read_back`: a synthetic R32_FLOAT texture is written, its memory reused, then written again. It is read back exactly once at the list's close. - It runs on the host device (RTX 5070 Ti here). - With the old dedup put back, it fails: "the second write re-registered the read-back". - `cargo test -p victory-gpu --locked --lib`: 453 passed, 0 failed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`, with and without `--all-features`: nothing in the changed files. `main`'s own findings are fixed by #665. ## Checked by others - **Yoshi-233** (Windows, RTX 4070 Ti SUPER, driver 617.42): - **Test:** the new test reached its GPU assertions and passed. With only the replacement turned off, it failed at the second write's assertion, as it should. - **In the game:** on v2026.11.27.10, at an open-water motorboat checkpoint (DLSS Quality, 2560x1440 for 3840x2160), 429 texture read-backs were recorded. The stale-entry branch ran 0 times with the switch either way. Median frame times: 46.1 / 45.9 / 45.5 ms with re-registration on / off / on. That route never takes the new path, so it shows no change in the waves either way. - **ArturoWolff** (Linux, GE-Proton11-14 with vkd3d-proton 3.2.0, RTX 4060 8 GB): - **Test:** the new test passed on the card. - **In the game:** a launch with this change against `main` (`63b902f`) with the same settings: no guard stop, no out-of-memory, no GPU fault. Both stop at the same first-story loading failure, which this change is not about. No game files, dumps or extracted data are included.
Yoshi-233 commented 2026-11-28 03:52:50 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yoshi-233 on 2026-11-28T03:52:50Z.


I ran the added texture-reuse regression on a Windows RTX 4070 Ti SUPER (driver 617.42). It reached the GPU assertions and passed with re-registration enabled. Disabling only the replacement made it fail at the second-write assertion, as expected.

I also instrumented the stale-entry branch in this PR on top of v2026.11.27.10. In a daytime open-water motorboat checkpoint I recorded 429 completed texture readbacks across loading, idle, acceleration and turns, including 250 while the boat was stationary. The stale-entry branch fired zero times with either switch state. Three complete stationary 24-second intervals with re-registration on/off/on had median frame times of 46.1 / 45.9 / 45.5 ms. DLSS Quality was rendering 2560×1440 for 3840×2160 output, with frame generation off.

The regression is reproducible on Ada. This particular ocean route did not trigger it in gameplay, so it doesn't establish a change to visible wave detail here. A checkpoint or action known to invalidate an ocean texture's backing would make a good next comparison.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7233472903 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686#issuecomment-7233472903). Originally posted by [Yoshi-233](https://github.com/Yoshi-233) on 2026-11-28T03:52:50Z. --- I ran the added texture-reuse regression on a Windows RTX 4070 Ti SUPER (driver 617.42). It reached the GPU assertions and passed with re-registration enabled. Disabling only the replacement made it fail at the second-write assertion, as expected. I also instrumented the stale-entry branch in this PR on top of v2026.11.27.10. In a daytime open-water motorboat checkpoint I recorded 429 completed texture readbacks across loading, idle, acceleration and turns, including 250 while the boat was stationary. The stale-entry branch fired zero times with either switch state. Three complete stationary 24-second intervals with re-registration on/off/on had median frame times of 46.1 / 45.9 / 45.5 ms. DLSS Quality was rendering 2560×1440 for 3840×2160 output, with frame generation off. The regression is reproducible on Ada. This particular ocean route did not trigger it in gameplay, so it doesn't establish a change to visible wave detail here. A checkpoint or action known to invalidate an ocean texture's backing would make a good next comparison.
ArturoWolff commented 2026-11-28 04:38:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ArturoWolff on 2026-11-28T04:38:32Z.


Independent Linux/Proton qualification of the named registration fixture in #686, on a physical RTX 4060 desktop (8 GB, NVIDIA 620.73.4, 16 GB system RAM). I applied the exact four-file change at c8f08560e05fa2cd0d594981c76f1fcffb697cd3 to .01 (63b902fe1720a5188ee79d94a88c8de0470f6349), with the same backing/DXC adaptations as my #628 baseline. Thanks to kibagami-nc and spk-c (original #1376).

The locked MSVC release test binary ran in a fresh isolated GE-Proton11-14 prefix, with actual vkd3d-proton 3.2.0 (cae8353ed7959c4+). No game files mounted. Invoked list::tests::a_rewritten_back_texture_after_reuse_is_read_back --exact --nocapture --test-threads=1.

texture ticket regression exercised on host device
ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 493 filtered out; finished in 1.05s

Actual child exit 0. The host assertion marker confirms the test did not return early for lack of a GPU. This checks registration and the single recorded read-back, not completed pixel values. I ran only this named test, not the full suite or a local switch-off negative; the earlier Windows negative result is separate evidence.

I also launched the game with the corresponding release build, compared with the retained .01 control under identical effective graphics settings, separate cold external caches and the same cloned prefix seed (Series X 1080to1440, 30 cap, DLSS/FG off, full requested effects/write-back/ordinary waits). Both progressed without recorded input.

Observation Retained .01 .01 + #686
Minimum available system RAM (MiB) 2331.2 2489.2
Elapsed including startup (s) 124.983 132.443
Actual game exit 5 5

Both show the loading artwork then a black overlay at the existing first-story loading failure. No guard stop, OOM increment, recorded kernel GPU fault or reported host fence error. I have no witness that the replacement path was exercised by that actual launch, and no visible ocean/height-map output to compare. The targeted fixture is positive on Ada under Proton in addition to Yoshi-233's Windows result, but this change alone does not restore local world entry. No gameplay performance or visual correctness claim.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7234167616 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686#issuecomment-7234167616). Originally posted by [ArturoWolff](https://github.com/ArturoWolff) on 2026-11-28T04:38:32Z. --- Independent Linux/Proton qualification of the named registration fixture in #686, on a physical RTX 4060 desktop (8 GB, NVIDIA 620.73.4, 16 GB system RAM). I applied the exact four-file change at `c8f08560e05fa2cd0d594981c76f1fcffb697cd3` to `.01` (`63b902fe1720a5188ee79d94a88c8de0470f6349`), with the same backing/DXC adaptations as my [#628 baseline](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/628#issuecomment-7233278386). Thanks to kibagami-nc and spk-c ([original #1376](https://github.com/fxceless/victory-fork/pull/1376)). The locked MSVC release test binary ran in a fresh isolated GE-Proton11-14 prefix, with actual vkd3d-proton 3.2.0 (`cae8353ed7959c4+`). No game files mounted. Invoked `list::tests::a_rewritten_back_texture_after_reuse_is_read_back --exact --nocapture --test-threads=1`. ```text texture ticket regression exercised on host device ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 493 filtered out; finished in 1.05s ``` Actual child exit 0. The host assertion marker confirms the test did not return early for lack of a GPU. This checks registration and the single recorded read-back, not completed pixel values. I ran only this named test, not the full suite or a local switch-off negative; the earlier Windows negative result is separate evidence. I also launched the game with the corresponding release build, compared with the retained `.01` control under identical effective graphics settings, separate cold external caches and the same cloned prefix seed (Series X 1080to1440, 30 cap, DLSS/FG off, full requested effects/write-back/ordinary waits). Both progressed without recorded input. | Observation | Retained `.01` | `.01` + #686 | |---|---:|---:| | Minimum available system RAM (MiB) | 2331.2 | 2489.2 | | Elapsed including startup (s) | 124.983 | 132.443 | | Actual game exit | 5 | 5 | Both show the loading artwork then a black overlay at the existing first-story loading failure. No guard stop, OOM increment, recorded kernel GPU fault or reported host fence error. I have no witness that the replacement path was exercised by that actual launch, and no visible ocean/height-map output to compare. The targeted fixture is positive on Ada under Proton in addition to Yoshi-233's Windows result, but this change alone does not restore local world entry. No gameplay performance or visual correctness claim. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
Dukestar69 commented 2026-11-28 05:17:12 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T05:17:12Z.

Review: APPROVED


LGTM — verified on Windows (RTX 5090):

  • cargo test -p victory-gpu --lib resource:: (20/20), texback::, and list:: all passed on RTX 5090
  • 0 new compiler warnings in touched files
  • cargo xtask policy passed (294 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6095972519 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686#pullrequestreview-6095972519). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-28T05:17:12Z. **Review:** APPROVED --- LGTM — verified on Windows (RTX 5090): - `cargo test -p victory-gpu --lib resource::` (20/20), `texback::`, and `list::` all passed on RTX 5090 - 0 new compiler warnings in touched files - `cargo xtask policy` passed (`294 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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!686
No description provided.