GPU: a texture sampled before an in-list title memory copy is uploaded again after it #2297

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

@⁠denkencar-sketch on GitHub · 2026-11-25 10:05 UTC · original
denkencar-sketch:fix/host-002 → main · +22 −2 · 1 files · 1 commits · open

Summary

The list's per-texture first-use set was kept across defer_copy and defer, so a later draw skipped the upload of a texture sampled before an in-list title memory copy and read the pre-copy pixels. A title memory copy now makes textures due again. Cost: every later sampled texture is copied again after each title-memory write step; not measured.

Testing

Test a_title_memory_copy_makes_textures_due_again fails on main and passes with this change. cargo test --workspace --locked passes apart from known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

Not tried: a run in the game.

AI-assisted.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 10:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2297) `denkencar-sketch:fix/host-002` → `main` · +22 −2 · 1 files · 1 commits · open ## Summary The list's per-texture first-use set was kept across `defer_copy` and `defer`, so a later draw skipped the upload of a texture sampled before an in-list title memory copy and read the pre-copy pixels. A title memory copy now makes textures due again. Cost: every later sampled texture is copied again after each title-memory write step; not measured. ## Testing Test `a_title_memory_copy_makes_textures_due_again` fails on `main` and passes with this change. `cargo test --workspace --locked` passes apart from known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). Not tried: a run in the game. AI-assisted.
The list's per-texture first-use set was kept across defer_copy and defer,
so a later draw skipped the upload and read the pre-copy pixels.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:01:23 +00:00
Author
Owner

@⁠welisonzika14-jpg on GitHub · 2026-11-25 12:00 UTC · original

First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head a5c7e71 merged onto main 940d32f, cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.

The PR's test host::tests::a_title_memory_copy_makes_textures_due_again passes on this card. The rest is the same as main on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in victory-gpu, 3 in victory-shader), nothing new.

One run, unit tests only, title not run.

Written with AI help (Claude/Kiro); the numbers are from runs on my machine.

**@⁠welisonzika14-jpg** on GitHub · 2026-11-25 12:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2297#issuecomment-7161794228) First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head `a5c7e71` merged onto `main` `940d32f`, `cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast`. The PR's test `host::tests::a_title_memory_copy_makes_textures_due_again` passes on this card. The rest is the same as `main` on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in `victory-gpu`, 3 in `victory-shader`), nothing new. One run, unit tests only, title not run. Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:25 UTC · original · edited 2026-11-26 03:23 UTC

Automated triage for the maintainers.

Verdict: needs work. The rebase is clean, but I don't think the change makes a later draw see the copied pixels. texture::upload sends a texture again after the copy because first_use is true again, and it pushes a second Step::Texture for it. HostList::run_deferred skips Step::Texture ("brought up to date before the submission's lists were made"). The submit path in host.rs collects every list's texture steps into bindless::uploads, which removes duplicates by staging buffer. That upload list runs before all of the submission's lists, so it also runs before this list's Step::Copy. The documented shortcut in texture::upload ("a title copy into texture memory recorded in the same submission shows from the next one on") still holds.

Clearing deferred.textures also clears the odd keys that texture::alias_copy uses, so alias copies get recorded again after every copy or deferred step. That is extra cost with no test.

The new test checks only that first_use returns true again, not that a draw reads the post-copy texels. To fix the bug described, the upload would have to be ordered after the copy, for example by a per-step upload or by splitting the submission at the copy. A test that samples the texture after an in-list copy would show it.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2297#issuecomment-7166826223) · edited 2026-11-26 03:23 UTC <!-- victory-triage v1 head=085b3c3681a67bba27c593b104a3e54920e8a145 verdict=needs-work at=2026-11-26T03:23:16Z --> Automated triage for the maintainers. **Verdict: needs work.** The rebase is clean, but I don't think the change makes a later draw see the copied pixels. `texture::upload` sends a texture again after the copy because `first_use` is true again, and it pushes a second `Step::Texture` for it. `HostList::run_deferred` skips `Step::Texture` ("brought up to date before the submission's lists were made"). The submit path in `host.rs` collects every list's texture steps into `bindless::uploads`, which removes duplicates by staging buffer. That upload list runs before all of the submission's lists, so it also runs before this list's `Step::Copy`. The documented shortcut in `texture::upload` ("a title copy into texture memory recorded in the same submission shows from the next one on") still holds. Clearing `deferred.textures` also clears the odd keys that `texture::alias_copy` uses, so alias copies get recorded again after every copy or deferred step. That is extra cost with no test. The new test checks only that `first_use` returns true again, not that a draw reads the post-copy texels. To fix the bug described, the upload would have to be ordered after the copy, for example by a per-step upload or by splitting the submission at the copy. A test that samples the texture after an in-list copy would show it. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2297/head:github-bot/gh-2297'
git switch 'github-bot/gh-2297'

Merge

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