Port water texture readback and guard against stale writes #997

Merged
cxy0072019-sketch merged 2 commits from upstream-pr/999 into main 2026-11-25 21:09:58 +00:00
cxy0072019-sketch commented 2026-11-25 15:33:31 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by cxy0072019-sketch on 2026-11-25T15:33:31Z.


Summary

Port Geckomacabre/vx-layer@eee5667d to victory-fork. In Gone Fishing, the game's CPU physics reads water height and displacement from textures written by the GPU. Copying those textures back after the submission completes gives the boat its buoyancy after the cutscene. Enable with VICTORY_TEXTURE_BACK=1.

Track the texture allocation through submission and skip the copy if that memory was replaced or remapped, or if the texture was released. Include these destinations in the late submission's pending write ranges. The regression test covers invalidation without discarding unrelated allocations.

Refs #863. The original patch is preserved as a separate commit with its authorship.

Validation

  • Clean PR branch on Windows: cargo test --locked -p victory-gpu --lib -- --test-threads=1 returned 171 passed, 5 ignored. cargo build --locked --profile diag -p victory --features diagnostics and the victory --version smoke test passed.
  • Previous 720p Series S renderer with this backport, Windows Sandbox and RTX 5070 Ti: in two runs, the boat remained afloat under player control and the objective advanced from Follow the plane to Collect the package. The unpatched local renderer failed after handing off control. Water surface artifacts remain. The gameplay verification used the local renderer branch, while the clean PR branch verification covers the build and GPU tests above.
<!-- greyfinch-sync:fxceless/victory-fork:issue:5494374369 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/999). Originally posted by [cxy0072019-sketch](https://github.com/cxy0072019-sketch) on 2026-11-25T15:33:31Z. --- ## Summary Port Geckomacabre/vx-layer@eee5667d to victory-fork. In Gone Fishing, the game's CPU physics reads water height and displacement from textures written by the GPU. Copying those textures back after the submission completes gives the boat its buoyancy after the cutscene. Enable with `VICTORY_TEXTURE_BACK=1`. Track the texture allocation through submission and skip the copy if that memory was replaced or remapped, or if the texture was released. Include these destinations in the late submission's pending write ranges. The regression test covers invalidation without discarding unrelated allocations. Refs #863. The [original patch](https://github.com/Geckomacabre/vx-layer/commit/eee5667d) is preserved as a separate commit with its authorship. ## Validation - Clean PR branch on Windows: `cargo test --locked -p victory-gpu --lib -- --test-threads=1` returned 171 passed, 5 ignored. `cargo build --locked --profile diag -p victory --features diagnostics` and the `victory --version` smoke test passed. - Previous 720p Series S renderer with this backport, Windows Sandbox and RTX 5070 Ti: in two runs, the boat remained afloat under player control and the objective advanced from **Follow the plane** to **Collect the package**. The unpatched local renderer failed after handing off control. Water surface artifacts remain. The gameplay verification used the local renderer branch, while the clean PR branch verification covers the build and GPU tests above.
iGoldenNinja commented 2026-11-25 17:08:01 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by iGoldenNinja on 2026-11-25T16:18:43Z.


I tested a related allocation-lifetime guard on an RTX 5080. One case that may be worth adding to this PR's regression tests is a later command list naming an old texture after a new buffer takes the same guest base. The old texture can still be alive. Tracking which resource owns the address at creation lets the renderer reject a new readback for that retired owner. The test passed in our port of the allocation checks from this PR. Guard and regression tests

On native Windows 11 Pro 25H2 build 26200.9974, RTX 5080 16 GB / 617.14, Ryzen 9 5900X and Series X settings, the guarded revision kept the boat and both occupants afloat with only the 64×64 RG32F and 128×128 RG16_UINT outputs copied back. The package objective appeared while the controller was idle. Throttle then produced twin wakes, and steering changed the boat's heading against the bridge. At least 1,024 and 256 full-plane writes completed, respectively. No stale rejection was logged during gameplay. The unit test is the evidence for that case. Pinned native report

<!-- greyfinch-sync:fxceless/victory-fork:comment:7167776793 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/999#issuecomment-7167776793). Originally posted by [iGoldenNinja](https://github.com/iGoldenNinja) on 2026-11-25T16:18:43Z. --- I tested a related allocation-lifetime guard on an RTX 5080. One case that may be worth adding to this PR's regression tests is a later command list naming an old texture after a new buffer takes the same guest base. The old texture can still be alive. Tracking which resource owns the address at creation lets the renderer reject a new readback for that retired owner. The test passed in our port of the allocation checks from this PR. [Guard and regression tests](https://github.com/iGoldenNinja/victory-fork/commit/b97bb825e6d2f7dda59c7c7acc95501b97e2cb00) On native Windows 11 Pro 25H2 build 26200.9974, RTX 5080 16 GB / 617.14, Ryzen 9 5900X and Series X settings, the guarded revision kept the boat and both occupants afloat with only the 64×64 RG32F and 128×128 RG16_UINT outputs copied back. The package objective appeared while the controller was idle. Throttle then produced twin wakes, and steering changed the boat's heading against the bridge. At least 1,024 and 256 full-plane writes completed, respectively. No stale rejection was logged during gameplay. The unit test is the evidence for that case. [Pinned native report](https://github.com/iGoldenNinja/victory-fork/blob/9a6f178c628015fe1c552e33f4a5c1d5cc30bbcb/docs/water-readback-allocation-lifetime.md)
SkillIssueXO commented 2026-11-25 18:05:12 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by SkillIssueXO on 2026-11-25T17:12:17Z.


Independent Series X test on an RTX 5070 Ti with 465b94f, paired waves from #854, and #999 at 04df435. Both runs used copies of the same local checkpoint with the structure builder off.

  • All four readback formats with VICTORY_LATE_WAIT=3 logged 896 landed copies before a DXGI_ERROR_DEVICE_HUNG after three deferred submissions.
  • With VICTORY_LATE_WAIT=0, the boat cutscene ran farther and logged 6,528 landed copies. The game then exited with 0xc0000005, reading null in VCRUNTIME140.dll+0x1c45a from title code. Available system commit was above 20 GiB. These were single runs and the logs establish two failure signatures.
  • The retry restricted to 256x256f41,256x256f16 reached the handoff. Black water patches remained. In the synchronous run, frame 1871 already shows the patches in the 2560×1440 RGBA16F scene target before final upscale.

Follow-up on the smaller formats. I tested ca8829f with the allocation ownership guard from b97bb825, paired waves, and VICTORY_LATE_WAIT=0. Both Series X replays logged the parsed list [(64, 64, 16), (128, 128, 36)] and completed water readbacks. They reached the boat cutscene, then hit the same null 16-byte read at VCRUNTIME140.dll+0x1c45a, with the first two title return offsets +0x3de6491 and +0x3de2054. The last reported cumulative copy counts were 1,024 and 1,280. Around 21 GiB of system commit remained free in both runs.

The second replay enabled the indirect lighting dispatch split. The lighting shader bound and black patches remained visible during the cutscene. This run did not record the requested or submitted group counts. The explicit kind list and completed copies distinguish these runs from the launcher parse issue in #1037.

AI-assisted analysis. Aggregate measurements only.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7169160638 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/999#issuecomment-7169160638). Originally posted by [SkillIssueXO](https://github.com/SkillIssueXO) on 2026-11-25T17:12:17Z. --- Independent Series X test on an RTX 5070 Ti with `465b94f`, paired waves from #854, and #999 at `04df435`. Both runs used copies of the same local checkpoint with the structure builder off. - All four readback formats with `VICTORY_LATE_WAIT=3` logged 896 landed copies before a `DXGI_ERROR_DEVICE_HUNG` after three deferred submissions. - With `VICTORY_LATE_WAIT=0`, the boat cutscene ran farther and logged 6,528 landed copies. The game then exited with `0xc0000005`, reading null in `VCRUNTIME140.dll+0x1c45a` from title code. Available system commit was above 20 GiB. These were single runs and the logs establish two failure signatures. - The retry restricted to `256x256f41,256x256f16` reached the handoff. Black water patches remained. In the synchronous run, frame 1871 already shows the patches in the 2560×1440 RGBA16F scene target before final upscale. **Follow-up on the smaller formats.** I tested `ca8829f` with the allocation ownership guard from `b97bb825`, paired waves, and `VICTORY_LATE_WAIT=0`. Both Series X replays logged the parsed list `[(64, 64, 16), (128, 128, 36)]` and completed water readbacks. They reached the boat cutscene, then hit the same null 16-byte read at `VCRUNTIME140.dll+0x1c45a`, with the first two title return offsets `+0x3de6491` and `+0x3de2054`. The last reported cumulative copy counts were 1,024 and 1,280. Around 21 GiB of system commit remained free in both runs. The second replay enabled the indirect lighting dispatch split. The lighting shader bound and black patches remained visible during the cutscene. This run did not record the requested or submitted group counts. The explicit kind list and completed copies distinguish these runs from the launcher parse issue in #1037. AI-assisted analysis. Aggregate measurements only.
upstream-sync closed this pull request 2026-11-25 22:07:07 +00:00
DuarttBR commented 2026-11-25 22:07:24 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by DuarttBR on 2026-11-25T21:35:51Z.


Independent test on an RTX 3080 10 GB (Ampere, GA102). The other reports here are on Blackwell cards (RTX 5070 Ti, 5080), so this adds a different architecture.

Machine: driver 617.42, Ryzen 9 5900X, 32 GB RAM, Windows 11 Pro (build 26300), Series X profile at 1080p (VICTORY_RESOLUTION=1920x1080).

Tree: soldsawn/victory-nvidia-8gb at 7b7b952 (fork ca8829f plus community PRs), with this PR (895c0b8, 04df435) cherry-picked on top, clean. VICTORY_TEXTURE_BACK=1; the log shows kinds=[(256, 256, 41), (256, 256, 16), (64, 64, 16), (128, 128, 36)].

Before (same build, TEXTURE_BACK unset): the water did not load and the player could run along the bottom, underwater.

After: the water behaves, and I played most of the boat mission ("Gone Fishing") before the game stopped in the binoculars cutscene. That stop is a separate problem, an int3 that looks like a read of memory nobody wrote; details in #1049 (it is a different address from the access violation reported there).

One build, one long session (about 14 minutes). I did not compare frame times with and without the readback.

AI-assisted (Claude Code). Measured on my own machine. No game files or captures attached.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7175288037 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/999#issuecomment-7175288037). Originally posted by [DuarttBR](https://github.com/DuarttBR) on 2026-11-25T21:35:51Z. --- Independent test on an RTX 3080 10 GB (Ampere, GA102). The other reports here are on Blackwell cards (RTX 5070 Ti, 5080), so this adds a different architecture. **Machine:** driver 617.42, Ryzen 9 5900X, 32 GB RAM, Windows 11 Pro (build 26300), Series X profile at 1080p (`VICTORY_RESOLUTION=1920x1080`). **Tree:** `soldsawn/victory-nvidia-8gb` at `7b7b952` (fork `ca8829f` plus community PRs), with this PR (`895c0b8`, `04df435`) cherry-picked on top, clean. `VICTORY_TEXTURE_BACK=1`; the log shows `kinds=[(256, 256, 41), (256, 256, 16), (64, 64, 16), (128, 128, 36)]`. **Before** (same build, `TEXTURE_BACK` unset): the water did not load and the player could run along the bottom, underwater. **After:** the water behaves, and I played most of the boat mission ("Gone Fishing") before the game stopped in the binoculars cutscene. That stop is a separate problem, an `int3` that looks like a read of memory nobody wrote; details in #1049 (it is a different address from the access violation reported there). One build, one long session (about 14 minutes). I did not compare frame times with and without the readback. AI-assisted (Claude Code). Measured on my own machine. No game files or captures attached.
B0rm0t0s commented 2026-11-25 23:09:56 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by B0rm0t0s on 2026-11-25T22:23:45Z.


✅ Tested on RTX 5080: water works

VICTORY_TEXTURE_BACK=1 fixes the sinking boats on my machine too.

GPU RTX 5080 16 GB
CPU Ryzen 7 7800X3D
RAM 32 GB DDR5
Commit c36971b
Run 48 min, one session

What works now

  • ✅ Boat floats and starts from standstill
  • ✅ Seaplane lands and taxis into the dock
  • ✅ Got through Gone Fishing to Jason's house
  • ✅ No device removed, no device errors
  • ✅ I closed the game myself, it did not crash

Performance

  • ~6.7 fps average in the open world
  • ~7,800 draws per frame
  • GPU upload heaps: supported and used
🔧 Switches used
Switch Value
VICTORY_ASYNC_SUBMIT 1
VICTORY_QUEUE2 1
VICTORY_INDIRECT_WINDOW 1
VICTORY_TEXTURE_NO_WAIT 1
VICTORY_COPY_PLAIN 1
VICTORY_JOIN_PARTS 1
VICTORY_BACK_OWN_VIEW 1
VICTORY_INDIRECT_GATHER 1
VICTORY_CARD_REHASH_RUNS 1
VICTORY_CARD_WINDOWS_MB 2048
VICTORY_WINDOW_UPLOAD 1
VICTORY_CARD_BUFFERS_MIN_KB 64
VICTORY_CARD_BUFFERS_MB 1280
VICTORY_TEXTURE_BACK 1

Note: 48 minutes with the read-back on ran
clean here, so the device loss in run 276 may
not be caused by the read-back itself.

Thanks for the fix! 🙏

<!-- greyfinch-sync:fxceless/victory-fork:comment:7176308534 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/999#issuecomment-7176308534). Originally posted by [B0rm0t0s](https://github.com/B0rm0t0s) on 2026-11-25T22:23:45Z. --- ## ✅ Tested on RTX 5080: water works **`VICTORY_TEXTURE_BACK=1` fixes the sinking boats on my machine too.** | | | |---|---| | **GPU** | RTX 5080 16 GB | | **CPU** | Ryzen 7 7800X3D | | **RAM** | 32 GB DDR5 | | **Commit** | `c36971b` | | **Run** | 48 min, one session | ### What works now - ✅ Boat floats and starts from standstill - ✅ Seaplane lands and taxis into the dock - ✅ Got through *Gone Fishing* to Jason's house - ✅ No device removed, no device errors - ✅ I closed the game myself, it did not crash ### Performance - ~**6.7 fps** average in the open world - ~7,800 draws per frame - GPU upload heaps: supported and used <details> <summary>🔧 Switches used</summary> | Switch | Value | |---|---| | `VICTORY_ASYNC_SUBMIT` | 1 | | `VICTORY_QUEUE2` | 1 | | `VICTORY_INDIRECT_WINDOW` | 1 | | `VICTORY_TEXTURE_NO_WAIT` | 1 | | `VICTORY_COPY_PLAIN` | 1 | | `VICTORY_JOIN_PARTS` | 1 | | `VICTORY_BACK_OWN_VIEW` | 1 | | `VICTORY_INDIRECT_GATHER` | 1 | | `VICTORY_CARD_REHASH_RUNS` | 1 | | `VICTORY_CARD_WINDOWS_MB` | 2048 | | `VICTORY_WINDOW_UPLOAD` | 1 | | `VICTORY_CARD_BUFFERS_MIN_KB` | 64 | | `VICTORY_CARD_BUFFERS_MB` | 1280 | | `VICTORY_TEXTURE_BACK` | 1 | </details> > **Note:** 48 minutes with the read-back on ran > clean here, so the device loss in run 276 may > not be caused by the read-back itself. Thanks for the fix! 🙏
Filip722 commented 2026-11-27 15:38:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-27T15:38:59Z.


Independent Series S check of the existing water readback on an RTX 5060 Laptop (8 GB), Intel Core 7 240H, 16 GB RAM, Bazzite 44, NVIDIA 615.78.08, GE-Proton11-14 and vkd3d-proton 3.2.0.

Both replays used the same Windows MSVC release from a local compatibility build based on 4c60466140f4bccd2252427b6f2cfbc658c16906, the same offline checkpoint and starting caches, and the same Series S settings. The only runtime switch difference was VICTORY_TEXTURE_BACK=1.

  • With readback off, the boat submerged without input and the title reported that its passenger fell off, reproducing the earlier in-session failure.
  • With readback on, the log confirmed that readbacks landed, the boat stayed afloat past that point, and ordinary throttle and steering moved it across open water. An 83-second sample starting at the on-water objective contained 574 distinct completed Presents (6.92 FPS, 132/178 ms median/p95, 1,136 MiB minimum free VRAM). I subsequently drove it onto the bank and confirmed the checkpoint retry also spawned afloat.

This verifies the existing switch on this Proton/laptop setup. Main's new NVIDIA base defaults to enabling it.

Assisted by Codex (GPT-6.2-Sol High).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7222314418 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/999#issuecomment-7222314418). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-27T15:38:59Z. --- Independent Series S check of the existing water readback on an RTX 5060 Laptop (8 GB), Intel Core 7 240H, 16 GB RAM, Bazzite 44, NVIDIA 615.78.08, GE-Proton11-14 and vkd3d-proton 3.2.0. Both replays used the same Windows MSVC release from a local compatibility build based on `4c60466140f4bccd2252427b6f2cfbc658c16906`, the same offline checkpoint and starting caches, and the same Series S settings. The only runtime switch difference was `VICTORY_TEXTURE_BACK=1`. - With readback off, the boat submerged without input and the title reported that its passenger fell off, reproducing the earlier in-session failure. - With readback on, the log confirmed that readbacks landed, the boat stayed afloat past that point, and ordinary throttle and steering moved it across open water. An 83-second sample starting at the on-water objective contained 574 distinct completed Presents (6.92 FPS, 132/178 ms median/p95, 1,136 MiB minimum free VRAM). I subsequently drove it onto the bank and confirmed the checkpoint retry also spawned afloat. This verifies the existing switch on this Proton/laptop setup. Main's new NVIDIA base defaults to enabling it. Assisted by Codex (GPT-6.2-Sol High).
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
fxceless/victory-fork!997
No description provided.