8000 macos: honour Conf::high_dpi on the Metal path by benface · Pull Request #675 · not-fl3/miniquad · GitHub
[go: up one dir, main page]

Skip to content

macos: honour Conf::high_dpi on the Metal path - #675

Open
benface wants to merge 1 commit into
not-fl3:masterfrom
benface:macos-metal-high-dpi
Open

benface wants to merge 1 commit into
not-fl3:masterfrom
benface:macos-metal-high-dpi

Conversation

@benface
@benface benface commented Oct 9, 2026
Copy link
Copy Markdown
Contributor

Why

create_metal_view ignores high_dpi. MTKView sizes its drawable for the window's backing scale, and update_dimensions derives dpi_scale from that same scale, so on a Retina display high_dpi: false still renders at 2x, with a dpi_scale of 2. The OpenGL path honours it, through setWantsBestResolutionOpenGLSurface: NO.

This is the macOS side of #654, which does the same for iOS and tvOS. The two are independent.

Change

  • Without high DPI, the view no longer resizes its drawable itself (setAutoResizeDrawable:).
  • update_dimensions keeps dpi_scale at 1 and sizes the drawable in points, which the window scales up, as on the OpenGL path.
  • It compares against the drawable's current size rather than relying on dim_changed, since the first call, right after the view joins the window, usually finds the size Conf asked for already recorded.
  • high_dpi: true is unchanged.

Verification

  • On a Retina display (2x), a 300x200 window with high_dpi: false now reports a 300x200 screen at a dpi_scale of 1, instead of 600x400 at 2, and renders and reads back at that size. high_dpi: true is unchanged.
  • A macroquad game (CHOMP) records its frames on Metal with high_dpi: false, and gets frames the size of its 900x700 window.
  • cargo check passes for aarch64-apple-darwin, aarch64-apple-ios and aarch64-apple-tvos.

🤖 Generated with Claude Code

@benface
benface commented Oct 9, 2026
Copy link
Copy Markdown
Contributor Author

The Android check failed before it checked out the code: Docker Hub refused to pull the notfl3/cargo-apk image ("toomanyrequests: You have reached your unauthenticated pull rate limit"). It's unrelated to this change, and a re-run of the job should pass.

`create_metal_view` ignored `high_dpi`. `MTKView` sizes its drawable
for the window's backing scale, and `update_dimensions` derived
`dpi_scale` from that same scale, so `high_dpi: false` still rendered
at 2x on a Retina display, with a `dpi_scale` of 2.

Without high DPI, the view no longer resizes its drawable itself, and
`update_dimensions` keeps `dpi_scale` at 1 and sizes the drawable in
points, which the window scales up, as the OpenGL path does with
`setWantsBestResolutionOpenGLSurface: NO`. It compares against the
drawable's current size rather than relying on `dim_changed`, since
the first call, right after the view joins the window, usually finds
the size `Conf` asked for already recorded.

Verified on a Retina display: a 300x200 window with `high_dpi: false`
now reports a 300x200 screen at a `dpi_scale` of 1 instead of 600x400
at 2, and renders and reads back at that size. `high_dpi: true` is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
@benface
benface force-pushed the macos-metal-high-dpi branch from 90d97be to 73041bd Compare October 18, 2026 17:57
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.

1 participant

0