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

Manually merged
github merged 1 commit from github-bot/gh-686 into main 2026-11-28 19:42:55 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 03:33 UTC · original
kibagami-nc:fix/texture-readback-tickets-reregistered → main · +123 −4 · 4 files · 1 commits · merged 2026-11-28 19:39 UTC

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.

**@⁠kibagami-nc** on GitHub · 2026-11-28 03:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686) `kibagami-nc:fix/texture-readback-tickets-reregistered` → `main` · +123 −4 · 4 files · 1 commits · merged 2026-11-28 19:39 UTC ## 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.
When the title reuses or remaps the memory a back-copied texture tiles
into, the texture's read-back ticket goes stale (texback::replaced). A
later write of the same texture in the same list found the old entry in
back_wanted and registered nothing, so the read-back was dropped: the
title read back nothing for that texture (seen with the ocean's height
map).

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

Port of spk-c's fix (fxceless/victory-fork#1376), with its test
a_rewritten_back_texture_after_reuse_is_read_back: a synthetic R32_FLOAT
texture written, its memory reused, written again; it is read back once at
the list's close. It runs on the host device, and fails with the old
dedup ("the second write re-registered the read-back").
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 03:37:38 +00:00
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-28 03:52 UTC · original

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.

**@⁠Yoshi-233** on GitHub · 2026-11-28 03:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686#issuecomment-7233472903) 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.
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-28 04:38 UTC · original

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

**@⁠ArturoWolff** on GitHub · 2026-11-28 04:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686#issuecomment-7234167616) 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://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/628). 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).
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 05:17 UTC · original · approved these changes

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

**@⁠Dukestar69** on GitHub · 2026-11-28 05:17 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/686#pullrequestreview-6095972519) · **approved these changes** 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).
github-bot referenced this pull request from a commit 2026-11-28 19:41:56 +00:00
github manually merged commit dc5b8db289 into main 2026-11-28 19:42:55 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/trustno1-coder--VIctory-NVIDIA!686
No description provided.