GPU: refresh an uploaded texture view from its current GPU writer #231

Open
github-bot wants to merge 6 commits from github-bot/gh-231 into rx9070xt AGit
Owner

@⁠pokces on GitHub · 2026-11-26 06:49 UTC · original
pokces:fix/rx-alias-after-upload → rx9070xt · +170 −10 · 6 files · 6 commits · open

An upload from title memory can mark a placed texture view as used before the same command list samples it as an alias of a GPU-written texture. If the writer needs no state transition, the previous code skips the copy and the shader sees the uploaded bytes.

This backports kesku’s fix as integrated by fxceless at 19a45d1. The list remembers which GPU source was copied into the view and preserves HostList::used on the RX branch. Original PR · Upstream commit

Verification on the updated rx9070xt base

Merged cd8dfc0 into the PR and expanded the regression in 16a218f. The PR diff touches the three GPU files for the alias fix and its test. Original implementation credit remains with kesku and fxceless.

On the RX 9070 XT (Windows 11 build 26300, driver 32.0.32029.2010, Rust 1.98.1), the D3D12 test read back 0x8c020100 after the first alias copy, 0x12345678 after a destination-only marker and a repeat of the same writer, and 0x4a030201 after switching to a different writer of the same format. All three assertions passed. The default GPU crate suite passed 387 tests with 34 ignored. The asset policy check passed.

For the in-game check we used Series X, 1920×1080, the upstream -Safe profile, and VICTORY_SHADER_OPT=59. The first patched run reached the prison dorm, but two characters had missing faces in the flashback. A separate run of clean cd8dfc0 rendered both faces, and a repeat on the final PR head with its cache populated also rendered both. The cause of the first-run difference remains open. This comparison does not establish a performance gain.

GPT 6.2 Astra generated the expanded regression, the merge resolution and the verification notes. The GPU readbacks and game observations above were collected on physical hardware.

Earlier verification on 81ebb7b

Tested on Windows 11 build 26300, RX 9070 XT, driver 32.0.32029.2010, Rust 1.98.1. On rx9070xt at 81ebb7b, running the added regression test alone returned 0x00000000. With the fix it passed and read back the GPU-written 0x8c020100. The test generates its inputs locally.

cargo test --locked --profile diag -p victory-gpu --features diagnostics --lib alias_after_title_upload_copies_the_gpu_atlas -- --nocapture --test-threads=1

cargo xtask policy passed. This measures texture correctness.

Earlier workspace CI comparison on 81ebb7b (Windows, Rust 1.98.1)

I ran the three workflow commands on both the patch and its clean parent. The default GPU suite passed 327 tests and skipped 34 on each. The workspace tests then stopped in the victory-shader test process with Windows exception 0xc0000005 on both builds.

Both workspace Clippy configurations fail on the parent as well. The precedence warning in victory-formats/src/texture.rs:1346 reproduces on the parent. A separate comparison of the GPU crate found identical sets of Clippy diagnostics in both configurations. The targeted D3D12 regression reported above passes on the patch.


The backport notes and verification report were generated by GPT 6.2 Astra. The original texture fix is by kesku, integrated upstream by fxceless.

**@⁠pokces** on GitHub · 2026-11-26 06:49 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/231) `pokces:fix/rx-alias-after-upload` → `rx9070xt` · +170 −10 · 6 files · 6 commits · open An upload from title memory can mark a placed texture view as used before the same command list samples it as an alias of a GPU-written texture. If the writer needs no state transition, the previous code skips the copy and the shader sees the uploaded bytes. This backports kesku’s fix as integrated by fxceless at `19a45d1`. The list remembers which GPU source was copied into the view and preserves `HostList::used` on the RX branch. [Original PR](https://github.com/fxceless/victory-fork/pull/1241) · [Upstream commit](https://github.com/fxceless/victory-fork/commit/19a45d1924c21002c7d55834cb2df39b927becb1) ### Verification on the updated rx9070xt base Merged `cd8dfc0` into the PR and expanded the regression in `16a218f`. The PR diff touches the three GPU files for the alias fix and its test. Original implementation credit remains with kesku and fxceless. On the RX 9070 XT (Windows 11 build 26300, driver 32.0.32029.2010, Rust 1.98.1), the D3D12 test read back `0x8c020100` after the first alias copy, `0x12345678` after a destination-only marker and a repeat of the same writer, and `0x4a030201` after switching to a different writer of the same format. All three assertions passed. The default GPU crate suite passed 387 tests with 34 ignored. The asset policy check passed. For the in-game check we used Series X, 1920×1080, the upstream `-Safe` profile, and `VICTORY_SHADER_OPT=59`. The first patched run reached the prison dorm, but two characters had missing faces in the flashback. A separate run of clean `cd8dfc0` rendered both faces, and a repeat on the final PR head with its cache populated also rendered both. The cause of the first-run difference remains open. This comparison does not establish a performance gain. GPT 6.2 Astra generated the expanded regression, the merge resolution and the verification notes. The GPU readbacks and game observations above were collected on physical hardware. ### Earlier verification on 81ebb7b Tested on Windows 11 build 26300, RX 9070 XT, driver 32.0.32029.2010, Rust 1.98.1. On `rx9070xt` at `81ebb7b`, running the added regression test alone returned `0x00000000`. With the fix it passed and read back the GPU-written `0x8c020100`. The test generates its inputs locally. ```powershell cargo test --locked --profile diag -p victory-gpu --features diagnostics --lib alias_after_title_upload_copies_the_gpu_atlas -- --nocapture --test-threads=1 ``` `cargo xtask policy` passed. This measures texture correctness. ### Earlier workspace CI comparison on 81ebb7b (Windows, Rust 1.98.1) I ran the three workflow commands on both the patch and its clean parent. The default GPU suite passed 327 tests and skipped 34 on each. The workspace tests then stopped in the `victory-shader` test process with Windows exception `0xc0000005` on both builds. Both workspace Clippy configurations fail on the parent as well. The precedence warning in `victory-formats/src/texture.rs:1346` reproduces on the parent. A separate comparison of the GPU crate found identical sets of Clippy diagnostics in both configurations. The targeted D3D12 regression reported above passes on the patch. --- The backport notes and verification report were generated by GPT 6.2 Astra. The original texture fix is by kesku, integrated upstream by fxceless.
A title-memory upload on the same list has already marked the view used.
Track the last GPU source copied into the view independently of first use.
Keep the RX branch's existing HostList::used bookkeeping.

Backport of kesku's fxceless/victory-fork#1241 as integrated by fxceless.
On the RX branch at 81ebb7b the synthetic readback returns 0 before this
change and 0x8c020100 after it.

Original-PR: https://github.com/fxceless/victory-fork/pull/1241
Upstream-Commit: 19a45d1924c21002c7d55834cb2df39b927becb1
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:53:06 +00:00
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 16:23 UTC · original · reviewed

AI-assisted review. I inspected the alias-source tracking and the added D3D regression statically; I did not run tests or the game. This review suggests coverage for source identity changes.

**@⁠gut0to** on GitHub · 2026-11-26 16:23 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/231#pullrequestreview-6077502912) · **reviewed** AI-assisted review. I inspected the alias-source tracking and the added D3D regression statically; I did not run tests or the game. This review suggests coverage for source identity changes.
@ -7107,0 +7113,4 @@
) -> bool {
let view = view.as_raw() as usize;
let source = source.as_raw() as usize;
self.deferred().texture_aliases.insert(view, source) != Some(source)
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 16:23 UTC · original

AI-assisted review; I did not run tests. Could a focused case verify both repeated use of the same view/source and a later different source for that view? The new regression covers the first alias after a title-memory upload, but not the source-identity behavior: a repeated source should avoid redundant copies, while a changed source should refresh the view with the newer GPU contents.

**@⁠gut0to** on GitHub · 2026-11-26 16:23 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/231#discussion_r4711066774) AI-assisted review; I did not run tests. Could a focused case verify both repeated use of the same view/source and a later different source for that view? The new regression covers the first alias after a title-memory upload, but not the source-identity behavior: a repeated source should avoid redundant copies, while a changed source should refresh the view with the newer GPU contents.
Preserve the target branch's renderer changes and reapply only the alias tracking and its GPU regression. Merge resolution and verification by GPT 6.2 Astra.
Read back three points on the same command list. A destination-only marker exposes a redundant copy from the first writer, and a second writer with distinct contents exposes a missed refresh.

The expanded D3D12 regression and its verification report were generated by GPT 6.2 Astra.
@ -7567,0 +7573,4 @@
) -> bool {
let view = view.as_raw() as usize;
let source = source.as_raw() as usize;
self.deferred().texture_aliases.insert(view, source) != Some(source)
Author
Owner

@⁠pokces on GitHub · 2026-11-27 01:36 UTC · original

Added the same-source and changed-source cases in 16a218f. The test reads back the first writer's 0x8c020100, puts a marker only in the view, and samples the same writer again on the same command list. The marker (0x12345678) survives. Switching to a second writer then yields its 0x4a030201. Both writers were filled on a separate list, so a prior state transition on the new writer cannot trigger the refresh. All three GPU readbacks passed on an RX 9070 XT with Windows driver 32.0.32029.2010.

The expanded regression and this verification note were generated by GPT 6.2 Astra.

**@⁠pokces** on GitHub · 2026-11-27 01:36 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/231#discussion_r4714828653) Added the same-source and changed-source cases in 16a218f. The test reads back the first writer's `0x8c020100`, puts a marker only in the view, and samples the same writer again on the same command list. The marker (`0x12345678`) survives. Switching to a second writer then yields its `0x4a030201`. Both writers were filled on a separate list, so a prior state transition on the new writer cannot trigger the refresh. All three GPU readbacks passed on an RX 9070 XT with Windows driver 32.0.32029.2010. The expanded regression and this verification note were generated by GPT 6.2 Astra.
- Add explicit type annotations to std::mem::transmute in victory-loader/src/descriptor_sites.rs and victory-gpu/src/host/panel.rs (clippy::missing_transmute_annotations)
- Remove unnecessary &mut borrow in victory-gpu/src/watch.rs (clippy::unnecessary_mut_passed)
- Remove unused diagnostics-only Staging::size field in victory-gpu/src/texture.rs (dead_code under --all-features)
Reuse BE29ZZ's fix from Belobug/VIctory-Belobug-AMD#330 on the shared cd8dfc0 base. Integration and commit description by GPT 6.2 Astra.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-27 07:25 UTC · original

Tested the PR's own changes (3933258 and 16a218f) on a-publier 4eb6cfd, on an RX 7900 XT (RDNA3) and on WARP. Driver 32.0.32029.2010, Windows 11 26300, Rust 1.98.1, profile diag with --features diagnostics. Both commits apply cleanly; the Clippy fixes from the base merge are already on a-publier.

alias_after_title_upload_copies_the_gpu_atlas_and_tracks_its_source, readbacks (first alias, same writer after the marker, second writer):

  • 4eb6cfd + the test only: 0x00000000, 0x12345678, 0x12345678. Fails on hardware and on WARP.
    • The first and third checkpoints fail without the fix. The test stops at the first assertion; the third value is from its printed line.
    • The second checkpoint (marker kept) also holds without the fix. It guards against an extra copy, not the original bug.
  • 4eb6cfd + PR: 0x8c020100, 0x12345678, 0x4a030201. Passes on hardware and on WARP.

Full victory-gpu lib suite, --test-threads=1, same results on hardware and on WARP:

  • 4eb6cfd + PR: 445 passed, 1 failed, 34 ignored.
  • 4eb6cfd: 444 passed, 1 failed, 34 ignored.
  • The pass/fail sets differ only by the new test.
  • The one failure, timeline::report::tests::real_waits_are_recorded_with_who_ended_them, fails on both builds. It is not related to this change.

Two local cases the new test does not cover, run on both builds, on hardware and on WARP. As in the test, the view sits in source A's memory in another format; there is no title upload in these cases.

  • alias(view, A), then A rewritten by a GPU copy in the same list, then alias(view, A): both builds read the new value of A. The state change on A still forces the copy with the source map in place.
  • alias(view, A) in one list, then alias(view, B) in a later list: both builds read B. Here both the first use in the new list and the changed source call for a copy.

Not tested:

  • RDNA4 on a-publier
  • the dev profile
  • in-game rendering
**@⁠adrianmjim** on GitHub · 2026-11-27 07:25 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/231#issuecomment-7212464055) Tested the PR's own changes (3933258 and 16a218f) on a-publier 4eb6cfd, on an RX 7900 XT (RDNA3) and on WARP. Driver 32.0.32029.2010, Windows 11 26300, Rust 1.98.1, profile diag with --features diagnostics. Both commits apply cleanly; the Clippy fixes from the base merge are already on a-publier. alias_after_title_upload_copies_the_gpu_atlas_and_tracks_its_source, readbacks (first alias, same writer after the marker, second writer): - 4eb6cfd + the test only: 0x00000000, 0x12345678, 0x12345678. Fails on hardware and on WARP. - The first and third checkpoints fail without the fix. The test stops at the first assertion; the third value is from its printed line. - The second checkpoint (marker kept) also holds without the fix. It guards against an extra copy, not the original bug. - 4eb6cfd + PR: 0x8c020100, 0x12345678, 0x4a030201. Passes on hardware and on WARP. Full victory-gpu lib suite, --test-threads=1, same results on hardware and on WARP: - 4eb6cfd + PR: 445 passed, 1 failed, 34 ignored. - 4eb6cfd: 444 passed, 1 failed, 34 ignored. - The pass/fail sets differ only by the new test. - The one failure, timeline::report::tests::real_waits_are_recorded_with_who_ended_them, fails on both builds. It is not related to this change. Two local cases the new test does not cover, run on both builds, on hardware and on WARP. As in the test, the view sits in source A's memory in another format; there is no title upload in these cases. - alias(view, A), then A rewritten by a GPU copy in the same list, then alias(view, A): both builds read the new value of A. The state change on A still forces the copy with the source map in place. - alias(view, A) in one list, then alias(view, B) in a later list: both builds read B. Here both the first use in the new list and the changed source call for a copy. Not tested: - RDNA4 on a-publier - the dev profile - in-game rendering
This pull request can be merged automatically.
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/231/head:github-bot/gh-231'
git switch 'github-bot/gh-231'

Merge

Merge the changes and update on Forgejo.
git switch 'rx9070xt'
git merge --no-ff 'github-bot/gh-231'
git switch 'github-bot/gh-231'
git rebase 'rx9070xt'
git switch 'rx9070xt'
git merge --ff-only 'github-bot/gh-231'
git switch 'github-bot/gh-231'
git rebase 'rx9070xt'
git switch 'rx9070xt'
git merge --no-ff 'github-bot/gh-231'
git switch 'rx9070xt'
git merge --squash 'github-bot/gh-231'
git switch 'rx9070xt'
git merge --ff-only 'github-bot/gh-231'
git switch 'rx9070xt'
git merge 'github-bot/gh-231'
git push origin 'rx9070xt'
This discussion has been locked. Commenting is limited to contributors.
No description provided.