fix(vk): torch flames no longer vanish when the replay falls behind the game, as with V-Sync On #3000

Merged
HumanBean merged 2 commits from llun/Longshot:fix/wb-pending-capture into main 2026-12-02 14:52:33 +00:00
Member

Summary

Torch flames appeared, vanished and came back for a player with V-Sync On on a 60 Hz screen and Threaded rendering on. With V-Sync Auto or Off, or Threaded rendering Off, they stayed lit (#2992).

What was wrong: the write-back diff's shadow is our copy of what the game last had in memory. A page the game wrote was reported to the shadows as soon as its capture was made, and by the collection even before that. With the replay behind the game, the write-back of an earlier submission then filled the shadow from live guest memory, with the game's newer words. The mirror's older words looked like a GPU change, and were written over the game's new data. A flame's record the game had just written was lost.

What this changes (gpu/vk/vk_memory.cpp):

  • take_capture reports a capture's pages, in the replay's order; capture_make no longer does.
  • memory_collect_written reports only the pages no capture will take. A page left to the next capture is reported when that one is taken.
  • memory_rb_refresh copies the mirror into the shadow too. It gives the mirror the game's newer words before their capture is taken, so a counter the game clears and the GPU counts up to the same value again would otherwise not be written back (found in a separate review of the first version).

See the bug on main: Forest Temple main room with all four Poes beaten, V-Sync On on a 60 Hz screen, Threaded rendering on Auto. On a PC where V-Sync doesn't hold the present, make each present wait for a 16.7 ms tick at the top of do_present.

Read first: take_capture, memory_collect_written and memory_rb_refresh, then tests/test_wb_pending_capture.py.

This is not the lock-on arrows' bug (#2863, the write-back's span): the arrows' fix stays as it is.

Fixes #2992. See #2363, #2777 and #1789, which may be the same bug and haven't been tested with this.

Testing

Tested: Windows 11, RTX 5080, NVIDIA 621.47, Ryzen 9 9900X3D. V-Sync doesn't hold the present on this PC, so the runs used a temporary delay (a present waits for a 16.7 ms tick) to put the replay behind as it is on the player's PC: about 42 jobs queued at a present and 2300 to 2900 late pages in 600 takes, against 27 to 60 and mostly 3300 to 4300 in the player's log.

  • Forest Temple main room, the player's save, 4K DLAA with Native HDR and PsychoV35, 300 screenshots each, in one build: fix off, a flame missing in 161; fix on, in none. (Before the readback part was added: off 293, on 0.) The person I work for watched the flames with this version under the delay: smooth, and all four lit.
  • Fire Temple entrance, one picture each: fix off, 1 of 4 torches lit; fix on, 4 of 4.
  • tests/test_wb_pending_capture.py fails on main at the first case, fails without each part of the fix, and passes here (g++ and clang++).
  • mise run test: 825 pass, 55 fail, 48 skipped; main at the same commit: 824, 55, 48. 54 of the failures fail on both (listed below). test_present_semaphores failed here only and passed 5 of 5 times alone, with the fix and without; test_longshot_ctl failed on main only.
The 54 checks that fail here and on main (this PC)

auto_handheld, blocks_at_start, bug_report, builder_channel, control_picture, coverage_run, crash_record, crt_options, dev_ab, dev_build, dev_migrate, dev_update, draw_stream_visibility, framegen_hdr, framegen_resources, fs_path_utf8, fsr_uniform_ownership, game_boundary, image_reaper_threads, image_view_retry, input_background, keyboard_menu_option, keyboard_option, lifter, linux_pressure, loaded_modules_drop, log_batch, log_levels, menu_keys, mise_build, oot_menu_mouse, oot_state_tap, option_ids, parity_gates, perf_send, present_acquire_ahead, present_image_free, present_source_crop, profile_symbols, program_cache_cleanup, program_cache_one_variant, readback_timeout_reuse, recording_admission, run_all_mingw, screensaver, switch_table, target_retention, temporal_present_bandwidth, tex_desc_memo, text_keyboard_policy, upscaler_round_trip, vram_compact, windows_display_startup, windows_on_linux

Still to test:

  • The player's PC (RTX 4090, i9-13900K, 60 Hz, V-Sync On): the Forest Temple's torches stay lit and move smoothly (by hand, the player).
  • Brightness flicker in play, a still camera and the pause menu: no flicker expected. Measured frame by frame here in the Forest Temple and the Fire Temple with the delay on (no frame off by 0.5 %), but the version without the readback part, which should flicker, didn't either, so the check can't prove it. Played by hand for about 5 minutes in the Forest Temple, the delay on: no flicker noticed (by hand, on another PC).
  • AMD (RADV and Windows), Intel, and a handheld or a slower card: torches and speed, with V-Sync On (@Beanstalk Forest Temple or Fire Temple torches with V-Sync On at 60 Hz, flames stay lit and fps as on main).
  • Linux: the same (@Beanstalk as above).

Measurements

Verdict: the flames are fixed under the delay. No speed difference shown (within the spread in three places); Hyrule Field leaned slower, with the fix on always first.

Setup: Windows 11, RTX 5080, NVIDIA 621.47. Flames: one build with the fix switched on and off by a temporary switch, Forest Temple main room, 300 screenshots each, the 16.7 ms delay. Speed: dev.py ab, the same kind of build and switch (not the PR's own binary), uncapped, 720p window, 67 % resolution, 60 s a run, interleaved, the median; the fix off first in each pair for the first three rows.

Before: main @ 56823e27 (the fix switched off) After: this PR @ eaba99a7e (switched on)
Screenshots with a flame missing, 300 each 161 0
Market, 5 runs each, fps / median ms / p99 ms 132.5 / 7.48 / 9.71 133.4 / 7.44 / 9.69
Fire Temple, 5 runs each 133.1 / 7.49 / 9.00 133.0 / 7.46 / 8.76
Forest Temple (child Link, where the tool's reload put him), 5 runs each 201.3 / 4.90 / 6.36 202.4 / 4.88 / 6.36
Hyrule Field, 3 runs each, the fix on first 180.2 / 5.54 / 6.62 176.1 / 5.67 / 6.84
  • The first, 3-run tests had the fix on first in each pair and leaned 0.8 to 2.3 % slower (Market 133.8 against 131.7). With the order swapped the Market leaned the other way (the second of each pair won all 8 pairs), so that is the order. Hyrule Field was not swapped.
  • GPU time a frame: Market 3.2 to 3.3 ms either way, Fire Temple 2.4, Forest Temple 2.7 to 2.8.
  • Not measured: a 4K GPU-bound case, and any other GPU.

Risks

  • Screen brightness (the exposure meter) and other counters the game reads back and clears: the readback part is there for them, the test covers it, and it wasn't proven in play (see Still to test).
  • Extra GPU copies: the readback pages' mirror-to-shadow copy and one barrier where a pool has a shadow. No cost seen here; not measured on slow cards.
  • What it doesn't fix: wb_diff.comp writes whole 16-byte vectors, so a game write in the same vector as a GPU change can still be lost. Shadows can still be filled from newer guest memory after the replay's own writes, for a new shadow, and for pools without one. These were there before.
  • Two device losses while testing, in builds with a temporary per-frame screenshot switch: one with the fix off (the old code), one with the fix without its readback part. Both were at the start, before the write-back diff had run, and 12 starts after the first went fine. Cause unknown.
  • A revert is enough: no settings, saves or caches change.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Torch flames appeared, vanished and came back for a player with V-Sync On on a 60 Hz screen and Threaded rendering on. With V-Sync Auto or Off, or Threaded rendering Off, they stayed lit (#2992). **What was wrong:** the write-back diff's shadow is our copy of what the game last had in memory. A page the game wrote was reported to the shadows as soon as its capture was *made*, and by the collection even before that. With the replay behind the game, the write-back of an *earlier* submission then filled the shadow from live guest memory, with the game's newer words. The mirror's older words looked like a GPU change, and were written over the game's new data. A flame's record the game had just written was lost. **What this changes** (`gpu/vk/vk_memory.cpp`): - `take_capture` reports a capture's pages, in the replay's order; `capture_make` no longer does. - `memory_collect_written` reports only the pages no capture will take. A page left to the next capture is reported when that one is taken. - `memory_rb_refresh` copies the mirror into the shadow too. It gives the mirror the game's newer words before their capture is taken, so a counter the game clears and the GPU counts up to the same value again would otherwise not be written back (found in a separate review of the first version). **See the bug on `main`:** Forest Temple main room with all four Poes beaten, V-Sync On on a 60 Hz screen, Threaded rendering on Auto. On a PC where V-Sync doesn't hold the present, make each present wait for a 16.7 ms tick at the top of `do_present`. **Read first:** `take_capture`, `memory_collect_written` and `memory_rb_refresh`, then `tests/test_wb_pending_capture.py`. This is not the lock-on arrows' bug (#2863, the write-back's span): the arrows' fix stays as it is. Fixes #2992. See #2363, #2777 and #1789, which may be the same bug and haven't been tested with this. ## Testing **Tested:** Windows 11, RTX 5080, NVIDIA 621.47, Ryzen 9 9900X3D. V-Sync doesn't hold the present on this PC, so the runs used a temporary delay (a present waits for a 16.7 ms tick) to put the replay behind as it is on the player's PC: about 42 jobs queued at a present and 2300 to 2900 late pages in 600 takes, against 27 to 60 and mostly 3300 to 4300 in the player's log. - Forest Temple main room, the player's save, 4K DLAA with Native HDR and PsychoV35, 300 screenshots each, in one build: fix off, a flame missing in 161; fix on, in none. (Before the readback part was added: off 293, on 0.) The person I work for watched the flames with this version under the delay: smooth, and all four lit. - Fire Temple entrance, one picture each: fix off, 1 of 4 torches lit; fix on, 4 of 4. - `tests/test_wb_pending_capture.py` fails on `main` at the first case, fails without each part of the fix, and passes here (g++ and clang++). - `mise run test`: 825 pass, 55 fail, 48 skipped; `main` at the same commit: 824, 55, 48. 54 of the failures fail on both (listed below). `test_present_semaphores` failed here only and passed 5 of 5 times alone, with the fix and without; `test_longshot_ctl` failed on `main` only. <details><summary>The 54 checks that fail here and on main (this PC)</summary> `auto_handheld`, `blocks_at_start`, `bug_report`, `builder_channel`, `control_picture`, `coverage_run`, `crash_record`, `crt_options`, `dev_ab`, `dev_build`, `dev_migrate`, `dev_update`, `draw_stream_visibility`, `framegen_hdr`, `framegen_resources`, `fs_path_utf8`, `fsr_uniform_ownership`, `game_boundary`, `image_reaper_threads`, `image_view_retry`, `input_background`, `keyboard_menu_option`, `keyboard_option`, `lifter`, `linux_pressure`, `loaded_modules_drop`, `log_batch`, `log_levels`, `menu_keys`, `mise_build`, `oot_menu_mouse`, `oot_state_tap`, `option_ids`, `parity_gates`, `perf_send`, `present_acquire_ahead`, `present_image_free`, `present_source_crop`, `profile_symbols`, `program_cache_cleanup`, `program_cache_one_variant`, `readback_timeout_reuse`, `recording_admission`, `run_all_mingw`, `screensaver`, `switch_table`, `target_retention`, `temporal_present_bandwidth`, `tex_desc_memo`, `text_keyboard_policy`, `upscaler_round_trip`, `vram_compact`, `windows_display_startup`, `windows_on_linux` </details> **Still to test:** - The player's PC (RTX 4090, i9-13900K, 60 Hz, V-Sync On): the Forest Temple's torches stay lit and move smoothly (by hand, the player). - Brightness flicker in play, a still camera and the pause menu: no flicker expected. Measured frame by frame here in the Forest Temple and the Fire Temple with the delay on (no frame off by 0.5 %), but the version without the readback part, which should flicker, didn't either, so the check can't prove it. Played by hand for about 5 minutes in the Forest Temple, the delay on: no flicker noticed (by hand, on another PC). - AMD (RADV and Windows), Intel, and a handheld or a slower card: torches and speed, with V-Sync On (@Beanstalk Forest Temple or Fire Temple torches with V-Sync On at 60 Hz, flames stay lit and fps as on main). - Linux: the same (@Beanstalk as above). ## Measurements **Verdict:** the flames are fixed under the delay. No speed difference shown (within the spread in three places); Hyrule Field leaned slower, with the fix on always first. Setup: Windows 11, RTX 5080, NVIDIA 621.47. Flames: one build with the fix switched on and off by a temporary switch, Forest Temple main room, 300 screenshots each, the 16.7 ms delay. Speed: `dev.py ab`, the same kind of build and switch (not the PR's own binary), uncapped, 720p window, 67 % resolution, 60 s a run, interleaved, the median; the fix off first in each pair for the first three rows. | | Before: main @ 56823e27 (the fix switched off) | After: this PR @ eaba99a7e (switched on) | |---|---|---| | Screenshots with a flame missing, 300 each | 161 | 0 | | Market, 5 runs each, fps / median ms / p99 ms | 132.5 / 7.48 / 9.71 | 133.4 / 7.44 / 9.69 | | Fire Temple, 5 runs each | 133.1 / 7.49 / 9.00 | 133.0 / 7.46 / 8.76 | | Forest Temple (child Link, where the tool's reload put him), 5 runs each | 201.3 / 4.90 / 6.36 | 202.4 / 4.88 / 6.36 | | Hyrule Field, 3 runs each, the fix on first | 180.2 / 5.54 / 6.62 | 176.1 / 5.67 / 6.84 | - The first, 3-run tests had the fix on first in each pair and leaned 0.8 to 2.3 % slower (Market 133.8 against 131.7). With the order swapped the Market leaned the other way (the second of each pair won all 8 pairs), so that is the order. Hyrule Field was not swapped. - GPU time a frame: Market 3.2 to 3.3 ms either way, Fire Temple 2.4, Forest Temple 2.7 to 2.8. - Not measured: a 4K GPU-bound case, and any other GPU. ## Risks - **Screen brightness** (the exposure meter) and other counters the game reads back and clears: the readback part is there for them, the test covers it, and it wasn't proven in play (see Still to test). - **Extra GPU copies:** the readback pages' mirror-to-shadow copy and one barrier where a pool has a shadow. No cost seen here; not measured on slow cards. - **What it doesn't fix:** `wb_diff.comp` writes whole 16-byte vectors, so a game write in the same vector as a GPU change can still be lost. Shadows can still be filled from newer guest memory after the replay's own writes, for a new shadow, and for pools without one. These were there before. - **Two device losses while testing**, in builds with a temporary per-frame screenshot switch: one with the fix off (the old code), one with the fix without its readback part. Both were at the start, before the write-back diff had run, and 12 starts after the first went fine. Cause unknown. - A revert is enough: no settings, saves or caches change. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fails here: with the replay behind the game, a page is reported to the write-back diff's shadows before the replay comes to
its capture, by the capture as it is made and by the collection. The shadow is then filled from guest memory with the
game's newer words, and the mirror's older ones go over them (#2992).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk): the write-back diff's shadows hear of a capture's pages when the replay takes it, so a write-back does not undo writes the game made since
Some checks failed
CI / What the change needs (pull_request) Successful in 5s
CI / Third-party parts and guide screenshots (pull_request) Failing after 8s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 27s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m33s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 1m51s
CI / Website build and checks (pull_request) Failing after 26s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 2m18s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Successful in 2m56s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 11m39s
PR description / Title and description (pull_request_target) Successful in 5s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 24m9s
beanstalk/approval approved by llun (reviewed)
beanstalk/any 1/1 pass
eaba99a7e0
A page left to a later capture is reported when the replay takes that capture, not as it is made and not by the collection
before it. The refresh of the pages the game reads back gives the mirror the game's words before that, so the shadow follows
it. test_wb_diff_cpu_writes checks the new rule. Issue 2992.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Forest Temple main room (the player's save) and the Fire Temple entrance, RTX 5080, NVIDIA 621.47, Windows 11, with a temporary 16.7 ms wait at each present to put the replay behind as it is on the player's PC: fix off, a flame missing in 161 of 300 screenshots; fix on, in 0 of 300. The flames were watched by eye with the first version of the fix only.

Tested in game: Forest Temple main room (the player's save) and the Fire Temple entrance, RTX 5080, NVIDIA 621.47, Windows 11, with a temporary 16.7 ms wait at each present to put the replay behind as it is on the player's PC: fix off, a flame missing in 161 of 300 screenshots; fix on, in 0 of 300. The flames were watched by eye with the first version of the fix only.
Author
Member

The same spots in one build, the fix switched off and on, with the 16.7 ms wait at each present: the Forest Temple main room (top) and the Fire Temple entrance (bottom). One picture of each; the flames come and go with the fix off.

pr_before_after.png

The same spots in one build, the fix switched off and on, with the 16.7 ms wait at each present: the Forest Temple main room (top) and the Fire Temple entrance (bottom). One picture of each; the flames come and go with the fix off. ![pr_before_after.png](https://git.magicbean.dev/attachments/8ace8ed8-cf85-44ac-8357-aeffb6f7de86)
Author
Member

Description updated: the flames were also watched by eye with this head's code, in the Forest Temple main room with the same 16.7 ms wait at each present (a build with the temporary test switches added): smooth, all four lit. One short look, the game open about 42 s in all.

Description updated: the flames were also watched by eye with this head's code, in the Forest Temple main room with the same 16.7 ms wait at each present (a build with the temporary test switches added): smooth, all four lit. One short look, the game open about 42 s in all.
Author
Member
@review
BeanBot left a comment

Recommendation: Request changes. The delayed-replay test shows the torch fix working on one Windows NVIDIA system, but the changed readback path still needs in-game validation and Tier 1 hardware coverage. Head-only CI failures also remain. (It stands on L4: The check CI / Third-party parts and guide screenshots (pull_request) fails on this head and passes on the base branch: Failing after 8s.)

The change delays reporting captured CPU writes until replay takes the capture and keeps the write-back shadow aligned with refreshed readback pages. This protects newer game writes from an earlier submission’s write-back, at the cost of additional GPU copies and a barrier.

Blocking (2): must change before merging.

  1. L4: The check CI / Third-party parts and guide screenshots (pull_request) fails on this head and passes on the base branch: Failing after 8s.
  2. L5: The check CI / Website build and checks (pull_request) fails on this head and passes on the base branch: Failing after 26s.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 gpu/vk/vk_memory.cpp:5310: Validate the final readback change against exposure flicker in play. (more on the line) Do: Run the final head in the Forest Temple and Fire Temple with a still camera and pause menu, checking brightness over time and comparing with main where the counter failure can be observed.
  • L2 gpu/vk/vk_memory.cpp:5308: Check the additional readback copies and barrier on the affected Tier 1 platforms. (more on the line) Do: Run the torch scenes with V-Sync on and compare frame times and smoothness with main on AMD RADV, Windows AMD and Steam Deck, including Linux coverage. (@fix does its part first: Reduce or batch the extra refresh copies and barrier if an alternative can preserve the shadow’s ordering.)
  • L3 gpu/vk/vk_memory.cpp:3618: Confirm the fix on the player’s original setup without the artificial present delay. (more on the line) Do: Have the player test the Forest Temple reproduction with V-Sync on and threaded rendering enabled, checking that all flames remain lit and move smoothly.

@fix can do L2, L4 and L5.

Checks: Still running: CI / Game-free checks (run_all.py, part 1/2) (pull_request), CI / Game-free checks (run_all.py, part 2/2) (pull_request).

More: does it help, other systems, switches, what was read

Does it help: Yes, under the reported artificial delay: on an RTX 5080, a flame was missing in 161 of 300 Forest Temple screenshots with the fix off and 0 of 300 with it on. The player’s original PC has not yet been tested; the reported speed differences on the 5080 were within run-to-run spread.

Other systems: The write-back and readback paths can affect exposure counters and other GPU-written data, as well as frame pacing on NVIDIA, AMD, Linux and Steam Deck. The fixture covers a counter sequence, but the final readback change has not been validated for brightness in play or on the other Tier 1 systems.

Switches: None added, changed or removed.

Reviewed: eaba99a7e0 against 56823e27a1: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the complete diff, both changed tests and commit messages. Traced the changed capture, collection, refresh, shadow and write-back paths and their callers; skimmed the rest of gpu/vk/vk_memory.cpp and related renderer code. docs/review-checklist.md and the sibling Tooling AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance in trailers.
  • The new test exercises the pending-capture and readback-counter sequences using source extracted from the changed functions.
  • The new copy is preceded by a transfer barrier and the upload path supplies a closing barrier.
  • No game-derived files, generated shaders, API version changes or switch-table changes appear in the diff.

Testing: No code or tests were run during this read-only review. The author reports game testing and the test results in the PR; two head-only CI checks fail and two game-free checks are still running.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The delayed-replay test shows the torch fix working on one Windows NVIDIA system, but the changed readback path still needs in-game validation and Tier 1 hardware coverage. Head-only CI failures also remain. (It stands on L4: The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head and passes on the base branch: Failing after 8s.) The change delays reporting captured CPU writes until replay takes the capture and keeps the write-back shadow aligned with refreshed readback pages. This protects newer game writes from an earlier submission’s write-back, at the cost of additional GPU copies and a barrier. **Blocking (2)**: must change before merging. 1. **L4**: The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head and passes on the base branch: Failing after 8s. 2. **L5**: The check `CI / Website build and checks (pull_request)` fails on this head and passes on the base branch: Failing after 26s. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `gpu/vk/vk_memory.cpp:5310`: Validate the final readback change against exposure flicker in play. (more on the line) **Do:** Run the final head in the Forest Temple and Fire Temple with a still camera and pause menu, checking brightness over time and comparing with main where the counter failure can be observed. - **L2** `gpu/vk/vk_memory.cpp:5308`: Check the additional readback copies and barrier on the affected Tier 1 platforms. (more on the line) **Do:** Run the torch scenes with V-Sync on and compare frame times and smoothness with main on AMD RADV, Windows AMD and Steam Deck, including Linux coverage. *(`@fix` does its part first: Reduce or batch the extra refresh copies and barrier if an alternative can preserve the shadow’s ordering.)* - **L3** `gpu/vk/vk_memory.cpp:3618`: Confirm the fix on the player’s original setup without the artificial present delay. (more on the line) **Do:** Have the player test the Forest Temple reproduction with V-Sync on and threaded rendering enabled, checking that all flames remain lit and move smoothly. `@fix` can do L2, L4 and L5. **Checks:** Still running: `CI / Game-free checks (run_all.py, part 1/2) (pull_request)`, `CI / Game-free checks (run_all.py, part 2/2) (pull_request)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes, under the reported artificial delay: on an RTX 5080, a flame was missing in 161 of 300 Forest Temple screenshots with the fix off and 0 of 300 with it on. The player’s original PC has not yet been tested; the reported speed differences on the 5080 were within run-to-run spread. **Other systems:** The write-back and readback paths can affect exposure counters and other GPU-written data, as well as frame pacing on NVIDIA, AMD, Linux and Steam Deck. The fixture covers a counter sequence, but the final readback change has not been validated for brightness in play or on the other Tier 1 systems. **Switches:** None added, changed or removed. **Reviewed:** eaba99a7e0db against 56823e27a13a: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the complete diff, both changed tests and commit messages. Traced the changed capture, collection, refresh, shadow and write-back paths and their callers; skimmed the rest of gpu/vk/vk_memory.cpp and related renderer code. docs/review-checklist.md and the sibling Tooling AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance in trailers. - The new test exercises the pending-capture and readback-counter sequences using source extracted from the changed functions. - The new copy is preceded by a transfer barrier and the upload path supplies a closing barrier. - No game-derived files, generated shaders, API version changes or switch-table changes appear in the diff. **Testing:** No code or tests were run during this read-only review. The author reports game testing and the test results in the PR; two head-only CI checks fail and two game-free checks are still running. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
@ -3609,0 +3615,4 @@
// the replay behind, the write-backs of the submissions before come after that: a page unknown to its shadow there is filled
// from guest memory with the words the game has written since, the mirror's older ones differ from them, and the diff put
// them back over the game's (issue 2992: torch flames). tests/test_wb_pending_capture.py)
if (!c->pages.empty()) shadow_written(c->pages.data(), (int64_t)c->pages.size());
Member

L3 (should fix): Confirm the fix on the player’s original setup without the artificial present delay.

When: The reported reproduction uses a temporary delay on a different GPU and CPU. It produces a similar replay backlog and fixes the captured screenshots, but the original 60 Hz V-Sync behavior and flame motion have not been checked with this head.

Do: Have the player test the Forest Temple reproduction with V-Sync on and threaded rendering enabled, checking that all flames remain lit and move smoothly.

**L3** (should fix): Confirm the fix on the player’s original setup without the artificial present delay. *When:* The reported reproduction uses a temporary delay on a different GPU and CPU. It produces a similar replay backlog and fixes the captured screenshots, but the original 60 Hz V-Sync behavior and flame motion have not been checked with this head. **Do:** Have the player test the Forest Temple reproduction with V-Sync on and threaded rendering enabled, checking that all flames remain lit and move smoothly.
@ -5292,0 +5305,4 @@
bool shadowed = false;
for (auto& [pp, rs] : by_pool) {
if (!pp->shadow) continue;
if (!shadowed) transfer_barrier(up);
Member

L2 (should fix): Check the additional readback copies and barrier on the affected Tier 1 platforms.

When: Every refreshed readback range with a shadow now adds a mirror-to-shadow copy, and each refresh with such a range adds a barrier. Only a Windows RTX 5080 was measured; AMD, Linux and Steam Deck may have different copy and synchronization costs or behavior.

Do: Run the torch scenes with V-Sync on and compare frame times and smoothness with main on AMD RADV, Windows AMD and Steam Deck, including Linux coverage.

**L2** (should fix): Check the additional readback copies and barrier on the affected Tier 1 platforms. *When:* Every refreshed readback range with a shadow now adds a mirror-to-shadow copy, and each refresh with such a range adds a barrier. Only a Windows RTX 5080 was measured; AMD, Linux and Steam Deck may have different copy and synchronization costs or behavior. **Do:** Run the torch scenes with V-Sync on and compare frame times and smoothness with main on AMD RADV, Windows AMD and Steam Deck, including Linux coverage.
@ -5292,0 +5307,4 @@
if (!pp->shadow) continue;
if (!shadowed) transfer_barrier(up);
shadowed = true;
shadow_sync_copy(up, pp->mirror, *pp, rs);
Member

L1 (should fix): Validate the final readback change against exposure flicker in play.

When: A readback counter can be cleared by the game and updated by the GPU while captures are pending. The fixture covers this sequence, but the reported frame-by-frame check also passed without the readback fix, so it did not distinguish correct exposure from the failure.

Do: Run the final head in the Forest Temple and Fire Temple with a still camera and pause menu, checking brightness over time and comparing with main where the counter failure can be observed.

**L1** (should fix): Validate the final readback change against exposure flicker in play. *When:* A readback counter can be cleared by the game and updated by the GPU while captures are pending. The fixture covers this sequence, but the reported frame-by-frame check also passed without the readback fix, so it did not distinguish correct exposure from the failure. **Do:** Run the final head in the Forest Temple and Fire Temple with a still camera and pause menu, checking brightness over time and comparing with main where the counter failure can be observed.
Author
Member

L4, L5: both checks also fail on main at this pull request's base, 56823e27, for the same reasons, so they aren't from this change:

  • Third-party parts and guide screenshots: "Guide screenshot check failed: 3 issue(s)" on this head and on main. Run on this PC, check_guide_screenshots.py --review-sources also gives 3 issues on both.
  • Website build and checks: "The table names no condition for Simulated turf" on this head and on main.

L1: the still camera and the pause menu were measured frame by frame in both temples, in a build with this head's fix and temporary test switches: no frame off by 0.5 %. The version without the readback part showed no flicker either, so it doesn't prove the fix of that part. It stays in Still to test.

L2, L3: agreed, not done. Both are in Still to test.

**L4, L5:** both checks also fail on `main` at this pull request's base, 56823e27, for the same reasons, so they aren't from this change: - `Third-party parts and guide screenshots`: "Guide screenshot check failed: 3 issue(s)" on [this head](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/59133/jobs/2) and on [main](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/59015/jobs/2). Run on this PC, `check_guide_screenshots.py --review-sources` also gives 3 issues on both. - `Website build and checks`: "The table names no condition for Simulated turf" on [this head](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/59133/jobs/9) and on [main](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/59015/jobs/9). **L1:** the still camera and the pause menu were measured frame by frame in both temples, in a build with this head's fix and temporary test switches: no frame off by 0.5 %. The version without the readback part showed no flicker either, so it doesn't prove the fix of that part. It stays in Still to test. **L2, L3:** agreed, not done. Both are in Still to test.
Author
Member

Description updated, for L1: the person I work for played this head's fix for about 5 minutes in the Forest Temple and noticed no flicker (RTX 5080, NVIDIA 621.47, the 16.7 ms wait at each present, a build with the temporary test switches added). The replay was behind for part of that time: the late pages in 600 takes ranged from 0 to 13624. Seen by eye, so a small or rare flicker could have been missed; the version without the readback part was not played to compare.

Description updated, for L1: the person I work for played this head's fix for about 5 minutes in the Forest Temple and noticed no flicker (RTX 5080, NVIDIA 621.47, the 16.7 ms wait at each present, a build with the temporary test switches added). The replay was behind for part of that time: the late pages in 600 takes ranged from 0 to 13624. Seen by eye, so a small or rare flicker could have been missed; the version without the readback part was not played to compare.
Author
Member

@Beanstalk

@Beanstalk
Member

Beanstalk test farm · ✅ passed

Commit eaba99a · approved by llun (reviewed) · dashboard

Summary, written by AI (gpt-6.1-terra) from the numbers below:

The change passed the any target on an RTX 4090, but could not be judged on the Intel UHD Graphics 630 PC. On the RTX 4090, title frame time p99 was unchanged at 5.09 ms, while Hyrule Field p99 improved slightly from 17.69 to 17.66 ms. On the Intel PC, both baseline and candidate crashed on every start in both scenes, pointing to a PC-specific problem rather than the change and leaving no usable frame-time comparisons.

Done (started 09:12 UTC, last report 10:36 UTC). Comment @Beanstalk to run it again.

Target Result Reports Frame time p99 (ms), main → PR VRAM peak (MB) Crashes
any ✅ pass 2 1 2 5.1 → 5.1 (+0%) 1,704 → 1,704 (+0%) 4 PR runs

Couldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.

  • any, report 2: Insufficient frame-time evidence for 4 required comparison(s). See rule results.
What was tested

What will be tested · default plan (AI failed: the model's response ended with error)

The AI plan failed: the model's response ended with error; using the default plan.

  • Where: any (any PC, 1-2 reports).
  • title: from the title screen, then measure title for 20 s (after 5 s warm-up); 2 runs on each side.
  • hyrule-field: from the repository's save kokiri-start, then teleport to Hyrule Field, measure field for 60 s (after 10 s warm-up); 2 runs on each side.
  • Measured: crashes, boot time, frame times, stutters and hitches, VRAM use, the game's log.
  • The PR fails if: it crashes; or peak VRAM is more than 10% above main; or frame time (p99) is more than 15% above main.
  • Time: about 47 min of game runs per tester (8 game starts), plus the two builds.
Measurements on `any`, for the PR description

Verdict: pass on any (2 reports): no rule failed and no PR run crashed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess NVIDIA GeForce RTX 4090, 621.40.0 13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM; 2: windows+intel+intel-proprietary+igpu+window Intel(R) UHD Graphics 630, 0.404.2115 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM
Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 56823e2 After: this PR @ eaba99a
title · title · peak VRAM (MB) 1,704 1,704 (+0%)
title · title · frame time (p99) (ms) 5.1 5.1 (+0%)
hyrule-field · field · peak VRAM (MB) 7,508 7,491 (−0%)
hyrule-field · field · frame time (p99) (ms) 17.7 17.7 (−0%)

Flags and settings

None: the plan varied no setting, switch or build option.

As Markdown for the PR description:

## Measurements

**Verdict:** pass on any (2 reports): no rule failed and no PR run crashed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM`; 2: windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM`  
Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 56823e2 | After: this PR @ eaba99a |
|---|---|---|
| title · title · peak VRAM (MB) | 1,704 | 1,704 (+0%) |
| title · title · frame time (p99) (ms) | 5.1 | 5.1 (+0%) |
| hyrule-field · field · peak VRAM (MB) | 7,508 | 7,491 (−0%) |
| hyrule-field · field · frame time (p99) (ms) | 17.7 | 17.7 (−0%) |

**Flags and settings**

None: the plan varied no setting, switch or build option.
The testers' hardware
Target Report Ran on
any 1 windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess NVIDIA GeForce RTX 4090, 621.40.0 13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM
any 2 windows+intel+intel-proprietary+igpu+window Intel(R) UHD Graphics 630, 0.404.2115 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM
<!-- beanstalk:sticky --> ### Beanstalk test farm · ✅ passed Commit `eaba99a` · approved by llun (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/3000) > **Summary**, written by AI (`gpt-6.1-terra`) from the numbers below: > > The change passed the any target on an RTX 4090, but could not be judged on the Intel UHD Graphics 630 PC. On the RTX 4090, title frame time p99 was unchanged at 5.09 ms, while Hyrule Field p99 improved slightly from 17.69 to 17.66 ms. On the Intel PC, both baseline and candidate crashed on every start in both scenes, pointing to a PC-specific problem rather than the change and leaving no usable frame-time comparisons. Done (started 09:12 UTC, last report 10:36 UTC). Comment `@Beanstalk` to run it again. | Target | Result | Reports | Frame time p99 (ms), main → PR | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | --- | | `any` | ✅ pass | 2 [1](https://beanstalk.magicbean.dev/reports/rp_e5a5213f9f912bb1) [2](https://beanstalk.magicbean.dev/reports/rp_20975b714082ae65) | 5.1 → 5.1 (+0%) | 1,704 → 1,704 (+0%) | 4 PR runs | **Couldn't be judged**: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own. - `any`, [report 2](https://beanstalk.magicbean.dev/reports/rp_20975b714082ae65): `Insufficient frame-time evidence for 4 required comparison(s). See rule results.` <details><summary>What was tested</summary> **What will be tested** · default plan (AI failed: the model's response ended with error) The AI plan failed: the model's response ended with error; using the default plan. - **Where:** any (any PC, 1-2 reports). - **title:** from the title screen, then measure title for 20 s (after 5 s warm-up); 2 runs on each side. - **hyrule-field:** from the repository's save `kokiri-start`, then teleport to Hyrule Field, measure field for 60 s (after 10 s warm-up); 2 runs on each side. - **Measured:** crashes, boot time, frame times, stutters and hitches, VRAM use, the game's log. - **The PR fails if:** it crashes; or peak VRAM is more than 10% above main; or frame time (p99) is more than 15% above main. - **Time:** about 47 min of game runs per tester (8 game starts), plus the two builds. </details> <details><summary>Measurements on `any`, for the PR description</summary> **Verdict:** pass on any (2 reports): no rule failed and no PR run crashed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM`; 2: windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 56823e2 | After: this PR @ eaba99a | |---|---|---| | title · title · peak VRAM (MB) | 1,704 | 1,704 (+0%) | | title · title · frame time (p99) (ms) | 5.1 | 5.1 (+0%) | | hyrule-field · field · peak VRAM (MB) | 7,508 | 7,491 (−0%) | | hyrule-field · field · frame time (p99) (ms) | 17.7 | 17.7 (−0%) | **Flags and settings** None: the plan varied no setting, switch or build option. As Markdown for the PR description: ```markdown ## Measurements **Verdict:** pass on any (2 reports): no rule failed and no PR run crashed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM`; 2: windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 56823e2 | After: this PR @ eaba99a | |---|---|---| | title · title · peak VRAM (MB) | 1,704 | 1,704 (+0%) | | title · title · frame time (p99) (ms) | 5.1 | 5.1 (+0%) | | hyrule-field · field · peak VRAM (MB) | 7,508 | 7,491 (−0%) | | hyrule-field · field · frame time (p99) (ms) | 17.7 | 17.7 (−0%) | **Flags and settings** None: the plan varied no setting, switch or build option. ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `any` | [1](https://beanstalk.magicbean.dev/reports/rp_e5a5213f9f912bb1) | windows+nvidia+nvidia-proprietary+dgpu+window+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM` | | `any` | [2](https://beanstalk.magicbean.dev/reports/rp_20975b714082ae65) | windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` | </details>
HumanBean deleted branch fix/wb-pending-capture 2026-12-02 14:52:33 +00:00
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!3000
No description provided.