GPU: refresh heap textures with untracked pages (FIND-17) #3041

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

@⁠leftmove on GitHub · 2026-11-26 04:58 UTC · original
leftmove:fix/find-17-mixed-texture-refresh → main · +72 −15 · 2 files · 1 commits · open

FIND-17, coordinated in Marvisak/VIctory#1633.

A texture can span both tracked and untracked memory. The submission-time refresh used only the tracker's dirty ranges, so once those pages were clean, a late write to the untracked portion could leave the heap texture at its initial zeros.

Include untracked ranges when choosing subresources to refresh. A subresource that touches untracked memory keeps a content hash to avoid another GPU copy when its bytes stay the same. The synthetic regression exercises the heap upload path, samples the resulting host texture, and checks the initial zero, the late write, and the absence of duplicate uploads.

Verification

  • Linux — victory-formats and xtask passed (52 passed, 5 ignored). The staged asset-policy check passed.
  • A temporary Linux harness using the refresh routine with a simulated tracker and staging buffer reproduced the missed write on main and passed with the fix.
  • The victory-gpu tests type-checked for x86_64-pc-windows-gnu in default and diagnostics builds. The native Linux victory-gpu build hits the same Windows-gating errors on main.
  • The D3D12 regression was not executed locally. Windows, WARP, and a compatible GPU were unavailable. The reported gameplay symptom remains unverified.

AI-assisted with Codex. Original finding

**@⁠leftmove** on GitHub · 2026-11-26 04:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/3041) `leftmove:fix/find-17-mixed-texture-refresh` → `main` · +72 −15 · 2 files · 1 commits · open FIND-17, coordinated in Marvisak/VIctory#1633. A texture can span both tracked and untracked memory. The submission-time refresh used only the tracker's dirty ranges, so once those pages were clean, a late write to the untracked portion could leave the heap texture at its initial zeros. Include untracked ranges when choosing subresources to refresh. A subresource that touches untracked memory keeps a content hash to avoid another GPU copy when its bytes stay the same. The synthetic regression exercises the heap upload path, samples the resulting host texture, and checks the initial zero, the late write, and the absence of duplicate uploads. ### Verification - Linux — `victory-formats` and `xtask` passed (52 passed, 5 ignored). The staged asset-policy check passed. - A temporary Linux harness using the refresh routine with a simulated tracker and staging buffer reproduced the missed write on `main` and passed with the fix. - The `victory-gpu` tests type-checked for `x86_64-pc-windows-gnu` in default and diagnostics builds. The native Linux `victory-gpu` build hits the same Windows-gating errors on `main`. - The D3D12 regression was not executed locally. Windows, WARP, and a compatible GPU were unavailable. The reported gameplay symptom remains unverified. AI-assisted with Codex. [Original finding](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:27:21 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 06:15 UTC · original

Automated triage for the maintainers.

I confirmed the bug on main. watch::track_as gives a tracker with untracked parts no dirty bit, so it is never clean(). However, Staging::refresh_now in crates/victory-gpu/src/texture.rs looks only at Tracked::take. A write to the untracked part of a texture that is partly tracked returns no ranges, so the texture is never refreshed. shadow.rs already handles Tracked::untracked, but texture.rs did not.

This PR adds subresources that overlap t.untracked(..) to the refresh set. For those subresources it always decides by the blake3 hash, skipping the "a whole page changed" shortcut, so unchanged bytes are not uploaded again. This is the content-hash behaviour the module doc already describes for untracked memory. I found no other callers affected.

CI: check passing. The new D3D12 test a_heap_texture_refreshes_after_a_write_to_its_untracked_page returns early without a host device, and the author did not run it on Windows. Please run it once on a GPU machine before merging. The reported in-game symptom is also unverified, as the description says.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 06:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3041#issuecomment-7184255472) <!-- victory-triage v1 head=ddadc546877a0ac25c0b3ac9a905e9229d226fb7 verdict=merge-candidate at=2026-11-26T06:28:00Z --> Automated triage for the maintainers. I confirmed the bug on `main`. `watch::track_as` gives a tracker with untracked parts no dirty bit, so it is never `clean()`. However, `Staging::refresh_now` in `crates/victory-gpu/src/texture.rs` looks only at `Tracked::take`. A write to the untracked part of a texture that is partly tracked returns no ranges, so the texture is never refreshed. `shadow.rs` already handles `Tracked::untracked`, but `texture.rs` did not. This PR adds subresources that overlap `t.untracked(..)` to the refresh set. For those subresources it always decides by the blake3 hash, skipping the "a whole page changed" shortcut, so unchanged bytes are not uploaded again. This is the content-hash behaviour the module doc already describes for untracked memory. I found no other callers affected. CI: `check` passing. The new D3D12 test `a_heap_texture_refreshes_after_a_write_to_its_untracked_page` returns early without a host device, and the author did not run it on Windows. Please run it once on a GPU machine before merging. The reported in-game symptom is also unverified, as the description says. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 05:15 UTC · original · approved these changes

Code review and Windows GPU verification of ddadc546.

Logic looks sound:

  • watch::track already leaves trackers with non-empty untracked runs without a dirty bit (bit = None), so t.clean() and clean_bit(bit) stay false and refresh_all / bindless always reach refresh_now.
  • t.untracked(start, start + size) clamps runs to [start, start + size), so f - start / e - start cannot underflow.
  • Keeping !has_untracked on the whole-page shortcut ensures a subresource touching untracked memory keeps its content hash even after a tracked write, avoiding redundant uploads on subsequent submissions; and on detile failure, last.hashes[i] is cleared so the next refresh retries.

Tested locally on Windows 11 with both NVIDIA RTX 5090 and D3D12 WARP:

  • cargo test --locked -p victory-gpu --lib a_heap_texture_refreshes_after_a_write_to_its_untracked_page — passed on RTX 5090 and WARP
  • cargo test --locked -p victory-gpu --lib texture::tests:: — 2/2 passed
**@⁠fuzeofficlal** on GitHub · 2026-11-26 05:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3041#pullrequestreview-6068892636) · **approved these changes** Code review and Windows GPU verification of `ddadc546`. Logic looks sound: - `watch::track` already leaves trackers with non-empty `untracked` runs without a dirty bit (`bit = None`), so `t.clean()` and `clean_bit(bit)` stay `false` and `refresh_all` / `bindless` always reach `refresh_now`. - `t.untracked(start, start + size)` clamps runs to `[start, start + size)`, so `f - start` / `e - start` cannot underflow. - Keeping `!has_untracked` on the whole-page shortcut ensures a subresource touching untracked memory keeps its content hash even after a tracked write, avoiding redundant uploads on subsequent submissions; and on `detile` failure, `last.hashes[i]` is cleared so the next refresh retries. Tested locally on Windows 11 with both NVIDIA RTX 5090 and D3D12 WARP: - `cargo test --locked -p victory-gpu --lib a_heap_texture_refreshes_after_a_write_to_its_untracked_page` — passed on RTX 5090 and WARP - `cargo test --locked -p victory-gpu --lib texture::tests::` — 2/2 passed
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 05:26 UTC · original · approved these changes

Verified: trackers with untracked parts never carry a clean bit (watch.rs), so refresh_now reaches the new path every submission; has_untracked subresources are always hashed rather than taking the owned-dirty-page shortcut — the only detector for writes the tracker cannot see — and the hash is kept across refreshes so unchanged spans still skip. The hardware test's committed-untracked/reserved-tracked split discriminates all four transitions.

**@⁠kotekompotek** on GitHub · 2026-11-26 05:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/3041#pullrequestreview-6068971430) · **approved these changes** Verified: trackers with untracked parts never carry a clean bit (watch.rs), so `refresh_now` reaches the new path every submission; `has_untracked` subresources are always hashed rather than taking the owned-dirty-page shortcut — the only detector for writes the tracker cannot see — and the hash is kept across refreshes so unchanged spans still skip. The hardware test's committed-untracked/reserved-tracked split discriminates all four transitions.
Author
Owner

@⁠leftmove on GitHub · 2026-11-26 08:24 UTC · original

Thanks for confirming the bug on main and marking this a merge candidate. Triage review

This Linux machine has no GPU, so I couldn’t run a_heap_texture_refreshes_after_a_write_to_its_untracked_page here. The test returns early without a host device, and the in-game symptom remains unverified. A maintainer or verifier with a Windows GPU machine will need to run the test before merging.

AI-assisted with Codex.

**@⁠leftmove** on GitHub · 2026-11-26 08:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3041#issuecomment-7186551518) Thanks for confirming the bug on `main` and marking this a merge candidate. [Triage review](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3041) This Linux machine has no GPU, so I couldn’t run `a_heap_texture_refreshes_after_a_write_to_its_untracked_page` here. The test returns early without a host device, and the in-game symptom remains unverified. A maintainer or verifier with a Windows GPU machine will need to run the test before merging. AI-assisted with Codex.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 08:31 UTC · original · approved these changes

Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 21/21 passed on RTX 5090 and WARP (including a_heap_texture_refreshes_after_a_write_to_its_untracked_page).
  • cargo test -p victory-gpu --lib host:: -- --test-threads=1: all host:: tests passed (only pre-existing #1744 descriptor::host::tests::dynamic_slots_are_held_until_released failed).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly ensures heap textures backed by untracked pages are refreshed on CPU writes.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 08:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/3041#pullrequestreview-6070734780) · **approved these changes** Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib draw:: -- --test-threads=1`: 21/21 passed on RTX 5090 and WARP (including `a_heap_texture_refreshes_after_a_write_to_its_untracked_page`). - `cargo test -p victory-gpu --lib host:: -- --test-threads=1`: all `host::` tests passed (only pre-existing `#1744` `descriptor::host::tests::dynamic_slots_are_held_until_released` failed). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly ensures heap textures backed by untracked pages are refreshed on CPU writes. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠Jackster on GitHub · 2026-11-26 16:35 UTC · original

Windows 11, Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010), 63bcca4 + this PR. You wrote that Windows, WARP and a compatible GPU were unavailable for the D3D12 regression, so here are all three:

  • draw::tests::a_heap_texture_refreshes_after_a_write_to_its_untracked_page passes on the hardware adapter (0.17 s).
  • The same test passes on WARP (VICTORY_D3D12_WARP=1, diagnostics build, 0.07 s).
  • Control: with the texture.rs half of the patch reverted and the test kept, it fails on the hardware adapter — assertion left == right failed: late write reaches the GPU — so the test does catch the missed refresh, as your Linux harness said it should.
  • cargo test -p victory-gpu --lib on the head: 232 passed / 0 failed / 1 ignored.

The gameplay symptom (FIND-17) is still unverified, as you said; this covers the D3D12 path only. Synthetic only. AI-assisted.

**@⁠Jackster** on GitHub · 2026-11-26 16:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/3041#issuecomment-7197853297) Windows 11, Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010), `63bcca4` + this PR. You wrote that Windows, WARP and a compatible GPU were unavailable for the D3D12 regression, so here are all three: - `draw::tests::a_heap_texture_refreshes_after_a_write_to_its_untracked_page` **passes on the hardware adapter** (0.17 s). - The same test **passes on WARP** (`VICTORY_D3D12_WARP=1`, diagnostics build, 0.07 s). - Control: with the `texture.rs` half of the patch reverted and the test kept, it fails on the hardware adapter — `assertion left == right failed: late write reaches the GPU` — so the test does catch the missed refresh, as your Linux harness said it should. - `cargo test -p victory-gpu --lib` on the head: 232 passed / 0 failed / 1 ignored. The gameplay symptom (FIND-17) is still unverified, as you said; this covers the D3D12 path only. Synthetic only. AI-assisted.
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/3041/head:github-bot/gh-3041'
git switch 'github-bot/gh-3041'

Merge

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