Repository navigation
Conversation
…y format they share, not only RGBA16F: Ocarina of Time -0.6 to -1.0 ms a frame on an M1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
One interaction to know about, not a problem with this change: the frame-generation draft #2279 hooks |
… format, scratch textures only for a side that copies (PR #2559) With DM_UPSCALER=metalfx, the upscaler took the game's textures straight only when both were RGBA16F; any other format cost a copy into the scaler's RGBA16F input and a draw back from its output, a render pass each (Ocarina of Time: R11G11B10F 1440x810 -> 1920x1080). - One scaler cache keyed by sizes, colour mode and both formats (8 slots; a format MetalFX refuses is remembered and RGBA16F stands in). The scaler's own input and output textures are made on first use by a side that copies, so straight paths no longer hold them. - The input is the game's texture in its own format when the rectangle is the whole texture, the format is not sRGB and the usages fit (DM_NVN_MFX_DIRECT=0|1|ab, on by default; =0 keeps the input in RGBA16F unless it already is). - The output stays straight only in RGBA16F: MetalFX's own R11G11B10F writes come out about two mantissa steps low (2.0 as 1.94, 0.5 as 0.484, against 1.98 and 0.496 drawn back), 2.4 % darker everywhere, so Ocarina keeps its draw back. On an M6, a harness of 1,200 dispatches at Ocarina's sizes (four alternating runs, medians): 340 us each with both copies, 316 with the input straight, 271 with both. PR #2559 measured both going in game on an M1 at 0.64 and 0.97 ms a frame. Not run in game on this change (no NDSR game built on disk). Checks: check_t_upscaler_mfx (5 runs, new R11G11B10F, mixed-format, offset and DM_NVN_MFX_DIRECT=0 cases; the R11G11B10F mean check fails on straight packed writes), test_docs, test_env_switches. No regress run: regress uses the game's own upscaler. Co-authored-by: Adya <114347520+AdyaGMD@users.noreply.github.com>
|
Thanks, landed as f31d607 in a reworked form, with you credited as co-author. The diagnosis and your M1 A/B numbers carried it. What changed from the PR:
Timing on an M6, from a harness of 1,200 dispatches at Ocarina's sizes (four alternating runs, medians): 340 µs a dispatch with both copies, 316 µs with the input straight, 271 µs with both straight. I couldn't run it in game here, because no NDSR game is built on this machine right now. An in-game A/B on your M1 ( @dpadr, for #2279: the straight path is now input-only on Ocarina. |
…y the Metal texture (seedds#2542) in place of seedds#2260's; the game's upscaler takes the game's textures straight (seedds#2559) except square-root input and a blended output (seedds#2366)
What
With
DM_UPSCALER=metalfx, the spatial scaler drew straight from the game's colour into its output image only when both were RGBA16F. Otherwise every frame:With
DM_NVN_MFX_DIRECT(on by default;=0keeps the copies,abfor theDM_ABphases), when the game's colour and output image share any one format, a second scaler is made in that format. It scales straight between the game's images, with the same conditions as the RGBA16F straight path:If MetalFX refuses the format (no scaler made), or the usages don't match, the copies stay, with one log line saying why.
Why
Ocarina of Time's upscaler chain reads and writes R11G11B10F (1440x810 → 1920x1080). MetalFX takes that format, so the two copy passes were pure overhead every frame.
Performance
Ocarina of Time (0400486024DEC000), Kokiri Forest, MacBook M1 (8-core GPU), fullscreen,
DM_UPSCALER=metalfx. Measured in a tree with other local changes. Frame p50 per phase:DM_NVN_MFX_DIRECT=ab, 300-frame phases=ab:0/2(polarity swapped), 450-frame phasesLower in every adjacent pair, in both runs. Screenshots with it on and off differ only by animation (fog, colour and UI match).
The log line:
upscaler: MetalFX spatial scaler (HDR) straight in format 92, 1440x810 -> 1920x1080.Switch (in
docs/env_switches.tsv)DM_NVN_MFX_DIRECT=0|1|ab: on by default.Checked
Not run
🤖 Generated with Claude Code