Skip to content

Mac: MetalFX spatial upscaling at present, drawable follows the window - #33

Closed
MeNass89 wants to merge 1 commit into
seedds:mainfrom
MeNass89:metalfx-present
Closed

MeNass89 wants to merge 1 commit into
seedds:mainfrom
MeNass89:metalfx-present

Conversation

@MeNass89

Copy link
Copy Markdown
Contributor

What

  • The present stretched the game picture bilinearly to the drawable, and the drawable kept its first size: a macOS fullscreen on a 4K screen got a 2560x1440 drawable that the window server stretched again.
  • The drawable now follows the view in pixels (resize, fullscreen, backing scale change).
  • When the drawable is at least 1.25x the picture on both axes, the picture goes through MTL4FXSpatialScaler to the size it covers before the usual copy. DM_PRESENT_UPSCALE=0 turns it off.

Numbers (Dark Souls Remastered, M4 Pro, 4K 60 Hz monitor)

  • Fullscreen: 1920x1080 → 3840x2160; window: 1920x1080 → 2560x1440.
  • 60 fps held; GPU p95 6-7 ms.
  • 0 white frames over 678 frames of screen video.

Tested

Measured on the Dark Souls Remastered bring-up branch. Ported onto main; builds with make GAME=010015100B514000, not run with another game.

🤖 Generated with Claude Code

The present stretched the game picture bilinearly to the drawable, and the
drawable kept its first size: a macOS fullscreen on a 4K screen got a
2560x1440 drawable that the window server stretched again. The drawable now
follows the view in pixels (resize, fullscreen, backing scale), and when it
is at least 1.25x the picture on both axes the picture goes through
MTL4FXSpatialScaler to the size it covers before the usual copy.
DM_PRESENT_UPSCALE=0 turns it off.

Dark Souls Remastered, M4 Pro, 4K monitor: fullscreen 1920x1080 -> 3840x2160,
window 1920x1080 -> 2560x1440; 60 fps held, GPU p95 6-7 ms; no white frame
over 678 frames of screen video.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@v0lumehi

Copy link
Copy Markdown
Contributor

Two notes from working on #62:

  1. Same drawable fix in both PRs. Breath of the Wild above 60 fps and at native 1440p / 4K, faster NVN → Metal translation, iOS launcher #62 also makes the drawable follow the view in pixels (front_mac.m: the view's setFrameSize: / viewDidChangeBackingProperties set drawableSize from convertSizeToBacking:). We ran into the same 1280x720-in-fullscreen drawable with Breath of the Wild. Whichever PR lands first, the other should drop its version. I'll rebase Breath of the Wild above 60 fps and at native 1440p / 4K, faster NVN → Metal translation, iOS launcher #62 onto this one if it goes in first.

  2. The upscaler would help on iOS too. Breath of the Wild above 60 fps and at native 1440p / 4K, faster NVN → Metal translation, iOS launcher #62 lets Breath of the Wild output at its 3D views' size (1440p / 4K), so on a Mac at matching resolution the 1.25× threshold keeps the present native, which fits well with this. On an iPhone, though, the game stays at 1280x720 handheld or 1920x1080 docked while the screen is about 2868x1320, which is exactly the case for MTL4FXSpatialScaler. The present path is shared, so iOS would mainly need MetalFX linked into the app. There, though, the GPU is the bottleneck: BotW already drops from 60 to 30 fps in the open world on an iPhone 17 Pro Max. So it should probably be switchable (launcher / DM_PRESENT_UPSCALE) and measured there. I'm happy to do that as a follow-up once this is merged.

@seedds

seedds commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Closing as superseded by #215, which provides the newer opt-in MetalFX present path, launcher setting and Mac/iPhone measurements. The drawable-resizing fix is already on main.

#215 is still open; the remaining upscaling work will be tracked there. Thanks for the original implementation and measurements.

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.

4 participants