Detect unsampled writes to large mapped Vulkan textures #2050

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

@⁠lgr123 on GitHub · 2026-11-25 19:02 UTC · original
lgr123:rt/large-mapped-texture-chunks → main · +220 −15 · 4 files · 1 commits · open

Claimed as RT-TITLE-LARGE-MAPPED-SAMPLE-MISS. Coordination claim

What and why

The periodic full comparison only covers mapped textures up to 4 MiB. For a larger persistent CPU mapping, an ordinary store outside the fixed sample windows can leave the image unchanged indefinitely while the mapping stays readable and no explicit dirty event fires.

Track chunk hashes from the bytes used for the last accepted upload. Each refresh can audit one 256 KiB chunk, with round-robin turns across eligible mappings. A mismatch queues the existing priority upload. The audit reuses the guarded streaming copy into cached scratch for write-combined memory. Staged completion checks the live resource, source revision and submission state before publishing hashes. A late successful write to the same live resource leaves it dirty for a retry when its source or upload serial is stale.

Validation

  • Native Windows Release on the RTX 5070 with driver 621.24. The identical GPU fixture failed the new readback assertion on stock for both the ordered host copy and forced staged paths. With the change, both read back the new byte in the 8 MiB RGBA8 texture. The initial and sampled-write controls passed.
  • Native source-extraction tests passed coverage across three competing mappings, below-limit and notified-write controls, delayed staged completion after layout replacement, out-of-order acceptance and failed upload retry.
  • One 256 KiB audit took 82 µs median on cached memory and 137 µs median on write-combined memory over 21 interleaved batches. The respective p90s were 103 and 177 µs. A steady 8 MiB mapping was visited within 33 successful refresh passes in the single-mapping case.

The reproductions use generated texture data. The results establish the Vulkan texture update and readback behavior for this case. The contribution is independent of the existing full-scan optimization in #1705.

**@⁠lgr123** on GitHub · 2026-11-25 19:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2050) `lgr123:rt/large-mapped-texture-chunks` → `main` · +220 −15 · 4 files · 1 commits · open Claimed as `RT-TITLE-LARGE-MAPPED-SAMPLE-MISS`. [Coordination claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why The periodic full comparison only covers mapped textures up to 4 MiB. For a larger persistent CPU mapping, an ordinary store outside the fixed sample windows can leave the image unchanged indefinitely while the mapping stays readable and no explicit dirty event fires. Track chunk hashes from the bytes used for the last accepted upload. Each refresh can audit one 256 KiB chunk, with round-robin turns across eligible mappings. A mismatch queues the existing priority upload. The audit reuses the guarded streaming copy into cached scratch for write-combined memory. Staged completion checks the live resource, source revision and submission state before publishing hashes. A late successful write to the same live resource leaves it dirty for a retry when its source or upload serial is stale. ### Validation - Native Windows Release on the RTX 5070 with driver 621.24. The identical GPU fixture failed the new readback assertion on stock for both the ordered host copy and forced staged paths. With the change, both read back the new byte in the 8 MiB RGBA8 texture. The initial and sampled-write controls passed. - Native source-extraction tests passed coverage across three competing mappings, below-limit and notified-write controls, delayed staged completion after layout replacement, out-of-order acceptance and failed upload retry. - One 256 KiB audit took 82 µs median on cached memory and 137 µs median on write-combined memory over 21 interleaved batches. The respective p90s were 103 and 177 µs. A steady 8 MiB mapping was visited within 33 successful refresh passes in the single-mapping case. The reproductions use generated texture data. The results establish the Vulkan texture update and readback behavior for this case. The contribution is independent of the existing full-scan optimization in [#1705](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1705).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:16:06 +00:00
This pull request has changes conflicting with the target branch.
  • runtime/shims/d3d12_vulkan_device.cpp
  • runtime/src/title_texture_refresh.h
  • runtime/test/d3d12_existing_heap_test.cpp
  • runtime/test/title_memory_map_test.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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