Skip to content

Breath of the Wild: the encode thread on by default on the Mac, for higher lows while the world streams in - #2282

Open
dontpokethebear3893 wants to merge 4 commits into
seedds:mainfrom
dontpokethebear3893:upstream/botw-enc-thread
Open

dontpokethebear3893 wants to merge 4 commits into
seedds:mainfrom
dontpokethebear3893:upstream/botw-enc-thread

Conversation

@dontpokethebear3893

@dontpokethebear3893 dontpokethebear3893 commented Nov 11, 2026 •

Copy link
Copy Markdown

What and why

On the Mac, the app turns the game's graphics commands into Metal commands on the game's own submitting thread. The encode thread (DM_NVN_ENC_THREAD, the launcher's Encode thread) moves that work to a thread of its own. It is on by default on the iPhone and off on the Mac, because there it "lowered the typical frame time but made the slowest frames slower" (docs/settings.md).

In Breath of the Wild, whose submit and present take about 4.5 ms a frame on that thread, the encode thread does better on both counts once Link moves. While the world streams in, the submitting thread is the limit, and taking the encoding off it raised the average, the 1% low and the 0.1% low, and cut the slowest frame from 30.6 to 19.1 ms.

The change:

  • game.tsv: enc_thread on, so the Mac defaults to the encode thread for this game (nvn_rec.h rec_on reads the profile). DM_NVN_ENC_THREAD=0 and the launcher's setting still turn it off.
  • Notes: a bullet under CPU in the game note with the measurements below, and docs/settings.md says which games turn it on on the Mac.
  • Tests:
    • test_launcher_settings.py now expects the Mac default to follow the profile (on for this game, off for Wonder).
    • check_t_feedback sets DM_NVN_ENC_THREAD=0: its segment cases test the direct encoder, and with the profile's encode thread on there is no timestamp heap.

Conflict with #2286 (segment commits): both edit the check_t_feedback line of dm/gfx/tests/Makefile. Whichever goes in second needs the two edits combined: DM_NVN_CUT_BUSY=1 DM_NVN_ENC_THREAD=0 … ./t_feedback; DM_NVN_CUT_BUSY=0 DM_NVN_ENC_THREAD=0 … ./t_feedback.

Checked

  • Measurements before and after: Breath of the Wild 1.9.0 (01007EF00011E000), fullscreen at 120 fps with variable refresh, from a save outdoors on the Great Plateau. Link runs laps over grass and ruins (DM_KEYS: B off a wall, LUp for 500 frames, then LRight held). Times are per frame from DM_NVN_TSV, over frames 10,000 to 20,000 (exactly 10,000 frames) of one run each:

    Encode thread off Encode thread on
    Average 106.4 fps (9.39 ms) 112.0 fps (8.93 ms)
    1% low 52.6 fps 58.2 fps
    0.1% low 43.6 fps 55.3 fps
    99th percentile frame 17.53 ms 16.95 ms
    Slowest frame 30.6 ms 19.1 ms
    Frames over 12 ms 1,154 758
    Submit+present p50 4.49 ms 3.77 ms
    GPU p50 4.67 ms 4.48 ms

    The 1% and 0.1% lows are the frame rate over the slowest 1% and 0.1% of frames.

  • Standing still in the same place (four runs, alternating, 125 s each), both settings hold about 120 fps (118.9–119.5 average). There the encode thread's 1% low was lower, 60–63 against 76–79 fps, with the 0.1% lows within a few fps of each other (52.8–55.8). This is the case docs/settings.md describes. The idle frame rate is the same either way.

  • Tests: make -C dm/host/tests GAME=01007EF00011E000 run passes. make -k -C dm/gfx/tests GAME=01007EF00011E000 run passes except check_t_dlss_scaler ("nothing else keeps them alive"), which fails the same way on main (01de04f); check_t_feedback passes (278 checks). In dm/tools/tests, test_launcher_settings passes; test_dmsh_pool_arrays fails the same way on main (KeyError: 'cbufs').

  • Devices and OS: Apple M5 Max, macOS 27.2.1, Studio Display XDR at 120 Hz.

  • Not checked: the running comparison at 60 fps on main alone, and other Macs.

  • After the rebase on main (6a6a018):

    • make -C dm/host/tests GAME=01007EF00011E000 run, check_t_feedback and check_t_reorder_chain (dm/gfx/tests) pass.
    • dm/tools/tests passes: test_docs, test_patches, test_game_profile, test_env_switches, test_launcher_settings, test_settings, test_nsp_mac_app, test_fps_target, test_player_env, test_lint_c and test_gfx_tests_makefile. dm/ios/tests test_launcher_storage passes.
    • lint_python.py --against origin/main reports one new finding, dm/gfx/tools/dmsh_entry.py:7 (F401, an unused import). main itself reports the same one, and this change does not touch that file.
    • The measurements and game runs above were made before the rebase and were not repeated on it.

Docs

  • The finding is in its game note (dm/games/01007EF00011E000/README.md, CPU) and docs/settings.md (Encode thread), and python3 dm/tools/docs_symptoms.py was run
  • A chain tool changed: n/a
  • No game files, keys or data extracted from a game in the change or the attachments

🤖 Generated with Claude Code

…c_thread on): running laps outdoors at 120 fps (M5 Max), it took 10,000 frames from 106.4 to 112.0 fps average, the 1% low from 52.6 to 58.2 and the 0.1% low from 43.6 to 55.3 fps, and the slowest frame from 30.6 to 19.1 ms (submit+present p50 4.49 -> 3.77 ms); standing still both hold about 120. The launcher's Mac default follows the profile (test_launcher_settings), and check_t_feedback pins DM_NVN_ENC_THREAD=0 for its direct-encoder segment cases

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedkoniszewski and others added 3 commits November 12, 2026 15:29
…closed PRs

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Brings the branch up to date with main (fixes for the t_save_sync cloud
device check and the clang-tidy fixture findings, among others) and
resolves the conflicts with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 01007EF00011E000 The Legend of Zelda: Breath of the Wild nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant