Twin copies: a whole copy into a held twin goes subresource by subresource (follow-up to #3792) #4040

Open
github-bot wants to merge 1 commit from github-bot/gh-4040 into main AGit
Owner

@⁠Mikey970 on GitHub · 2026-11-30 15:05 UTC · original
Mikey970:pr/twin-whole-copy → main · +96 −9 · 2 files · 1 commits · open

Fixes #

What it changes

Follow-up to #3792 (merged): a gap found in review after the merge (note on #3792). #3792 left out a whole CopyResource into a placed twin whose host copy is laid out differently from the source's, for example a twin made of held levels only (it begins at a later level). That avoided the refused copy, but the twin kept stale contents. The layout check also compared the twin with the destination's host texture (to), not with from, the source the copy actually reads.

Now in copy_resource (list.rs):

  • The twin's host copy is compared with the source's (from). When they are laid out alike, it is one CopyResource as before.
  • When they differ, each title subresource both ends hold at the same size gets its own CopyTextureRegion. Each subresource is mapped with host_target at both ends, covering every level, array slice and plane (resource::whole_copy_pairs, built on held_pairs).
  • The copy is left out only when no subresource is held alike (twin_copy_left_out, why whole copy, no level held alike).

How it was tested

  • GPU and profile: unit tests only, on WARP (VICTORY_WARP=1); not yet measured in-game. IN-GAME-ON-MAIN: pending.
  • New test a_whole_copy_into_a_held_twin_takes_the_levels_both_hold: a twin that begins at level 3 of 11 takes title levels 3–10 of each slice from a full source at their own indices; a held source gives only what it holds; nothing held at one end gives no copy.
  • Existing a_copy_into_a_held_copy_takes_its_own_level and a_placed_copy_target_keeps_the_stencil_plane still pass.
  • For shader changes, the wave sizes tested: n/a
  • cargo test passed for the crates it touches: yes, the targeted victory-gpu tests above. Clippy on victory-gpu --all-targets adds no warnings. The CI check failure (unwind_copy in victory-loader) is pre-existing on main. On main c71899d9 the victory-gpu lib tests do not compile: two card_pass calls in host.rs tests lack the new capture argument. I passed [0; 3] locally to run the tests above; that change is not part of this PR.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3792, #3062, #3976
    • #3062 fits the title's own whole copy between dst and src host copies, not the copy into placed twins.
    • #3976 routes region copies into twins of another format family through a buffer; it does not touch the whole-copy twin path.

🤖 Generated with Claude Code

**@⁠Mikey970** on GitHub · 2026-11-30 15:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4040) `Mikey970:pr/twin-whole-copy` → `main` · +96 −9 · 2 files · 1 commits · open Fixes # ## What it changes Follow-up to #3792 (merged): a gap found in review after the merge ([note on #3792](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/3792)). #3792 left out a whole `CopyResource` into a placed twin whose host copy is laid out differently from the source's, for example a twin made of held levels only (it begins at a later level). That avoided the refused copy, but the twin kept stale contents. The layout check also compared the twin with the destination's host texture (`to`), not with `from`, the source the copy actually reads. Now in `copy_resource` (`list.rs`): - The twin's host copy is compared with the source's (`from`). When they are laid out alike, it is one `CopyResource` as before. - When they differ, each title subresource both ends hold at the same size gets its own `CopyTextureRegion`. Each subresource is mapped with `host_target` at both ends, covering every level, array slice and plane (`resource::whole_copy_pairs`, built on `held_pairs`). - The copy is left out only when no subresource is held alike (`twin_copy_left_out`, why `whole copy, no level held alike`). ## How it was tested - GPU and profile: unit tests only, on WARP (`VICTORY_WARP=1`); not yet measured in-game. IN-GAME-ON-MAIN: pending. - New test `a_whole_copy_into_a_held_twin_takes_the_levels_both_hold`: a twin that begins at level 3 of 11 takes title levels 3–10 of each slice from a full source at their own indices; a held source gives only what it holds; nothing held at one end gives no copy. - Existing `a_copy_into_a_held_copy_takes_its_own_level` and `a_placed_copy_target_keeps_the_stencil_plane` still pass. - For shader changes, the wave sizes tested: n/a - `cargo test` passed for the crates it touches: yes, the targeted `victory-gpu` tests above. Clippy on `victory-gpu --all-targets` adds no warnings. The CI `check` failure (`unwind_copy` in `victory-loader`) is pre-existing on `main`. On `main` c71899d9 the `victory-gpu` lib tests do not compile: two `card_pass` calls in `host.rs` tests lack the new `capture` argument. I passed `[0; 3]` locally to run the tests above; that change is not part of this PR. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3792, #3062, #3976 - #3062 fits the title's own whole copy between `dst` and `src` host copies, not the copy into placed twins. - #3976 routes region copies into twins of another format family through a buffer; it does not touch the whole-copy twin path. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A `CopyResource` into a title texture whose placed twin's host copy is
laid out otherwise (it begins at a later level: held levels) was left
out, so the twin kept stale contents. The layouts compared were the
destination's and the twin's; the copy's ends are the twin's and the
source's, so those are compared now. When they differ, every
subresource both hold at the same size (`host_target` at both ends,
every level, array slice and plane) is copied with `CopyTextureRegion`
(`whole_copy_pairs`); only when none is held alike is the copy left out
(`whole copy, no level held alike`). Test:
`a_whole_copy_into_a_held_twin_takes_the_levels_both_hold`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 3a9e9a6917b724c6d0818d7205021e6743203999)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 15:10:41 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
The changes on this branch are already on the target branch. This will be an empty commit.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4040/head:github-bot/gh-4040'
git switch 'github-bot/gh-4040'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4040'
git switch 'github-bot/gh-4040'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4040'
git switch 'github-bot/gh-4040'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4040'
git switch 'main'
git merge --squash 'github-bot/gh-4040'
git switch 'main'
git merge --ff-only 'github-bot/gh-4040'
git switch 'main'
git merge 'github-bot/gh-4040'
git push origin 'main'
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!4040
No description provided.