Repository navigation
feat(window): exclusive fullscreen option - #156
Conversation
GameSystem.Window.ExclusiveFullscreen requests ExclusiveFullScreen instead of FullScreenWindow when not windowed. With the game rendering on the GPU that drives the display and Windows fullscreen optimizations disabled for Sinmai.exe, frames are presented by legacy flip instead of desktop composition: on a measured setup this removed about 1.6 F of visual lag and its whole-frame variation. Without those two Windows settings, Windows emulates the request as a composed flip window, which is slower than the default. The game minimizes when it loses focus.
审查者指南(小型 PR 中折叠显示)审查者指南新增可选的 独占全屏分辨率设置流程图flowchart TD
A[Window mode configuration] --> B{Game is windowed?}
B -->|Yes| C[Keep windowed behavior]
B -->|No| D{exclusiveFullscreen enabled?}
D -->|No| E[Screen.SetResolution with FullScreenWindow]
D -->|Yes| F[Screen.SetResolution with ExclusiveFullScreen]
文件级变更
提示和命令与 Sourcery 交互
自定义使用体验访问你的 控制面板:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideAdds an opt-in Flow diagram for exclusive fullscreen resolution setupflowchart TD
A[Window mode configuration] --> B{Game is windowed?}
B -->|Yes| C[Keep windowed behavior]
B -->|No| D{exclusiveFullscreen enabled?}
D -->|No| E[Screen.SetResolution with FullScreenWindow]
D -->|Yes| F[Screen.SetResolution with ExclusiveFullScreen]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="AquaMai.Mods/GameSystem/Window.cs">
<violation number="1" location="AquaMai.Mods/GameSystem/Window.cs:104">
P2: Vulkan 图形 API 不支持 `FullScreenMode.ExclusiveFullScreen`,Unity 会静默回退为 `FullScreenMode.FullScreenWindow`,因此启用该选项时并不一定得到独占全屏。请检测 `SystemInfo.graphicsDeviceType`,在 Vulkan 下明确回退并记录警告,或在配置说明中注明该限制。</violation>
</file>
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
| var width = Window.width == 0 ? Display.main.systemWidth : Window.width; | ||
| var height = Window.height == 0 ? Display.main.systemHeight : Window.height; | ||
| Screen.SetResolution(width, height, FullScreenMode.FullScreenWindow); | ||
| Screen.SetResolution(width, height, exclusiveFullscreen ? FullScreenMode.ExclusiveFullScreen : FullScreenMode.FullScreenWindow); |
There was a problem hiding this comment.
P2: Vulkan 图形 API 不支持 FullScreenMode.ExclusiveFullScreen,Unity 会静默回退为 FullScreenMode.FullScreenWindow,因此启用该选项时并不一定得到独占全屏。请检测 SystemInfo.graphicsDeviceType,在 Vulkan 下明确回退并记录警告,或在配置说明中注明该限制。
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At AquaMai.Mods/GameSystem/Window.cs, line 104:
<comment>Vulkan 图形 API 不支持 `FullScreenMode.ExclusiveFullScreen`,Unity 会静默回退为 `FullScreenMode.FullScreenWindow`,因此启用该选项时并不一定得到独占全屏。请检测 `SystemInfo.graphicsDeviceType`,在 Vulkan 下明确回退并记录警告,或在配置说明中注明该限制。</comment>
<file context>
@@ -85,7 +101,7 @@ public static void OnBeforePatch()
var width = Window.width == 0 ? Display.main.systemWidth : Window.width;
var height = Window.height == 0 ? Display.main.systemHeight : Window.height;
- Screen.SetResolution(width, height, FullScreenMode.FullScreenWindow);
+ Screen.SetResolution(width, height, exclusiveFullscreen ? FullScreenMode.ExclusiveFullScreen : FullScreenMode.FullScreenWindow);
}
}
</file context>
|
LGTM |
Adds
GameSystem.Window.ExclusiveFullscreen(defaultfalse). When the game isn't windowed, it requestsFullScreenMode.ExclusiveFullScreeninstead ofFullScreenWindowin the existingScreen.SetResolutioncall. Nothing changes when the option is off.Why
The stock fullscreen window is composed by DWM every frame. On my setup (PresentMon:
Composed: Copy with GPU GDI), that costs extra visual lag. Worse, the lag isn't stable: it jumps by a whole frame and drifts slowly. True exclusive fullscreen presents withHardware: Legacy Flip, so the lag is steady.Measured on a laptop (Intel iGPU driving a 1080p60 HDMI monitor rotated 90°, RTX 4070 also present). Feedback-hidden, muted sight-tapping passes at fixed judge B, alternating window / exclusive / window:
That's about 1.6 F (27 ms) less visual lag. In exclusive mode PresentMon showed no irregular frame intervals and no phase drift.
Requirements and caveats (in the option's description)
Composed: Flipwindow, which measured slower than the default window here (about 61 ms vs 50 ms frame start → scanout).Tested in game on SDEZ 1.70.
checkSort.pypasses.新增
GameSystem.Window.ExclusiveFullscreen(默认false):非窗口模式下,Screen.SetResolution改用FullScreenMode.ExclusiveFullScreen而不是FullScreenWindow。关闭时行为不变。原因: 默认的全屏窗口每帧经过 DWM 合成,显示延迟更高,而且不稳定,会整帧跳变并缓慢漂移。真正的独占全屏(PresentMon 显示
Hardware: Legacy Flip)延迟稳定。在一台笔记本(Intel 核显驱动 HDMI 显示器)上交替测试“窗口 / 独占 / 窗口”,独占模式的视觉延迟约低 1.6 帧(27 ms)。要求:
Composed: Flip)模拟独占全屏,延迟反而比默认更高。Sourcery 总结
新功能:
Original summary in English
Summary by Sourcery
New Features: