Copy back render targets of listed kinds, and the water's kinds by default (rivers and pools no longer push the player out) #4675
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4675
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4674"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@cadfan on GitHub · 2026-12-01 01:31 UTC · original
cadfan:fix/4533-render-target-copy-back→main· +101 −4 · 5 files · 1 commits · closed without mergingFixes #4534
What it changes
What was wrong. On the console the CPU sees what the GPU wrote. Here, a texture the card writes is copied back into title memory only if its kind is in
VICTORY_TEXTURE_BACKand a shader wrote it through unordered access. Render targets were never copied back.The game's water reads textures like that on the CPU. A read watch (the separate PR #4676,
VICTORY_READ_WATCH=1) found these reads:256x256f61). It is read about ten times a second, from two places in the title's code (+0x50313d2and+0x203345d). With the target copied back, it holds 128 where the water is calm, and it dropped to 124 at a splash. Without it, the title read memory the card's drawing never reached.2048x128f62and4096x64f62(R8_UINT), and4096x64f57(R16_UINT). Their kinds were not in the list, so the title read zeros.64x64f50(R8G8_UINT), read once.The result was the "strong current" in #4534. The player was pushed out of rivers and pools, the car was too, and Bret's pickup flipped in the river in Veteran Hunted.
What this does.
HostList::target_written, fromdraw.rsandclear_rtv). It applies only to kinds inVICTORY_TEXTURE_BACK.VICTORY_TEXTURE_BACK_TARGETS=0turns the render-target copy-back off, to compare against the old behaviour.256x256f61,64x64f50,2048x128f62,4096x64f62,4096x64f57.Why this fixes it. The water code uses these textures to decide how water pushes on the player and vehicles. The ripple map sits at 128 in calm water and moves away from 128 where something disturbs it (124 at a splash). Before, the title never saw what the card drew into that map, so calm water didn't read as calm, and the lookup tables read as zeros. Our reading is that this produced the steady outward push. Now, when a list that wrote one of these textures finishes, it is copied back and tiled into title memory in the console's layout, as for the ocean. The title reads calm water and real table data, at most a frame late.
Related to #3363, but not the same. #3363 also copies back a render target, but only one: the 960x536 linear phone-photo target (
render_target_wantedchecks for that kind and a linear layout). The water's target isn't let through, so #3363 doesn't fix this. Here, any listed kind is copied back. The two PRs touch a few of the same lines indraw.rs,host.rsandlist.rs, so whichever merges second needs a rebase.Cost. Lists that write one of these kinds now copy it back when they close. The texture readback is 64 KiB for the target and 256-512 KiB for each table. The tables are written only around the time the player enters water.
How it was tested
0b353a75(main of 2026-11-30 plus #3043 and #3487), with these kinds set throughVICTORY_TEXTURE_BACK:exit=0).a3c670a8), withVICTORY_TEXTURE_BACK=1so the new default kinds apply (the log lists all nine): I walked into Kelly River, swam, dived under and came back up, then swam and waded back to the bank. I wasn't pushed out. The game exited cleanly (exit=0), and the frame rate was the same as in the earlier runs. I started Veteran Hunted on this commit, but stopped before the river crossing.cargo testpassed for the crates it touches: yes, apart from tests that also fail onmain:cargo test -p victory-gpu --lib -- a_cleared_target_of_a_kind a_rewritten_back_texturepasses on the RTX 5080. The new test clears a 256x256 R8_UNORM target and checks every texel in title memory is 128.VICTORY_TEXTURE_BACK_TARGETS=0, the new test fails as it should (texture_back_count0, expected 1).cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: clean.cargo test --workspace --locked --no-fail-fast: everything passes exceptvictory-hle'sxmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it. That test fails the same way onmain(7d93ee07) when the crate runs as a whole, and passes alone. Open PR #2439 covers it.mainand on this branch:pipeline::make::a_pipeline_made_ready_is_the_one_the_title_gets, andcard_steps::shared_scratch_eliminates_flight_settle_end_to_end(#2741).Checked for overlap
VICTORY_TEXTURE_BACK,texback,read watch,4533, "render target copy back" and "river current". Related: #3363 (photo-only render-target copy-back, see above); #3524 (deduplicates texbacks); #4464 (HOST_WRITTEN_ATand remaps). None of them covers this.@trustno1-coder on GitHub · 2026-12-01 18:35 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed