Repository navigation
Conversation
…and coordinates Wayland windows previously defaulted `window.high_dpi` to false, so the compositor upscaled a logical-size framebuffer. Android `DisplayMetrics`, `Configuration`, `InitParams`, `PlatformParams`, and `AConfiguration` also hardcoded density 1.0 (160 dpi) and passed physical pixel sizes as dp, while `SurfaceCoordinateTransform` and `RobloxTextOverlayViewport` divided pointer and TextBox coordinates by `density_scale`. - Default `window.high_dpi` and `WindowOptions::high_pixel_density` to true while keeping `window.high_dpi: false` as an opt-out. - Derive `dpi_scale` / `density_scale` from `pixel_width / logical_width` so Wayland HiDPI uses the surface pixel density while X11 and `high_dpi: false` stay at 1.0. - Propagate the measured surface scale into `DisplayMetrics`, `Configuration`, `NativeHelper`, `InitParams`, `PlatformParams`, `StartGameParams`, and `AConfiguration_getScreenWidthDp`/`HeightDp` before engine initialization. - Map `SurfaceCoordinateTransform` and `RobloxTextOverlayViewport` between SDL logical coordinates and physical surface pixels without dividing by `density_scale`. Verified on 3840x2160 scale 2 (Wayland, direct-vulkan): framebuffer and Vulkan swapchain moved from 1920x1080 (density 1) to 3840x2160 (density 2) with unchanged six-column UI layout, and 131/131 targeted unit tests pass. Co-authored-by: theGreatGreenstar <145512144+thegreatGreenstar@users.noreply.github.com>
|
While MAYBE HiDPI support off by default would make sense in say... 2021, it's 2026 and 1440p and even 4k are FAR more accessible and widely used, as well as more nonstandard DPI on laptops. Due to this, HiDPI should be the default and work out of the box. There is no excuse to not support it. |
This branch has not been deployed
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.
Enables HiDPI rendering by default and aligns Android display density and input/text-overlay coordinate transforms with the physical surface resolution.
Summary
window.high_dpi(RuntimeConfig, shipped example config, andWindowOptions::high_pixel_density) totrueso SDL creates windows withSDL_WINDOW_HIGH_PIXEL_DENSITY.window.high_dpi: falseremains available as an opt-out.dpi_scale/density_scalefrompixel_width / logical_widthinwindow.cc,sdl_event_converter.cc, andwindow_text_input_owner.cc. Wayland HiDPI surfaces report their actual pixel density (for example2.0at 2x), while X11 andhigh_dpi: falsestay at1.0.MOCKTAIL_DISPLAY_SCALE_INTERNALwhen the window initializes and use it to populateDisplayMetrics(density,scaledDensity,densityDpi,xdpi,ydpi),Configuration(densityDpi,screenWidthDp,screenHeightDp,smallestScreenWidthDp),NativeHelper,InitParams,PlatformParams(densityDpi,viewportWidthMm,viewportHeightMm,dpiScale),StartGameParams, andAConfiguration_getScreenWidthDp/AConfiguration_getScreenHeightDp.SurfaceCoordinateTransformandRobloxTextOverlayViewportto map between SDL logical window coordinates and Roblox's physical surface pixel space (pixel_width / logical_width) instead of dividing bydensity_scale.Measured
Tested on Wayland (
direct-vulkan) at both 3840x2160 scale 2 and a virtualkwin_wayland2880x1620 output at fractional scale 1.5:MOCKTAIL_WIN_HIGH_DPI=0, 4K 2x)MOCKTAIL_WIN_HIGH_DPI=1, 4K 2x)MOCKTAIL_WIN_HIGH_DPI=1, 1620p 1.5x)1:1 crops of the Roblox logo:
Before (
MOCKTAIL_WIN_HIGH_DPI=0, 3840x2160 output at scale 2):After (
MOCKTAIL_WIN_HIGH_DPI=1, 3840x2160 output at scale 2):After (
MOCKTAIL_WIN_HIGH_DPI=1, virtualkwin_wayland2880x1620 output at fractional scale 1.5):Testing
cmake --build build -j16 --target roblox_input_router_test mocktailctest --test-dir build --output-on-failure -R "RuntimeConfig|RobloxInputRouter|SurfaceCoordinateTransform|RobloxTextDisplayState|WindowCreationPolicy|WindowTextInputOwner"(131/131 passed)git diff --check(clean)direct-vulkanlaunch verified interactively at 3840x2160 scale 2.