Skip to content

Coalesce adjacent captured mirror-copy regions - #948

Closed
nickyfactz wants to merge 2 commits into
NotRexed:mainfrom
nickyfactz:codex/perf-captured-mirror-copies-615d027
Closed

nickyfactz wants to merge 2 commits into
NotRexed:mainfrom
nickyfactz:codex/perf-captured-mirror-copies-615d027

Conversation

@nickyfactz

@nickyfactz nickyfactz commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Captured pages are currently submitted as separate buffer-copy regions even when adjacent pages come from consecutive bytes of the same capture buffer and go to consecutive bytes in the same mirror. Combine only those contiguous regions; retain the original order and separate gaps, overlaps, different buffers and overflow cases.

On an RTX 5090 with NVIDIA driver 616.64, Vulkan mailbox at 1600×900, a stationary Kokiri Forest save on Hookshot 232eecb produced about 2,160 captured copy regions per frame. In a baseline–candidate–baseline test with RX_VK_PASS_TIMING=1, the candidate produced about 1,260 regions per frame. The instrumented GPU copy span was 2.409–2.512 ms/frame in the first baseline, 1.718–1.770 ms in the candidate, and 2.421–2.432 ms in the second baseline. The candidate copied slightly more data; saves and camera were matched but frames were not identical.

These ALL_COMMANDS timestamps add synchronization, so these numbers are not an uninstrumented FPS or frame-time improvement. A separate uninstrumented 45620e comparison showed enough run-order drift to obscure any frame-time effect. This measures one stationary scene on one GPU. The unmodified vk_memory.cpp is byte-identical between tested 232eecb and the originally proposed b82bd36 base, while its directly included vk_menu.h changed for output resolution.

On the same RTX 5090 and driver, a separate 3840×2160 Hyrule Field baseline–candidate–baseline run with frame generation and upscaling off used a copied save and repeated movement plus camera panning. Coarse, nearby renderer summaries reported approximately 3,000–3,100 mirror-sync copy regions/frame in the baselines and 1,650–1,685 in the candidate, with roughly 12 MB synced per frame. These 120-frame averages include captured and live copies, are not strictly aligned to the movement intervals, and the scenes were not frame-identical. The 420-present samples averaged 35.73, 33.57, and 41.35 FPS; these windows were anchored to when input was appended, not when the game read it. The logged input read occurred after the start of both baseline sample windows, so the windows are not matched movement segments. Baseline drift and differences in shader work also prevent attributing an FPS change to this patch. The candidate used the same fe73309 host/game build with the PR renderer rebuilt; it did not include a fresh rebuild of the newer upstream game hotlist. Pre-present captures showed the same Field starting area, not whole-game correctness.

A separate smoke test built the PR commit 615d027 and loaded the same Kokiri Forest save on the RTX 5090 and driver 616.64. Pre-present captures showed the forest scene and Link moving after a short scripted input; the process exited cleanly and no device loss was observed in the logs or checked system events. The program cache was disabled because the final build's shader-cache stamp differs from the earlier build. This is one scene with pre-present captures, not a full-game validation or a measurement of FPS improvement.

Validation: the strict Linux game-free suite passed 108 checks, with four game/GPU-dependent skips. The new fixture compiles the actual helper and checks copied bytes, independent buffers, partial ranges, gaps, overlaps, backwards order and overflow. On this Windows host the full strict suite passed 100 checks, failed two and skipped ten; both failures reproduce on the unchanged b82bd36 parent: the account cannot create symbolic-link fixtures, and the local LLVM-MinGW toolchain rejects an existing FPS-overlay fixture lacking <initializer_list>. The fork's hosted source-regressions workflow passed all four jobs for commit 615d027: https://github.com/nickyfactz/Hookshot/actions/runs/42550186470. The refreshed commit 0c93b92 also passed all four jobs: https://github.com/nickyfactz/Hookshot/actions/runs/42570776258.

Assisted-by: OpenAI Codex

nickyfactz and others added 2 commits November 8, 2026 21:03
Combine adjacent regions only when their source and destination both remain contiguous within the same captured buffer and mirror. Keep noncontiguous regions in their existing order.

Assisted-by: OpenAI Codex
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant