vkback: refresh textures over a page remap's destination ranges (VKB_REMAP_REFRESH) #184

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

@⁠lordra9-svg on GitHub · 2026-12-02 01:32 UTC · original
lordra9-svg:fix/remap-refresh → main · +67 −8 · 3 files · 1 commits · open

What

Refresh the watched textures over a page remap's destination ranges when the remap is reached, so a texture whose pages a remap just supplied stops showing zeros (partly filled) until an unrelated WRITTEN event.

Why

refresh::title_written() (marks watched textures dirty, refilled from title memory) was called only on the PE WRITTEN event. Page remaps (live::remap_front -> maporder::reached) never called it, and reached discarded the remap's destination ranges. So a partly-filled texture stayed partly filled after its pages were remapped in.

Change

  • maporder::reached(seq) returns the remap's destination ranges instead of dropping them (all counters/bookkeeping kept).
  • live::remap_front: after the remap is reached, call be.title_written(&ranges) (renderer thread, once per remap) -- but only when the present did not give up waiting (mapped), so it never reads pre-copy zeros and marks a texture clean.
  • VKB_REMAP_REFRESH (default on; 0 = current behaviour), owner/reason/removal documented; WRITTEN path and refresh_dirty budgets unchanged.

Measured (RX 7800 XT, combined with the tex-parity counter)

Partly-filled images sampled by draws, VKB_REMAP_REFRESH off vs on, 300 s world runs:

  • pair 1: off 22,880 -> on 8,232;
  • pair 2 (reverse order, similar marked counts 3,738 vs 3,718): off 7,359 -> on 6,127 (~17%).
    No device loss; fps unchanged (~26). The first pair's larger drop was confounded by heavier streaming in the off run.

Honest scope: the remaining partly-filled samples are pages that are not remapped at all in the run (streamed out / never resident); this fixes only those a remap supplies. Modest but correct improvement, default-on with no measured cost.

Verified

  • cargo test -p vkback --lib: 169 passed (new maporder::reached_returns_registered_ranges), policy 6 passed, clippy -D warnings; tools/build.sh exit 0.
**@⁠lordra9-svg** on GitHub · 2026-12-02 01:32 UTC · [original](https://github.com/vktory6/VKtory/pull/184) `lordra9-svg:fix/remap-refresh` → `main` · +67 −8 · 3 files · 1 commits · open ## What Refresh the watched textures over a **page remap's destination ranges** when the remap is reached, so a texture whose pages a remap just supplied stops showing zeros (partly filled) until an unrelated WRITTEN event. ## Why `refresh::title_written()` (marks watched textures dirty, refilled from title memory) was called **only** on the PE `WRITTEN` event. Page remaps (`live::remap_front` -> `maporder::reached`) never called it, and `reached` discarded the remap's destination ranges. So a partly-filled texture stayed partly filled after its pages were remapped in. ## Change - `maporder::reached(seq)` returns the remap's destination ranges instead of dropping them (all counters/bookkeeping kept). - `live::remap_front`: after the remap is reached, call `be.title_written(&ranges)` (renderer thread, once per remap) -- but only when the present did not give up waiting (`mapped`), so it never reads pre-copy zeros and marks a texture clean. - `VKB_REMAP_REFRESH` (default on; `0` = current behaviour), owner/reason/removal documented; WRITTEN path and `refresh_dirty` budgets unchanged. ## Measured (RX 7800 XT, combined with the tex-parity counter) Partly-filled images sampled by draws, `VKB_REMAP_REFRESH` off vs on, 300 s world runs: - pair 1: off 22,880 -> on 8,232; - pair 2 (reverse order, similar marked counts 3,738 vs 3,718): off 7,359 -> on 6,127 (~17%). No device loss; fps unchanged (~26). The first pair's larger drop was confounded by heavier streaming in the off run. Honest scope: the remaining partly-filled samples are pages that are not remapped at all in the run (streamed out / never resident); this fixes only those a remap supplies. Modest but correct improvement, default-on with no measured cost. ## Verified - `cargo test -p vkback --lib`: 169 passed (new `maporder::reached_returns_registered_ranges`), policy 6 passed, clippy `-D warnings`; `tools/build.sh` exit 0.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 01:35:43 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 16:02 UTC · original

Thanks, refreshing textures over a remap's destination ranges is closer to the console (the pages are there once the remap is reached), and the parity counter shows the effect. Two notes before merging:

  • Merge order: the holdfrees branch (private, finishing now) changes how remaps are released and published, and #218 also changes maporder::reached. I'll merge holdfrees first, then this and #218 rebased on it, so the three don't fight. I'll do the rebase if it's mechanical.
  • The switch: VKB_REMAP_REFRESH=0 restores a behaviour we know is wrong, so it's an A/B switch with a removal condition. Please write that condition in the comment: removed once a validation run and the gates pass with it on.
**@⁠vktory6** on GitHub · 2026-12-02 16:02 UTC · [original](https://github.com/vktory6/VKtory/pull/184#issuecomment-7351354696) Thanks, refreshing textures over a remap's destination ranges is closer to the console (the pages are there once the remap is reached), and the parity counter shows the effect. Two notes before merging: - **Merge order:** the holdfrees branch (private, finishing now) changes how remaps are released and published, and #218 also changes `maporder::reached`. I'll merge holdfrees first, then this and #218 rebased on it, so the three don't fight. I'll do the rebase if it's mechanical. - **The switch:** `VKB_REMAP_REFRESH=0` restores a behaviour we know is wrong, so it's an A/B switch with a removal condition. Please write that condition in the comment: removed once a validation run and the gates pass with it on.
Author
Owner

@⁠TheRifai on GitHub · 2026-12-02 16:23 UTC · original

Local A/B data on current main bc86e65 for this switch (RX 9070 XT / RADV 26.3.1, GE-Proton11-16, Series X 3840x2160, boat save boatsave-profile, warm store, 90 s each, no validation in either arm):

Run Setting Mean fps (last 30 host windows)
control default 28.16
B VKB_REMAP_REFRESH=1 27.86

No new VUID or loud kind, LIVE_NOT_TITLE stayed 16, and the two runs had the same 10 rule-32 wave-wide lines. So on this scene the refresh path is slightly slower (~0.3 fps), not a measurable win; not a criticism of the correctness fix, just no local perf reason to default it on. Evidence: /home/shlong/Documents/VKtory-capture/hunt-{boatbase,boatremap}/.

**@⁠TheRifai** on GitHub · 2026-12-02 16:23 UTC · [original](https://github.com/vktory6/VKtory/pull/184#issuecomment-7351885308) Local A/B data on current main `bc86e65` for this switch (RX 9070 XT / RADV 26.3.1, GE-Proton11-16, Series X 3840x2160, boat save `boatsave-profile`, warm store, 90 s each, no validation in either arm): | Run | Setting | Mean fps (last 30 host windows) | |---|---|---:| | control | default | 28.16 | | B | `VKB_REMAP_REFRESH=1` | 27.86 | No new VUID or loud kind, `LIVE_NOT_TITLE` stayed 16, and the two runs had the same 10 rule-32 wave-wide lines. So on this scene the refresh path is slightly slower (~0.3 fps), not a measurable win; not a criticism of the correctness fix, just no local perf reason to default it on. Evidence: `/home/shlong/Documents/VKtory-capture/hunt-{boatbase,boatremap}/`.
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/184/head:github-bot/gh-184'
git switch 'github-bot/gh-184'

Merge

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