WIP: fix(vk): a render target is not uploaded from memory for a GPU buffer write older than its drawing #332

Draft
Amateurwizrd wants to merge 4 commits from Amateurwizrd/Longshot:fix/drawn-target-upload into main
Contributor

Type: fix · Risk: low · Tested on: Windows 11, RTX 5070 Ti · Needs: an AMD or Intel GPU, or Linux

Why

The first time the game samples a render target after finalizing it, the renderer asks what changed in the target's storage since. When a GPU buffer wrote that storage, it uploads the whole image from guest memory over what the pass drew. That buffer write was compared only with the last one the texture had seen, never with the drawing, so a target made over a buffer's old storage counted the older write as newer. In Hyrule Field on current main that is 4 or 5 whole uploads of 1920x1080 targets a run in the two minutes after loading.

main already fixes the other cause of the same uploads, a virtual-pool target drawn before it had a page map (#325, the port of Hookshot's 40955ed3). This PR started as our own version of that change and is now only the part #325 does not cover.

How to reproduce

Seen on: Windows 11, RTX 5070 Ti 16 GB, driver 621.01
Settings and switches: Output resolution 2560x1440, Render resolution 75%, otherwise defaults
Steps: load a save, teleport to Hyrule Field (Debug tab), stand for 25 s, open and close the pause menu
Expected: no upload over a drawn image ... a GPU buffer wrote it lines in the log
Actual: on main, 4 or 5 of them a run, each a whole 1920x1080 target uploaded from guest memory over what the pass drew (8.4 MB, up to 34 ms)

What changed

A render target the GPU just drew is no longer overwritten from guest memory because of a GPU buffer write into its storage that happened before the drawing. The fix is one comparison in texture_rendered, with a switch to turn it off for A/B runs.

  • vk: texture_rendered (gpu/vk/vk_texture.cpp), which only a pass calls, now takes GPU buffer writes into the target's storage from earlier submissions as older than the drawing (gpu_wrote_seen), once a frame under the pass's lock. A write in the pass's own submission still counts, since which came first is not known there.
  • Copies and storage-image writes are left as they were.
  • test: tests/test_drawn_target.py cuts texture_written, texture_rendered, texture_released, texture_dirty, texture_gpu_wrote, gpu_wrote_into and the check in texture_touch out of the source and checks the buffer-write cases with the switch off and on. On main its first case fails.
  • docs: the switch in docs/development.md, and the two measured builds as run files in docs/tested/.
  • notes: The change is the 8 lines added to texture_rendered; it costs one compare and store per target per frame.
  • notes: texture_rendered is called only by begin_pass, under the ParLock that texture_marked decides, so the store needs no lock of its own.
  • notes: This branch was force-pushed: it first carried its own version of the page-map fix as well, which #325 made unneeded. Its first test request, T-J359, named that version's switch and is closed; T-KUWQ replaces it.

Measurements

Verdict: it works on current main: whole uploads for an older buffer write go from 5, 5, 5 a run on main @ 13e8b6da to 0, 0, 0 on this PR @ b58993c4, three alternating rounds. Frame rate not measured in this set (the earlier set below claimed no change either way).

Hardware: Windows 11 Pro 26200, NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.01, AMD Ryzen 7 7800X3D, 32 GB
Scene: Hyrule Field (child) by debug teleport from a copied save, standing; the options file as it was for the earlier set (Output 2560x1440 in a 1707x960 window, Render 75%, no frame generation, no frame cap, sound off)
Method: two game folders built the same way from one copy (game_m332 from main @ 13e8b6da, game_p332 from this PR @ b58993c4, each make_game.py --update); 3 rounds, the first build alternating each round (main, PR / PR, main / main, PR). Each run: teleport, 25 s standing, 5 s in the pause menu. Counts are vk: upload over a drawn image lines: "for a buffer write" are those ending a GPU buffer wrote it, each a whole image.
How to reproduce: load a save, teleport to Hyrule Field (Debug tab), stand for 25 s, open and close the pause menu, and count the upload over a drawn image ... a GPU buffer wrote it lines in the log.

Before: main @ 13e8b6da After: this PR @ b58993c4
Whole uploads for a GPU buffer write older than the drawing, a run 5, 5, 4 (1920x1080, one 480x270 in round 2) 0, 0, 0
Other uploads over a drawn image, a run 0, 0, 1 (a 1016 KB range) 2, 0, 0 (the same 1016 KB range, twice)
main @ 13e8b6da, round 1:
vk: upload over a drawn image: #2123 0x10001950600 1920x1080x1 x1 NVN 0xa at present 2811 (texture frame 2812), finalized, 0 KB dirty in 0 ranges, a GPU buffer wrote it
this PR @ b58993c4, round 1 (the remaining kind, not this PR's):
vk: upload over a drawn image: #1859 0x10001950600 1920x1080x1 x1 NVN 0xa at present 2658 (texture frame 2659), finalized, 1016 KB dirty in 1 ranges

The earlier set, on main @ 98e2d95f before the rebases, with frame rate:

main: 98e2d95f (2026-11-14)
this PR: fix/drawn-target-upload @ de3b4aab
Hardware: NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.01, AMD Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 26200
Scene: Hyrule Field (child) by debug teleport from a copied save, standing; Output resolution 2560x1440 in a 1707x960 window, Render resolution 75%, the game's own upscaler, no frame generation, no frame cap, sound off, the serial replay, no VRAM allowance
Method: 3 rounds, the two builds alternating in each round. One game folder (longshot v3.0.0-rc.3-27-gf516654c) with only longshot_vk.dll swapped (the host interface is unchanged since); both renderers built alone with RX_VK_ONLY=1 and the same toolchain (v3.0.0-rc.3-57-g98e2d95f and v3.0.0-rc.3-58-gde3b4aab). Each run: teleport, 25 s standing, 5 s in the pause menu. Counts are vk: upload over a drawn image lines; "for a buffer write" are those with a GPU buffer wrote it, each a whole image. Slow re-uploads are slow upload lines marked again (over 15 ms). Frame rate is the median of the log's N presents, X fps lines from present 5040 on.
How to reproduce: load a save, teleport to Hyrule Field (Debug tab), stand for 25 s, open and close the pause menu, and count the upload over a drawn image ... a GPU buffer wrote it lines in the log.

Before: main @ 98e2d95f After: this PR @ de3b4aab
Whole uploads for a GPU buffer write older than the drawing, a run 4, 4, 5 (32, 32, 40 MB) 0, 0, 0
Other uploads over a drawn image, a run 0, 0, 0 0, 0, 1 (a 1016 KB range)
Re-uploads over 15 ms, a run 1, 1, 1 (34, 20, 19 ms) 0, 0, 1 (18 ms, that range's upload)
Frame rate standing in the field (median of 3) 115.7 fps 114.5 fps

Frame rate by round, main / this PR: 118.4 / 114.7, 115.7 / 114.5, 114.4 / 114.2. Main ran first in each round here and was faster in each. In the earlier set on 514591a3 (this PR's first version), this PR ran first in each round and was faster in each (118.6 / 114.2, 114.8 / 114.2, 115.3 / 114.7). The first run of a round is the faster one on this PC, so no frame rate change is claimed either way. The HUD labels were right in all six runs.

The one left with this PR is a 1016 KB range of a 1920x1080 target, a page remapped or written after its finalize: another cause, not touched here.

main @ 98e2d95f, round 1:

vk: texture #2447 0x10001950600 1920x1080 NVN 0xa: the GPU wrote its storage (submission 28165): uploaded again
vk: upload over a drawn image: #2447 0x10001950600 1920x1080x1 x1 NVN 0xa at present 4215 (texture frame 4216), finalized, 0 KB dirty in 0 ranges, a GPU buffer wrote it
vk: slow upload 34.4 ms: #2447 0x10001950600 1920x1080x1 x1 levels 1 NVN 0xa, 8640 of 8640 KB again

On a build with 40955ed3 and RX_VK_WATCH_TEX, the buffer writes behind these uploads were 1 to 3,221 frames older than the target's last drawing, in four of four.

Flags and settings

One new switch, to turn the change off for comparison.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1 turns the change off: a buffer write before the pass counts as newer than the drawing, as on main did not exist unset (the change is on) no whole re-upload over a target drawn after an older buffer write helps: every GPU (the texture cache is vendor-independent); doesn't: targets with no buffer write over their storage; untested: AMD, Intel, Linux leave unset: the switch is only for A/B runs

Testing

Tested: on Windows 11, RTX 5070 Ti 16 GB, driver 621.01.

  • After the rebase (3b447163): python -I -B tests/run_all.py with the pinned llvm-mingw 20261104: 541 passed, 18 failed, 35 skipped; main @ 9e6f231d on the same PC: 540 passed and the same 18 failing (environment checks: portable builder, game font, a few that need tools this PC lacks). None new. The renderer builds with llvm-mingw.
  • tests/test_drawn_target.py passes here; with main's vk_texture.cpp (--source) its first case fails.
  • In the game, before the rebase: the 6 runs under Measurements, no device lost, the HUD labels right in all of them.

Not tested: RX_VK_PARALLEL=4. Zone changes on foot (the runs teleport once). Sessions longer than two minutes. Frame times (only the 5 s frame-rate readings). AMD and Intel GPUs. Linux. GCC for the new test. Whether the uploads on main ever show on screen. A game run after the rebase.

Must be tested:

  • An AMD or Intel GPU, or Linux: 6 or more zone changes, with and without RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1, counting the upload over a drawn image ... a GPU buffer wrote it lines and watching the picture after each load; expect fewer such lines without the switch and nothing wrong on screen in either (by hand, test request T-KUWQ; Test Farm: @Beanstalk amd or linux, 6 zone changes with and without RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1, count those log lines)

Risks

What could break: if a buffer write before the pass put texels into part of the target that the pass then does not cover, those texels are now missing from the image; on main the whole drawing was missing instead.

Turning it off: RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1 gives main's behavior without a rebuild; or revert the commit.

Compatibility: Nothing changes.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A file in docs/tested/ for each new measured run (format in docs/tested-configurations.md).
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows llvm-mingw at 3b447163: builds. Linux not built; the change is standard C++ with no platform call and no path.)
  • Docs updated.
**Type:** fix · **Risk:** low · **Tested on:** Windows 11, RTX 5070 Ti · **Needs:** an AMD or Intel GPU, or Linux ## Why The first time the game samples a render target after finalizing it, the renderer asks what changed in the target's storage since. When a GPU buffer wrote that storage, it uploads the whole image from guest memory over what the pass drew. That buffer write was compared only with the last one the texture had seen, never with the drawing, so a target made over a buffer's old storage counted the older write as newer. In Hyrule Field on current `main` that is 4 or 5 whole uploads of 1920x1080 targets a run in the two minutes after loading. `main` already fixes the other cause of the same uploads, a virtual-pool target drawn before it had a page map (#325, the port of Hookshot's 40955ed3). This PR started as our own version of that change and is now only the part #325 does not cover. ## How to reproduce **Seen on:** Windows 11, RTX 5070 Ti 16 GB, driver 621.01 **Settings and switches:** Output resolution 2560x1440, Render resolution 75%, otherwise defaults **Steps:** load a save, teleport to Hyrule Field (Debug tab), stand for 25 s, open and close the pause menu **Expected:** no `upload over a drawn image ... a GPU buffer wrote it` lines in the log **Actual:** on main, 4 or 5 of them a run, each a whole 1920x1080 target uploaded from guest memory over what the pass drew (8.4 MB, up to 34 ms) ## What changed A render target the GPU just drew is no longer overwritten from guest memory because of a GPU buffer write into its storage that happened before the drawing. The fix is one comparison in `texture_rendered`, with a switch to turn it off for A/B runs. - vk: `texture_rendered` (`gpu/vk/vk_texture.cpp`), which only a pass calls, now takes GPU buffer writes into the target's storage from earlier submissions as older than the drawing (`gpu_wrote_seen`), once a frame under the pass's lock. A write in the pass's own submission still counts, since which came first is not known there. - Copies and storage-image writes are left as they were. - test: `tests/test_drawn_target.py` cuts `texture_written`, `texture_rendered`, `texture_released`, `texture_dirty`, `texture_gpu_wrote`, `gpu_wrote_into` and the check in `texture_touch` out of the source and checks the buffer-write cases with the switch off and on. On `main` its first case fails. - docs: the switch in `docs/development.md`, and the two measured builds as run files in `docs/tested/`. - notes: The change is the 8 lines added to `texture_rendered`; it costs one compare and store per target per frame. - notes: `texture_rendered` is called only by `begin_pass`, under the `ParLock` that `texture_marked` decides, so the store needs no lock of its own. - notes: This branch was force-pushed: it first carried its own version of the page-map fix as well, which #325 made unneeded. Its first test request, T-J359, named that version's switch and is closed; T-KUWQ replaces it. ## Measurements **Verdict:** it works on current main: whole uploads for an older buffer write go from 5, 5, 5 a run on main @ 13e8b6da to 0, 0, 0 on this PR @ b58993c4, three alternating rounds. Frame rate not measured in this set (the earlier set below claimed no change either way). Hardware: Windows 11 Pro 26200, NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.01, AMD Ryzen 7 7800X3D, 32 GB Scene: Hyrule Field (child) by debug teleport from a copied save, standing; the options file as it was for the earlier set (Output 2560x1440 in a 1707x960 window, Render 75%, no frame generation, no frame cap, sound off) Method: two game folders built the same way from one copy (`game_m332` from main @ 13e8b6da, `game_p332` from this PR @ b58993c4, each `make_game.py --update`); 3 rounds, the first build alternating each round (main, PR / PR, main / main, PR). Each run: teleport, 25 s standing, 5 s in the pause menu. Counts are `vk: upload over a drawn image` lines: "for a buffer write" are those ending `a GPU buffer wrote it`, each a whole image. How to reproduce: load a save, teleport to Hyrule Field (Debug tab), stand for 25 s, open and close the pause menu, and count the `upload over a drawn image ... a GPU buffer wrote it` lines in the log. | | Before: main @ 13e8b6da | After: this PR @ b58993c4 | |---|---|---| | Whole uploads for a GPU buffer write older than the drawing, a run | 5, 5, 4 (1920x1080, one 480x270 in round 2) | 0, 0, 0 | | Other uploads over a drawn image, a run | 0, 0, 1 (a 1016 KB range) | 2, 0, 0 (the same 1016 KB range, twice) | ``` main @ 13e8b6da, round 1: vk: upload over a drawn image: #2123 0x10001950600 1920x1080x1 x1 NVN 0xa at present 2811 (texture frame 2812), finalized, 0 KB dirty in 0 ranges, a GPU buffer wrote it this PR @ b58993c4, round 1 (the remaining kind, not this PR's): vk: upload over a drawn image: #1859 0x10001950600 1920x1080x1 x1 NVN 0xa at present 2658 (texture frame 2659), finalized, 1016 KB dirty in 1 ranges ``` The earlier set, on main @ 98e2d95f before the rebases, with frame rate: main: 98e2d95f (2026-11-14) this PR: fix/drawn-target-upload @ de3b4aab Hardware: NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.01, AMD Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 26200 Scene: Hyrule Field (child) by debug teleport from a copied save, standing; Output resolution 2560x1440 in a 1707x960 window, Render resolution 75%, the game's own upscaler, no frame generation, no frame cap, sound off, the serial replay, no VRAM allowance Method: 3 rounds, the two builds alternating in each round. One game folder (`longshot v3.0.0-rc.3-27-gf516654c`) with only `longshot_vk.dll` swapped (the host interface is unchanged since); both renderers built alone with `RX_VK_ONLY=1` and the same toolchain (`v3.0.0-rc.3-57-g98e2d95f` and `v3.0.0-rc.3-58-gde3b4aab`). Each run: teleport, 25 s standing, 5 s in the pause menu. Counts are `vk: upload over a drawn image` lines; "for a buffer write" are those with `a GPU buffer wrote it`, each a whole image. Slow re-uploads are `slow upload` lines marked `again` (over 15 ms). Frame rate is the median of the log's `N presents, X fps` lines from present 5040 on. How to reproduce: load a save, teleport to Hyrule Field (Debug tab), stand for 25 s, open and close the pause menu, and count the `upload over a drawn image ... a GPU buffer wrote it` lines in the log. | | Before: main @ 98e2d95f | After: this PR @ de3b4aab | |---|---|---| | Whole uploads for a GPU buffer write older than the drawing, a run | 4, 4, 5 (32, 32, 40 MB) | 0, 0, 0 | | Other uploads over a drawn image, a run | 0, 0, 0 | 0, 0, 1 (a 1016 KB range) | | Re-uploads over 15 ms, a run | 1, 1, 1 (34, 20, 19 ms) | 0, 0, 1 (18 ms, that range's upload) | | Frame rate standing in the field (median of 3) | 115.7 fps | 114.5 fps | Frame rate by round, main / this PR: 118.4 / 114.7, 115.7 / 114.5, 114.4 / 114.2. Main ran first in each round here and was faster in each. In the earlier set on 514591a3 (this PR's first version), this PR ran first in each round and was faster in each (118.6 / 114.2, 114.8 / 114.2, 115.3 / 114.7). The first run of a round is the faster one on this PC, so no frame rate change is claimed either way. The HUD labels were right in all six runs. The one left with this PR is a 1016 KB range of a 1920x1080 target, a page remapped or written after its finalize: another cause, not touched here. main @ 98e2d95f, round 1: ``` vk: texture #2447 0x10001950600 1920x1080 NVN 0xa: the GPU wrote its storage (submission 28165): uploaded again vk: upload over a drawn image: #2447 0x10001950600 1920x1080x1 x1 NVN 0xa at present 4215 (texture frame 4216), finalized, 0 KB dirty in 0 ranges, a GPU buffer wrote it vk: slow upload 34.4 ms: #2447 0x10001950600 1920x1080x1 x1 levels 1 NVN 0xa, 8640 of 8640 KB again ``` On a build with 40955ed3 and `RX_VK_WATCH_TEX`, the buffer writes behind these uploads were 1 to 3,221 frames older than the target's last drawing, in four of four. ### Flags and settings One new switch, to turn the change off for comparison. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1` | turns the change off: a buffer write before the pass counts as newer than the drawing, as on main | did not exist | unset (the change is on) | no whole re-upload over a target drawn after an older buffer write | helps: every GPU (the texture cache is vendor-independent); doesn't: targets with no buffer write over their storage; untested: AMD, Intel, Linux | leave unset: the switch is only for A/B runs | ## Testing **Tested:** on Windows 11, RTX 5070 Ti 16 GB, driver 621.01. - After the rebase (3b447163): `python -I -B tests/run_all.py` with the pinned llvm-mingw 20261104: 541 passed, 18 failed, 35 skipped; main @ 9e6f231d on the same PC: 540 passed and the same 18 failing (environment checks: portable builder, game font, a few that need tools this PC lacks). None new. The renderer builds with llvm-mingw. - `tests/test_drawn_target.py` passes here; with main's `vk_texture.cpp` (`--source`) its first case fails. - In the game, before the rebase: the 6 runs under Measurements, no device lost, the HUD labels right in all of them. **Not tested:** `RX_VK_PARALLEL=4`. Zone changes on foot (the runs teleport once). Sessions longer than two minutes. Frame times (only the 5 s frame-rate readings). AMD and Intel GPUs. Linux. GCC for the new test. Whether the uploads on main ever show on screen. A game run after the rebase. **Must be tested:** - An AMD or Intel GPU, or Linux: 6 or more zone changes, with and without `RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1`, counting the `upload over a drawn image ... a GPU buffer wrote it` lines and watching the picture after each load; expect fewer such lines without the switch and nothing wrong on screen in either (by hand, test request T-KUWQ; Test Farm: @Beanstalk amd or linux, 6 zone changes with and without RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1, count those log lines) ## Risks **What could break:** if a buffer write before the pass put texels into part of the target that the pass then does not cover, those texels are now missing from the image; on main the whole drawing was missing instead. **Turning it off:** `RX_VK_NO_DRAWN_OVER_BUFFER_WRITE=1` gives main's behavior without a rebuild; or revert the commit. **Compatibility:** Nothing changes. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A file in `docs/tested/` for each new measured run (format in `docs/tested-configurations.md`). - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows llvm-mingw at 3b447163: builds. Linux not built; the change is standard C++ with no platform call and no path.) - [x] Docs updated.
The first time the game samples a render target after finalizing it, the
target's check asks what changed in its storage since, and uploads the whole
image from guest memory when anything did. Two cases took the pass's drawing
for stale:

- In a virtual pool (at or above 1 TB) the check compares each page's mapping
  with the one noted at the first upload. A target the GPU drew before any
  upload had no map, so the check took all of its storage for remapped.
- A GPU buffer's write into the storage (gpu_wrote_into) was compared only
  with the last such write the texture had seen, never with the drawing. A
  target made over a buffer's old storage counted that older write as newer.

texture_rendered, which only a pass calls, now notes the map and marks buffer
writes of earlier submissions as seen, once a frame under the pass's lock. A
write in the pass's own submission still counts, since which came first is not
known there. Copies and storage writes are left as they were.

In Hyrule Field this removes 23 to 26 whole uploads of 1920x1080 and
2560x1440 targets in the first two minutes after loading (98 to 128 MB from
memory, plus about 32 MB for the buffer case). The first case is the one
Hookshot's 40955ed3 fixes in texture_written for the HUD's button labels:
40955ed3ad

RX_VK_NO_DRAWN_TARGET_KEEP=1: as before.

Assisted-by: Claude Fable 5.2
Co-Authored-By: Claude Fable 5.2 <[email protected]>
docs: tested-configurations rows for the drawn render target runs
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
210511373d
Assisted-by: Claude Fable 5.2
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Author
Contributor

Test request T-J359 is open (any GPU, with RX_VK_PARALLEL=4); the description names it and the Testing box is ticked. It can be claimed once a maintainer adds the testing wanted label.

Test request T-J359 is open (any GPU, with RX_VK_PARALLEL=4); the description names it and the Testing box is ticked. It can be claimed once a maintainer adds the testing wanted label.
Amateurwizrd force-pushed fix/drawn-target-upload from 210511373d
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to c42e9b1f88
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-14 04:12:31 +00:00
Compare
Amateurwizrd changed title from WIP: fix(vk): render targets keep their drawing after the game finalizes them to WIP: fix(vk): a render target is not uploaded from memory for a GPU buffer write older than its drawing 2026-11-14 04:12:46 +00:00
Author
Contributor

Narrowed and re-measured: #325 merged the drawn page map, so this PR is now only the buffer-write case it leaves (one commit, de3b4aab, switch RX_VK_NO_DRAWN_OVER_BUFFER_WRITE). Force-pushed onto main 98e2d95f and measured there: 4, 4 and 5 whole uploads for an older buffer write a run on main, none with this PR. T-J359 named the dropped switch and is closed; T-KUWQ replaces it.

Narrowed and re-measured: #325 merged the drawn page map, so this PR is now only the buffer-write case it leaves (one commit, de3b4aab, switch RX_VK_NO_DRAWN_OVER_BUFFER_WRITE). Force-pushed onto main 98e2d95f and measured there: 4, 4 and 5 whole uploads for an older buffer write a run on main, none with this PR. T-J359 named the dropped switch and is closed; T-KUWQ replaces it.
Amateurwizrd force-pushed fix/drawn-target-upload from c42e9b1f88
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 3b447163e0
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-15 09:13:40 +00:00
Compare
Author
Contributor

Rebased onto main 9e6f231d (now 3b447163). One docs conflict in docs/development.md: kept main's 'the game's' wording and added the RX_VK_NO_DRAWN_OVER_BUFFER_WRITE row. run_all on Windows (CXX=g++): the same failures as main at 9e6f231d on this PC (toolchain checks), none new; no game run since the rebase.

Rebased onto main 9e6f231d (now 3b447163). One docs conflict in docs/development.md: kept main's 'the game's' wording and added the RX_VK_NO_DRAWN_OVER_BUFFER_WRITE row. run_all on Windows (CXX=g++): the same failures as main at 9e6f231d on this PC (toolchain checks), none new; no game run since the rebase.
Author
Contributor

Description moved to main's new template (status line, How to reproduce, Verdict, Risks, Must be tested). Re-checked after the rebase with the pinned llvm-mingw: run_all 541 passed, the same 18 failing as main 9e6f231d on this PC, none new; the renderer builds. Measurements are from before the rebase and say so.

Description moved to main's new template (status line, How to reproduce, Verdict, Risks, Must be tested). Re-checked after the rebase with the pinned llvm-mingw: run_all 541 passed, the same 18 failing as main 9e6f231d on this PC, none new; the renderer builds. Measurements are from before the rebase and say so.
Author
Contributor

Reviewer notes moved under What changed (they had landed in Must be tested).

Reviewer notes moved under What changed (they had landed in Must be tested).
HumanBean force-pushed fix/drawn-target-upload from 3b447163e0
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 18c163233e
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 4s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 4s
Third-party parts / As their notes say (pull_request) Successful in 8s
Website / Website on Cloudflare (pull_request_target) Has been skipped
2026-11-15 18:42:54 +00:00
Compare
Owner

Rebased onto main @ bbe6fdf2. No tests were run here; the test boxes stay yours. One conflict in docs/development.md: main changed the neighbouring RX_VK_ASTC_CPU row, so both rows are kept (that one, then RX_VK_NO_DRAWN_OVER_BUFFER_WRITE).

Rebased onto `main` @ bbe6fdf2. No tests were run here; the test boxes stay yours. One conflict in docs/development.md: main changed the neighbouring `RX_VK_ASTC_CPU` row, so both rows are kept (that one, then `RX_VK_NO_DRAWN_OVER_BUFFER_WRITE`).
Author
Contributor

Rebased onto main @ 13e8b6da (b58993c4), no conflicts, and measured again there: whole uploads for an older GPU buffer write go from 5, 5, 4 a run on main to 0, 0, 0 with this PR (3 alternating rounds, Hyrule Field, game folders built the same way from one copy). The one other kind left, a 1016 KB range of the same 1920x1080 target, shows on both sides and is not this PR's. Measurements updated; the earlier set stays below it.

Rebased onto main @ 13e8b6da (b58993c4), no conflicts, and measured again there: whole uploads for an older GPU buffer write go from 5, 5, 4 a run on main to 0, 0, 0 with this PR (3 alternating rounds, Hyrule Field, game folders built the same way from one copy). The one other kind left, a 1016 KB range of the same 1920x1080 target, shows on both sides and is not this PR's. Measurements updated; the earlier set stays below it.
Amateurwizrd force-pushed fix/drawn-target-upload from 18c163233e
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 4s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 4s
Third-party parts / As their notes say (pull_request) Successful in 8s
Website / Website on Cloudflare (pull_request_target) Has been skipped
to b58993c4c9
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-15 21:21:25 +00:00
Compare
Author
Contributor

@Beanstalk linux, build the renderer at this head: it should build with no error in the files this PR changes; no change in play expected from the build alone.

@Beanstalk linux, build the renderer at this head: it should build with no error in the files this PR changes; no change in play expected from the build alone.
Member

@Amateurwizrd only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for b58993c, and the PR has changed since (45ef0f0), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@Amateurwizrd only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `b58993c`, and the PR has changed since (`45ef0f0`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
test(vk): the drawn-over-buffer-write check builds main's code: the written regions' header and a stub for the ASTC reuse listing
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 6s
45ef0f0fb7
Author
Contributor

Merged main @ f88e6e3a (45ef0f0f): it no longer merged clean. One conflict, in docs/development.md: main's RX_VK_ASTC_REUSE row and this PR's RX_VK_NO_DRAWN_OVER_BUFFER_WRITE row, both kept. tests/test_drawn_target.py now builds main's gpu_wrote_into and texture_released: the fixture includes gpu/vk/wrote_regions.h and stubs reuse_released. Game-free checks for the changed files (tests/run_all.py --changed): no failure that main does not also have on this PC. No game code of this PR changed, so the in-game run above still holds.

Merged main @ f88e6e3a (45ef0f0f): it no longer merged clean. One conflict, in docs/development.md: main's RX_VK_ASTC_REUSE row and this PR's RX_VK_NO_DRAWN_OVER_BUFFER_WRITE row, both kept. tests/test_drawn_target.py now builds main's gpu_wrote_into and texture_released: the fixture includes gpu/vk/wrote_regions.h and stubs reuse_released. Game-free checks for the changed files (`tests/run_all.py --changed`): no failure that main does not also have on this PC. No game code of this PR changed, so the in-game run above still holds.
Owner

Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).

  • Tested on my own PC: ticked: Testing's Tested: in-game runs on Windows 11, RTX 5070 Ti, the six runs under Measurements.
  • Nothing gets worse that I know of: ticked: Measurements shows whole uploads falling from 5 to 0 a run, and Risks names only a picture risk.
Brought up to the [ready-for-review standard](https://git.magicbean.dev/MagicBeanDev/Longshot/src/branch/main/CONTRIBUTING.md#ready-for-review-out-of-wip) (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know). - *Tested on my own PC*: ticked: Testing's Tested: in-game runs on Windows 11, RTX 5070 Ti, the six runs under Measurements. - *Nothing gets worse that I know of*: ticked: Measurements shows whole uploads falling from 5 to 0 a run, and Risks names only a picture risk.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request has changes conflicting with the target branch.
  • docs/development.md
Some workflows are waiting to be reviewed.
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 'fix/drawn-target-upload:Amateurwizrd-fix/drawn-target-upload'
git switch 'Amateurwizrd-fix/drawn-target-upload'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!332
No description provided.