Android: render at the screen's native height (900-1080), 3D target kept 720 high

UI and text now reach the screen 1:1 instead of through a 1.2x linear
upscale. The 3D scale on Android is derived from a 720-high target and
the two dynamic levels follow proportionally (720 -> 648 -> 630).
DM_3D_SCALE still sets an absolute scale. OnePlus 13: 2376x1080 output,
GPU 12.1 -> 11.9 ms/frame, 60 fps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-14 16:54:51 +09:00
co-authored by Claude Opus 5.5
parent 3076dc4a69
commit 3429c6c0a4
2 changed files with 33 additions and 7 deletions
+7 -3
View File
@@ -71,14 +71,18 @@ void front_run(void (*guest)(void)) {
}
// 只当「有窗口」标志用(hle_swkbd 据此决定弹不弹输入框)| Used only as a "has a window" flag (hle_swkbd decides from it whether to show the input box)
void *front_metal_layer(void) { return (void *)(uintptr_t)1; }
// 主机档:原版高度 900 × 屏幕比例(宽取 8 的倍数,≤ 4096);掌机档 720 同比。比 16:9 窄的屏按 16:9。DM_GAME_RES=宽x高 覆盖
// Docked profile: the original height 900 × the screen aspect ratio (width rounded to a multiple of 8, ≤ 4096); handheld uses 720 the same way. Screens narrower than 16:9 use 16:9. DM_GAME_RES=WxH overrides
// 主机档:屏幕原生高(夹在 900–1080)× 屏幕比例(宽取 8 的倍数,≤ 4096);掌机档 720 同比。比 16:9 窄的屏按 16:9。DM_GAME_RES=宽x高 覆盖
// Docked profile: the screen's native height (clamped to 900–1080) × the screen aspect ratio (width rounded to a multiple of 8, ≤ 4096); handheld uses 720 the same way. Screens narrower than 16:9 use 16:9. DM_GAME_RES=WxH overrides
uint64_t front_game_res(int docked) {
unsigned w, h; const char *e = getenv("DM_GAME_RES");
if (e && sscanf(e, "%ux%u", &w, &h) == 2) return docked ? (uint64_t)h << 32 | w : (uint64_t)(h * 4 / 5) << 32 | (w * 4 / 5 + 3) / 4 * 4;
double aspect = g_screen_w && g_screen_h ? (double)g_screen_w / g_screen_h : 16.0 / 9;
if (aspect < 16.0 / 9) aspect = 16.0 / 9;
uint64_t hh = docked ? 900 : 720, ww = (uint64_t)llround(hh * aspect / 8) * 8;
// 主机档按屏幕原生高(900–1080 之间):界面与文字 1:1 上屏,不再经 1.2 倍线性放大发糊;3D 目标仍按 720 高(hle_oe.c),GPU 不变(OnePlus 13 实测 12.1 → 12.0 ms/帧)。
// 上限 1080:2K 屏(1440 高)界面多画 78% 像素,换来的清晰度看不出
// Docked uses the screen's native height (between 900 and 1080): UI and text go to the screen 1:1 instead of a blurry 1.2x linear upscale; the 3D target stays 720 high (hle_oe.c), GPU unchanged (OnePlus 13 measured 12.1 -> 12.0 ms/frame).
// Capped at 1080: on 2K screens (1440 high) the UI would draw 78% more pixels for sharpness nobody can see
uint64_t sh = g_screen_h < 900 ? 900 : g_screen_h > 1080 ? 1080 : g_screen_h, hh = docked ? sh : 720, ww = (uint64_t)llround(hh * aspect / 8) * 8;
if (ww > 4096) ww = 4096;
return hh << 32 | ww;
}