Repository navigation
Conversation
BotW 1.9.0's scene compose (f7ee6fe1) gets an HDR twin like TOTK 1.4.3's compose. Its RGB10A2 targets get FP16 companions. The final copy (vertex e4b5b096, fragment ecb4242e) keeps the FP16 canvas, and the window shows it as EDR. The effects page has the HDR rows on BotW 1.9.0. TOTK_HDR_MAC names the builds that have the engine: TOTK on the Mac and BotW 1.9.0. BotW 1.6.0 has none. - The companion limit (24) no longer aborts. A target past it keeps its own format for that frame, and the log says so once. - The blend rewrite for formats without alpha applies only to R11G11B10F companions. perf: the HDR tone map functions compile in relaxed math (it keeps NaN and infinity; the runtime's mode is safe), and the BT.709 -> LMS chain of the hue and purity donor is folded into constant matrices. The BotW compose twin at 1080p went from 1.12 to 0.29 ms of GPU time. TOTK's twin uses the same functions. In game (BotW, uncapped, same spot): 8.46 to about 7.7 ms of GPU per frame, against 6.95 ms with HDR off. Tests: tests/test_botw_hdr.py and tests/botw_hdr_compose_probe.m (needs BOTW190_SHADER_SEED). They check that the twin with HDR off draws the game's picture; that a dark grey keeps its value and a bright grey goes above SDR white; that the bloom setting scales the bloom texture; that saturated colours match the unfolded chain; and that the final-copy keys exist in the seed. test_hdr_auto covers BotW 1.6.0. Played on a Mac: BotW 1.9.0, 60 s, HDR on, ~94-107 fps, no errors. The pause menu shows SDR content, because the compose does not run there. Not tested: handheld, MetalFX, iOS build, TOTK in game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
orcakhan
marked this pull request as draft
November 27, 2026 02:19
…aps it to the display An external HDR display can report no current EDR headroom (current 1.0, potential above 1) while it shows HDR, even with an HDR video on it (Apple developer forum thread 810008). The canvas was drawn for that current value, so the game showed no HDR there. - On macOS 26 the layer uses preferredDynamicRange high, toneMapMode ifSupported and contentsHeadroom instead of wantsExtendedDynamicRangeContent (deprecated in macOS 26). - The canvas is drawn for the display's potential headroom, capped by the HDR peak row, and tagged with it; the presenter keeps the tag at each frame's peak. macOS grants a tagged layer only its tag's headroom (tagged with the current 1.2, the built-in XDR screen stayed at 1.2), and maps the canvas down to what the display has now. - TOTK_HDR_LAYER=legacy (environment or the app's defaults) keeps the previous layer, to compare. Tested on the built-in XDR screen, BotW 1.9.0 at night: tagged 16, the screen's current headroom rose to 8.3 in the world, as with the previous layer (legacy: 1.2 to 8.3); the FP16 canvas kept every frame. run_source_tests core (2392 OK, 31 skipped) and settings (8, 3 skipped); the four Mac binaries build. Not tested yet: an external HDR display, the picture by eye on the built-in screen, TOTK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…witch is gone The previous layer (wantsExtendedDynamicRangeContent, kept as TOTK_HDR_LAYER=legacy) showed no HDR on an external HDR display that reports no current headroom, so it goes. - The canvas is always drawn for the display's potential headroom (capped by the HDR peak row) and tagged with it; the current headroom is no longer read. With an external HDR display, macOS reported the headroom it granted the game's window (the tag) on another screen's NSScreen, while the external one stayed at 1.0. - front_hdr_tag sets the tag and logs each change, from the switch on and from the presenter alike. Tested: BotW 1.9.0 at night on the built-in XDR screen (tagged 16, current headroom 8.3 in the world, the FP16 canvas kept every frame); on an external HDR display, HDR shows with the display's HDR on, and the game turns SDR when the window moves to an SDR display. run_source_tests core (2392 OK, 31 skipped) and settings (8, 3 skipped); the four Mac binaries build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
orcakhan
marked this pull request as ready for review
November 27, 2026 03:21
…ants it repeats - Ocarina of Time's Mac build shares nvn_mtl.m, whose presenter now calls front_hdr_present_headroom: OoT's frontend gets an empty one (its layer is not tagged), as it has the other front_hdr_* functions. Without it oot-native stopped at the link (undefined _front_hdr_present_headroom). - botw_hdr_compose_source also requires the luma's red weight (0.2989) and the saturation term's 2/3 in the game's compose, which the twin writes as literals; another layout is refused, not given a different saturation. - A comment no longer calls wantsExtendedDynamicRangeContent deprecated: CAMetalLayer's own property is not. Tested: oot-native and the four TotK / BotW Mac binaries build; tests.test_botw_hdr with the 1.9.0 shader seed (2 OK); run_source_tests core (2392 OK, 31 skipped) and settings (8, 3 skipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Breath of the Wild 1.9.0 on the Mac gets HDR / EDR output from the TOTK HDR engine (#1129), with the same switch (Off / Auto / On, #2222) and the same "HDR game brightness" row on the effects page. BotW 1.6.0 and iOS do not change.
f7ee6fe1, the tone mapping) gets an HDR twin, as TOTK 1.4.3's compose does.botw_hdr_compose_sourcechecks its anchors and refuses any other layout. TOTK's edit refuses BotW's compose, and BotW's edit refuses TOTK's.g_hdr_draw_rgb_only).e4b5b096, fragmentecb4242e, a plain nearest copy) keeps the FP16 canvas, and the window shows it as EDR.preferredDynamicRangehigh,toneMapModeifSupported andcontentsHeadroom, in place ofwantsExtendedDynamicRangeContent. The canvas is drawn for the display's potential headroom, capped by the peak row, and tagged with it; macOS maps it to what the display has now. The current headroom is no longer read: an external HDR display can report 1.0 while it shows HDR (also seen with an HDR video; Apple developer forum thread 810008), and the game showed no HDR there.TOTK_HDR_MAC(intotk_hdr.h) names them: TOTK on the Mac, and BotW 1.9.0. It replaces the repeatedTARGET_OS_OSX && !defined(GAME_BOTW)tests.Performance (shared with TOTK)
The tone-map functions were the cost: the runtime compiles shaders in
MTLMathModeSafe, so they ran in precise math.#pragma METAL fp math_mode(relaxed), which keeps NaN and infinity, unlike fast. The game's code after them goes back to safe.Measured (M4 Pro, macOS 27.2)
These runs used the previous layer (
wantsExtendedDynamicRangeContent), except the TOTK tagged-layer runs marked below.BotW 1.9.0 (uncapped, the same spot)
That spot is CPU-bound at about 100 fps, so fps barely moves. The FP16 copies cost about 0.2 ms; the rest of the difference was the tone map.
BotW 1.9.0, Kakariko Village at night (a 100% save, Link by a lit campfire, lanterns on; uncapped, up to 240 fps)
Each run is 60 s in the world; the figures are its last 45 s, from
TOTK_BENCH_FRAMES. The runs alternated (main, PR on, PR off, twice).mainhas no BotW HDR: its runs are the game in SDR, and no twin loaded in them.main(786ddc0)main: no measurable difference. The twomainruns differ from each other by 0.22 ms.TOTK 1.4.3 (up to 144 fps, a new save loaded by autoload)
Each run is 60 s in the world; the figures are its last 45 s, from
TOTK_BENCH_FRAMES. Themainand PR runs alternated (main, PR, main, PR).main(786ddc0)This spot is GPU-bound, so the tone map shows in fps. By the median frame, HDR cost 2.9 ms a frame on
mainand costs 1.2 ms with this PR: about 12% more fps with HDR on. One PR run had two ~110 ms frames; the GPU took 11–12 ms in both, so they did not come from the HDR shaders. The other PR runs had none. The tagged layer (macOS maps the canvas to the display) costs nothing measurable: 1% low 68.2 / 67.4 fps against 67.3 / 68.0, longest frame 16 / 21 ms.Tests
tests/botw_hdr_compose_probe.m(new; run bytests/test_botw_hdr.pyand needsBOTW190_SHADER_SEED) draws the game's compose and the twin on the GPU, one pixel at a time:test_final_copy_keys: the two final-copy keys inhdr_captureexist in the shader seed, and the fragment samples a single texture. A wrong key would leave the picture SDR without any error.test_hdr_autoalso covers BotW 1.6.0 (no HDR).settings_panel_probe.mcounts BotW 1.9.0's HDR rows.tools/depsui-pack environment, as CI):run_source_tests.py core: 2392 tests OK, 31 skipped for unrelated local data (OoT, the shader inbox, fontTools);run_source_tests.py settings: 8 tests OK, 3 skipped (the shader inbox).totk-native,-v143,-botw160and-botw190all build, and so does Ocarina of Time'soot-native, which sharesnvn_mtl.m(its frontend gets an emptyfront_hdr_present_headroom; its layer is not tagged).nvn_mtl.mpasses a syntax-only compile against the iOS SDK as TOTK 1.4.3 and BotW 1.9.0. I could not run the fullbuild_app.py --platform ios(no game files for it here).Played on a Mac: BotW 1.9.0, 60 s with HDR on:
Played on a Mac: BotW 1.9.0, Kakariko Village at night (the runs above, and one played by hand with HDR on):
Played on a Mac: BotW 1.9.0 with the tagged layer:
NSScreen;Played on a Mac: TOTK 1.4.3 with the tagged layer, two runs of 60 s with HDR on: both twins ready, tagged 16, the built-in screen's current headroom at 8.3, the FP16 canvas kept in every frame, no shader failed to compile, the companion limit never reached.
Played on a Mac: TOTK 1.4.3 (before the layer change), the installed app updated to this branch, eight runs of 60–90 s (HDR on and off):
0ac9a549, postac58fc18);Not tested: TOTK's picture by eye with the tagged layer, handheld mode, MetalFX, iPhone / iPad.
A separate PR will follow this one: TOTK 1.4.3's HDR bloom setting scales the scene instead of the bloom. It only shows when the setting is moved off 1. Its test goes into this PR's probe, so it waits for this one.
🤖 Generated with Claude Code