perf(vk): the menu's status each frame keeps the screen's size and reads HOS_WIDE_MAX_PX and HOS_AUDIO_DEVICE once #3234

Merged
HumanBean merged 2 commits from dyst/Longshot:perf/menu-status-main-thread into main 2026-12-05 17:56:38 +00:00
Member

Summary

Every frame, the game's main thread asks the Insert menu for its capabilities and the renderer for its status (the
settings service's restart check, the HDR status query, the frame's settings). Those answers work out the screen's size
and the widescreen picture's size many times a frame (every Aspect ratio value goes through monitor_shape), and each time
they went to the system:

  • the screen's size: MonitorFromWindow + GetMonitorInfoW, or two GetSystemMetrics, round trips into the window
    system (~2.5 % of the frame's critical path standing in Hyrule Field);
  • getenv("HOS_WIDE_MAX_PX") in hos_wide_max_px / hos_wide_picture, and getenv("HOS_AUDIO_DEVICE") in the
    status's row bits: the C runtime's lock and a walk of the whole environment, ~5 % of the main thread's samples.

The main thread is the frame's serial stretch, so its time is the frame's. This keeps the screen's size 100 ms per thread
(and per window), well inside outputs_follow_screen's 30 presents, and reads the two variables once (they are set
before any thread reads the environment: game_host.c hos_switch_set). In a profile of Hyrule Field the menu's pollers
fell from ~10 % of the main thread's samples to under 1 %.

Read first: gpu/vk/menu/output.cpp (screen_kept, screen_size, host_screen_size), host/hos_wide_size.h
(hos_wide_max_env), gpu/vk/menu/audio.cpp (output_forced).

Testing

Tested: Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47). These two commits over main 3b3ea2cb3 ran
six runs of play through dev.py ab (Hyrule Field and Market, teleported, ~100 s each) and a profiled Hyrule Field run:
every run played to its end, and in the profile the menu's pollers are under 1 % of the main thread's samples (~10 %
before).
tests/run_all.py --strict: 838 passed, 21 failed, 52 skipped (Windows, llvm-mingw, --strict). The 21 fail on main 3a0f7d8f7 too, in the same setup, and none reads a changed file: test_dev_update.py, test_dlssg.py, test_framegen_hdr.py, test_fsr3fi_hud_layer.py, test_fsr3fi_hudless_colour.py, test_fsr4_tune.py, test_gfx_effects.py, test_helpers_extract.py, test_lifter.py, test_longshot_ctl.py, test_native_zstd.py, test_no_game_title.py, test_no_map_reload.py, test_present_acquire_ahead.py, test_present_geometry_trace.py, test_present_held_image.py, test_present_image_free.py, test_sync_watch_event.py, test_temporal_present_bandwidth.py, test_turf_budget.py, test_ui_renderer.py. The checks that read the changed files (--changed) all pass, test_audio_output_devices.py, test_output_resolution.py and test_display_modes.py among them.

Still to test:

  • Windows, two monitors: open the Insert menu's Output resolution and Aspect ratio rows, move the window to the other
    monitor, expecting the "(monitor's)" and "(native)" marks to follow it within a moment (by hand)
  • Linux (Steam Deck): play a minute and open the Output resolution row, expecting it as on main
    (@Beanstalk play Hyrule Field on the Steam Deck and open the Insert menu's Output resolution row)

Measurements

Verdict: it helps where the game's main thread sets the pace: Hyrule Field +5.5 % fps, the game's frame 0.6 ms shorter; Market +5.4 % in a second series (the game's frame 0.65 ms shorter), after a first series at -3.0 % whose game time did not move and whose render thread drew slower in both B runs. All eight Market runs together: median 58.75 -> 59.8 fps (+1.8 %); Market's runs spread over up to ~7 fps.

Setup: Windows 11, Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47); 3440 x 1440 output, Render resolution 67 %, VSync off,
uncapped (HOS_FPS_MAX=1000), CPU-bound. dev.py ab with two runtimes, interleaved (A B A B), each run 60 s measured
after the warm-up; the median of each run's fps. Both sides are main 3b3ea2cb3 with #2235's lift change and two
profiling-only commits; B adds exactly this PR's two commits.

Before: main @ 3b3ea2cb3 (+ #2235) After: this PR @ ac8a6d4dc (its two commits over the same)
Hyrule Field, fps (2 runs each; median) 76.7, 76.6 (76.65) 81.2, 80.5 (80.85, +5.5 %)
Hyrule Field, the game's ms a frame 12.27 11.66
Market, first series, fps 57.9, 59.1 (58.5) 56.9, 56.8 (56.85, -3.0 %)
Market, first series, the game's ms a frame 15.51 15.63
Market, second series, fps 58.4, 65.0 (61.7) 62.7, 67.4 (65.05, +5.4 %)
Market, second series, the game's ms a frame 14.55 13.90

Risks

  • A desktop size or monitor change is seen up to 100 ms later by the Insert menu's rows (the marks and the
    default output size follow it a moment later; outputs_follow_screen waits 30 presents anyway).
  • HOS_WIDE_MAX_PX and HOS_AUDIO_DEVICE set while the game runs are no longer seen. Nothing sets them during a run
    (they are start-up switches); a run started with them behaves as before.
  • A revert is enough; nothing changes in saves, settings.toml or the caches.

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 check under tests/ that reads changed source is updated, not weakened: tests/test_audio_output_devices.py
    set HOS_AUDIO_DEVICE halfway through its fixture's run; the fixture now runs a second time with it set before it
    starts, as a run's switches are, and asserts the same.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run. Linux: CI's build)
  • 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 Every frame, the game's main thread asks the Insert menu for its capabilities and the renderer for its status (the settings service's restart check, the HDR status query, the frame's settings). Those answers work out the screen's size and the widescreen picture's size many times a frame (every Aspect ratio value goes through `monitor_shape`), and each time they went to the system: - the screen's size: `MonitorFromWindow` + `GetMonitorInfoW`, or two `GetSystemMetrics`, round trips into the window system (~2.5 % of the frame's critical path standing in Hyrule Field); - `getenv("HOS_WIDE_MAX_PX")` in `hos_wide_max_px` / `hos_wide_picture`, and `getenv("HOS_AUDIO_DEVICE")` in the status's row bits: the C runtime's lock and a walk of the whole environment, ~5 % of the main thread's samples. The main thread is the frame's serial stretch, so its time is the frame's. This keeps the screen's size 100 ms per thread (and per window), well inside `outputs_follow_screen`'s 30 presents, and reads the two variables once (they are set before any thread reads the environment: `game_host.c` `hos_switch_set`). In a profile of Hyrule Field the menu's pollers fell from ~10 % of the main thread's samples to under 1 %. Read first: `gpu/vk/menu/output.cpp` (`screen_kept`, `screen_size`, `host_screen_size`), `host/hos_wide_size.h` (`hos_wide_max_env`), `gpu/vk/menu/audio.cpp` (`output_forced`). ## Testing **Tested:** Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47). These two commits over main 3b3ea2cb3 ran six runs of play through `dev.py ab` (Hyrule Field and Market, teleported, ~100 s each) and a profiled Hyrule Field run: every run played to its end, and in the profile the menu's pollers are under 1 % of the main thread's samples (~10 % before). `tests/run_all.py --strict`: 838 passed, 21 failed, 52 skipped (Windows, llvm-mingw, `--strict`). The 21 fail on main 3a0f7d8f7 too, in the same setup, and none reads a changed file: `test_dev_update.py`, `test_dlssg.py`, `test_framegen_hdr.py`, `test_fsr3fi_hud_layer.py`, `test_fsr3fi_hudless_colour.py`, `test_fsr4_tune.py`, `test_gfx_effects.py`, `test_helpers_extract.py`, `test_lifter.py`, `test_longshot_ctl.py`, `test_native_zstd.py`, `test_no_game_title.py`, `test_no_map_reload.py`, `test_present_acquire_ahead.py`, `test_present_geometry_trace.py`, `test_present_held_image.py`, `test_present_image_free.py`, `test_sync_watch_event.py`, `test_temporal_present_bandwidth.py`, `test_turf_budget.py`, `test_ui_renderer.py`. The checks that read the changed files (`--changed`) all pass, `test_audio_output_devices.py`, `test_output_resolution.py` and `test_display_modes.py` among them. **Still to test:** - Windows, two monitors: open the Insert menu's Output resolution and Aspect ratio rows, move the window to the other monitor, expecting the "(monitor's)" and "(native)" marks to follow it within a moment (by hand) - Linux (Steam Deck): play a minute and open the Output resolution row, expecting it as on main (@Beanstalk play Hyrule Field on the Steam Deck and open the Insert menu's Output resolution row) ## Measurements **Verdict:** it helps where the game's main thread sets the pace: Hyrule Field +5.5 % fps, the game's frame 0.6 ms shorter; Market +5.4 % in a second series (the game's frame 0.65 ms shorter), after a first series at -3.0 % whose game time did not move and whose render thread drew slower in both B runs. All eight Market runs together: median 58.75 -> 59.8 fps (+1.8 %); Market's runs spread over up to ~7 fps. Setup: Windows 11, Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47); 3440 x 1440 output, Render resolution 67 %, VSync off, uncapped (`HOS_FPS_MAX=1000`), CPU-bound. `dev.py ab` with two runtimes, interleaved (A B A B), each run 60 s measured after the warm-up; the median of each run's fps. Both sides are main 3b3ea2cb3 with #2235's lift change and two profiling-only commits; B adds exactly this PR's two commits. | | Before: main @ 3b3ea2cb3 (+ #2235) | After: this PR @ ac8a6d4dc (its two commits over the same) | |---|---|---| | Hyrule Field, fps (2 runs each; median) | 76.7, 76.6 (76.65) | 81.2, 80.5 (80.85, +5.5 %) | | Hyrule Field, the game's ms a frame | 12.27 | 11.66 | | Market, first series, fps | 57.9, 59.1 (58.5) | 56.9, 56.8 (56.85, -3.0 %) | | Market, first series, the game's ms a frame | 15.51 | 15.63 | | Market, second series, fps | 58.4, 65.0 (61.7) | 62.7, 67.4 (65.05, +5.4 %) | | Market, second series, the game's ms a frame | 14.55 | 13.90 | ## Risks - A desktop size or monitor change is seen up to 100 ms later by the Insert menu's rows (the marks and the default output size follow it a moment later; `outputs_follow_screen` waits 30 presents anyway). - `HOS_WIDE_MAX_PX` and `HOS_AUDIO_DEVICE` set while the game runs are no longer seen. Nothing sets them during a run (they are start-up switches); a run started with them behaves as before. - A revert is enough; nothing changes in saves, `settings.toml` or the caches. ## 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 check under `tests/` that reads changed source is updated, not weakened: `tests/test_audio_output_devices.py` set `HOS_AUDIO_DEVICE` halfway through its fixture's run; the fixture now runs a second time with it set before it starts, as a run's switches are, and asserts the same. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run. Linux: CI's build) - [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)
The menu's capabilities and the renderer's status are asked every frame on the game's main thread
(the settings service's restart check, the HDR status query, the frame's settings), and each asks
the screen's size many times (every Aspect ratio value through monitor_shape): a MonitorFromWindow +
GetMonitorInfoW or two GetSystemMetrics round trips each time, ~2.5 % of the frame's critical path
standing in Hyrule Field. screen_size and host_screen_size keep their answer 100 ms per thread (and
per window), well inside outputs_follow_screen's 30 presents.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
perf(vk): HOS_WIDE_MAX_PX and HOS_AUDIO_DEVICE read once, not at every question of the menu's status
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
ac8a6d4dc0
The Insert menu's capabilities and the renderer's status work out the widescreen picture's size several times a frame on
the game's main thread, and each asked getenv("HOS_WIDE_MAX_PX"): the C runtime's lock and a walk of the whole
environment, ~5 % of that thread's samples in a Hyrule Field recording. The status's row bits asked HOS_AUDIO_DEVICE the
same way. Both are set before any thread reads the environment (game_host.c hos_switch_set), so they are read once.

tests/test_audio_output_devices.py's menu fixture set HOS_AUDIO_DEVICE halfway through its run; it now runs a second
time with the variable set before it starts, as a run's switches are.

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

Tested in game: Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47). These two commits over main 3b3ea2cb3: six runs of play through dev.py ab (Hyrule Field and Market, teleported, ~100 s each) and a profiled Hyrule Field run. Every run played to its end; in the profile the menu's pollers are under 1 % of the main thread's samples (~10 % before). Field +5.5 % fps, Market +5.4 % in the second series (Measurements has every run).

Tested in game: Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47). These two commits over main 3b3ea2cb3: six runs of play through dev.py ab (Hyrule Field and Market, teleported, ~100 s each) and a profiled Hyrule Field run. Every run played to its end; in the profile the menu's pollers are under 1 % of the main thread's samples (~10 % before). Field +5.5 % fps, Market +5.4 % in the second series (Measurements has every run).
Member

Possibly related, for context:

  • PR #3208 refactor(menu): move the Insert menu's logic out of the renderer into the game — Broader Insert-menu refactor overlaps menu output/status code
Possibly related, for context: - PR #3208 refactor(menu): move the Insert menu's logic out of the renderer into the game — Broader Insert-menu refactor overlaps menu output/status code
Author
Member

On BeanBot's link: #3208 (moving the Insert menu's logic into the game) deletes gpu/vk/menu/output.cpp and audio.cpp, and its Rust side reads HOS_WIDE_MAX_PX once at the run's start (output_start) and keeps the output sizes, asking the screen again only when it changed (follow_screen). So it should remove most of this cost by its own design. If #3208 merges first, this PR shrinks to host/hos_wide_size.h (or closes, if nothing on the main thread still calls it each frame: I'll profile #3208 then). If this one merges first, #3208 only drops these two files' hunks along with the files.

On BeanBot's link: #3208 (moving the Insert menu's logic into the game) deletes `gpu/vk/menu/output.cpp` and `audio.cpp`, and its Rust side reads `HOS_WIDE_MAX_PX` once at the run's start (`output_start`) and keeps the output sizes, asking the screen again only when it changed (`follow_screen`). So it should remove most of this cost by its own design. If #3208 merges first, this PR shrinks to `host/hos_wide_size.h` (or closes, if nothing on the main thread still calls it each frame: I'll profile #3208 then). If this one merges first, #3208 only drops these two files' hunks along with the files.
Owner
@rebase
Member

I rebased this pull request onto main (b3bfdc781c): the new head is 909990a5c4.

Conflicts resolved

  • gpu/vk/menu/output.cpp: Kept the base branch’s deletion after the menu logic moved.
  • game/crates/host-sys/src/devices.rs: Carried the 100 ms per-thread screen-size cache to the moved host service.
  • game/crates/api/src/services/devices.rs: Refreshes cached sizes when screen modes are relisted after a monitor change.
  • Also changed, beyond the conflict: game/crates/api/src/services/devices.rs, game/crates/host-sys/src/devices.rs
  • game/crates/api/src/services/devices/tests.rs: Added isolated forced and unforced process cases covering device selection and the forced status bit. Tests were not run, as requested.
  • Also changed, beyond the conflict: game/crates/api/src/services/devices.rs, game/crates/api/src/services/devices/tests.rs

Nothing was built or run: read the resolution before merging.


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

I rebased this pull request onto `main` (b3bfdc781c9e): the new head is 909990a5c428. **Conflicts resolved** - gpu/vk/menu/output.cpp: Kept the base branch’s deletion after the menu logic moved. - game/crates/host-sys/src/devices.rs: Carried the 100 ms per-thread screen-size cache to the moved host service. - game/crates/api/src/services/devices.rs: Refreshes cached sizes when screen modes are relisted after a monitor change. - Also changed, beyond the conflict: `game/crates/api/src/services/devices.rs`, `game/crates/host-sys/src/devices.rs` - game/crates/api/src/services/devices/tests.rs: Added isolated forced and unforced process cases covering device selection and the forced status bit. Tests were not run, as requested. - Also changed, beyond the conflict: `game/crates/api/src/services/devices.rs`, `game/crates/api/src/services/devices/tests.rs` Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed perf/menu-status-main-thread from ac8a6d4dc0
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 909990a5c4
Some checks failed
CI / What the change needs (pull_request) Successful in 7s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Waiting to run
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Waiting to run
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Waiting to run
CI / Website build and checks (pull_request) Waiting to run
CI / Third-party parts and guide screenshots (pull_request) Successful in 11s
PR description / Title and description (pull_request_target) Failing after 6s
2026-12-05 17:43:48 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The reported performance gains are from the pre-rebase menu implementation, so they do not establish a gain for this head. The changed monitor-following path also needs the planned Windows and Linux runs. Recommend approval; not approved on the forge.

The change caches the audio-device override and widescreen pixel budget, and keeps screen sizes briefly per thread. It adds cache state and allows screen-size changes to be observed later; the gain after the menu moved to Rust is unmeasured.

Nits (1): optional.

  • L4: The description identifies deleted C++ files as the implementation and presents earlier measurements as this pull request's result. When: A reviewer following the read-first list cannot find the named menu files, and the stated per-frame screen queries do not describe the Rust callers at this head. Do: Rewrite the summary, read-first list, testing and measurements for the rebased diff, distinguishing the earlier runs from results on this head.

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

  • L1: The measurements do not measure this rebased implementation, whose screen-size calls are already much less frequent. When: On this head, follow_screen calls screen_sizes when monitors are listed, normally once per 30 frames; the reported runs instead measured the former C++ menu's per-status screen queries. Their +5.5% Field result cannot be attributed to this diff against its actual base. Do: Measure this head against b3bfdc781c with interleaved runs in the target and heavy scenes, reporting average and 1% low fps and frame times at player settings. (@fix does its part first: Remove the screen-size cache if its remaining calls are too infrequent to justify it.)
  • L2 game/crates/host-sys/src/devices.rs:34: The changed screen-following path has not been exercised on the rebased head on Windows with multiple monitors. (more on the line) Do: On Windows, move the window between differently sized monitors and change a monitor's resolution; verify the output modes and monitor/native marks follow correctly. (@fix does its part first: Remove the screen-size cache to eliminate its added delay.)
  • L3 game/crates/host-sys/src/devices.rs:34: The changed platform path has not been exercised on Linux or Steam Deck on this head. (more on the line) Do: Play on Steam Deck and check the Output resolution row and screen-following behavior, as proposed in Still to test. (@fix does its part first: Remove the screen-size cache to eliminate its added delay.)

@fix can do L1, L2, L3 and L4.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • game/crates/api/src/services/devices/tests.rs:22: Is there a concrete incorrect behavior caused by this test gap that the existing code or repository rules require the test to catch?

Checks: Still running: PR description / Title and description (pull_request_target).

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

Does it help: Unproven. The description reports Hyrule Field at 76.65 to 80.85 fps (+5.5%) on the earlier implementation, but those runs are not against this head's base. On this head, screen_sizes is called by follow_screen after monitor listings, normally every 30 frames, rather than by every status query; the old C++ menu paths no longer exist.

Other systems: Screen-size polling can affect monitor moves and resolution changes on Windows and Linux, including Steam Deck. The environment caches affect startup overrides on both platforms. The reported Windows play runs exercised the earlier implementation; no run of this rebased head is reported.

Switches: No switches added or removed. HOS_AUDIO_DEVICE and HOS_WIDE_MAX_PX retain their existing defaults but are now cached after first use; runtime environment changes are no longer observed.

Reviewed: 909990a5c4 against b3bfdc781c: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the full diff and commits, and all four changed files. Traced screen-size callers, monitor following, switch initialization and widescreen callers; skimmed related output-resolution tests. docs/review-checklist.md and the adjacent Tooling checkout were absent. No recorded runs, translations or generated files were changed.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance in their trailers.
  • The wide-budget cache uses atomic loads and stores, and the Rust audio cache uses OnceLock.
  • No game-derived files, generated files, third-party changes, shader changes or renderer API changes appear in the diff.

Testing: Read-only review; no builds, tests or project scripts were run. CI reports no failures and one description check still running.

Overlaps and merge order: #3208 moved the menu logic to Rust and is already reflected in this rebased head; the author's comment says it removed much of the original target cost.


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

**Recommendation: Approve.** The code is ready: only testing is left. The reported performance gains are from the pre-rebase menu implementation, so they do not establish a gain for this head. The changed monitor-following path also needs the planned Windows and Linux runs. Recommend approval; not approved on the forge. The change caches the audio-device override and widescreen pixel budget, and keeps screen sizes briefly per thread. It adds cache state and allows screen-size changes to be observed later; the gain after the menu moved to Rust is unmeasured. **Nits (1)**: optional. - **L4**: The description identifies deleted C++ files as the implementation and presents earlier measurements as this pull request's result. *When:* A reviewer following the read-first list cannot find the named menu files, and the stated per-frame screen queries do not describe the Rust callers at this head. **Do:** Rewrite the summary, read-first list, testing and measurements for the rebased diff, distinguishing the earlier runs from results on this head. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1**: The measurements do not measure this rebased implementation, whose screen-size calls are already much less frequent. *When:* On this head, follow_screen calls screen_sizes when monitors are listed, normally once per 30 frames; the reported runs instead measured the former C++ menu's per-status screen queries. Their +5.5% Field result cannot be attributed to this diff against its actual base. **Do:** Measure this head against b3bfdc781c9e with interleaved runs in the target and heavy scenes, reporting average and 1% low fps and frame times at player settings. *(`@fix` does its part first: Remove the screen-size cache if its remaining calls are too infrequent to justify it.)* - **L2** `game/crates/host-sys/src/devices.rs:34`: The changed screen-following path has not been exercised on the rebased head on Windows with multiple monitors. (more on the line) **Do:** On Windows, move the window between differently sized monitors and change a monitor's resolution; verify the output modes and monitor/native marks follow correctly. *(`@fix` does its part first: Remove the screen-size cache to eliminate its added delay.)* - **L3** `game/crates/host-sys/src/devices.rs:34`: The changed platform path has not been exercised on Linux or Steam Deck on this head. (more on the line) **Do:** Play on Steam Deck and check the Output resolution row and screen-following behavior, as proposed in Still to test. *(`@fix` does its part first: Remove the screen-size cache to eliminate its added delay.)* `@fix` can do L1, L2, L3 and L4. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - `game/crates/api/src/services/devices/tests.rs:22`: Is there a concrete incorrect behavior caused by this test gap that the existing code or repository rules require the test to catch? **Checks:** Still running: `PR description / Title and description (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. The description reports Hyrule Field at 76.65 to 80.85 fps (+5.5%) on the earlier implementation, but those runs are not against this head's base. On this head, screen_sizes is called by follow_screen after monitor listings, normally every 30 frames, rather than by every status query; the old C++ menu paths no longer exist. **Other systems:** Screen-size polling can affect monitor moves and resolution changes on Windows and Linux, including Steam Deck. The environment caches affect startup overrides on both platforms. The reported Windows play runs exercised the earlier implementation; no run of this rebased head is reported. **Switches:** No switches added or removed. HOS_AUDIO_DEVICE and HOS_WIDE_MAX_PX retain their existing defaults but are now cached after first use; runtime environment changes are no longer observed. **Reviewed:** 909990a5c428 against b3bfdc781c9e: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the full diff and commits, and all four changed files. Traced screen-size callers, monitor following, switch initialization and widescreen callers; skimmed related output-resolution tests. docs/review-checklist.md and the adjacent Tooling checkout were absent. No recorded runs, translations or generated files were changed.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance in their trailers. - The wide-budget cache uses atomic loads and stores, and the Rust audio cache uses OnceLock. - No game-derived files, generated files, third-party changes, shader changes or renderer API changes appear in the diff. **Testing:** Read-only review; no builds, tests or project scripts were run. CI reports no failures and one description check still running. **Overlaps and merge order:** #3208 moved the menu logic to Rust and is already reflected in this rebased head; the author's comment says it removed much of the original target cost. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
@ -32,3 +32,3 @@
/// The monitor the window is on's size, and the main one's: cheap, asked while the game runs.
/// The monitor the window is on's size, and the main one's, kept for 100 ms per thread.
#[must_use]
pub fn screen_sizes() -> (Option<ScreenSize>, Option<ScreenSize>) {
Member

L2 (should fix): The changed screen-following path has not been exercised on the rebased head on Windows with multiple monitors.

When: When a window moves or a monitor's resolution changes, the cached size can remain in use until a later monitor listing, so the output and aspect-ratio rows may update later.

Do: On Windows, move the window between differently sized monitors and change a monitor's resolution; verify the output modes and monitor/native marks follow correctly.

**L2** (should fix): The changed screen-following path has not been exercised on the rebased head on Windows with multiple monitors. *When:* When a window moves or a monitor's resolution changes, the cached size can remain in use until a later monitor listing, so the output and aspect-ratio rows may update later. **Do:** On Windows, move the window between differently sized monitors and change a monitor's resolution; verify the output modes and monitor/native marks follow correctly.
Member

L3 (should fix): The changed platform path has not been exercised on Linux or Steam Deck on this head.

When: The menu obtains its screen size through the host on Linux too, and the new cache controls when a changed answer reaches the output list.

Do: Play on Steam Deck and check the Output resolution row and screen-following behavior, as proposed in Still to test.

**L3** (should fix): The changed platform path has not been exercised on Linux or Steam Deck on this head. *When:* The menu obtains its screen size through the host on Linux too, and the new cache controls when a changed answer reaches the output list. **Do:** Play on Steam Deck and check the Output resolution row and screen-following behavior, as proposed in Still to test.
HumanBean changed title from WIP: perf(vk): the menu's status each frame keeps the screen's size and reads HOS_WIDE_MAX_PX and HOS_AUDIO_DEVICE once to perf(vk): the menu's status each frame keeps the screen's size and reads HOS_WIDE_MAX_PX and HOS_AUDIO_DEVICE once 2026-12-05 17:56:34 +00:00
HumanBean deleted branch perf/menu-status-main-thread 2026-12-05 17:56:39 +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!3234
No description provided.