feat(vk): Fullscreen mode row: Auto, Borderless, Exclusive (Windows) #3247
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3247
Loading…
Reference in a new issue
No description provided.
Delete branch "tobim6/Longshot:feat-fullscreen-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On Windows with AMD's driver, borderless fullscreen is not composed by the desktop while the game is in front: PresentMon
shows Hardware: Legacy Flip (tearing allowed, sync interval 0) for the focused fullscreen window, and Composed: Copy
with GPU GDI as soon as another window has the focus. Desktop capture, such as Sunshine streaming to Moonlight or OBS,
stutters badly in that mode, only while the game is focused; a normal window, or the same fullscreen window unfocused, streams smoothly.
The game's own frame times are the same in both modes (RX 580, title screen at a 30 FPS cap: 33.3 ms between presents,
GPU busy ~10 ms), so it is the presentation path, not GPU load.
This adds a Fullscreen mode row to the Graphics tab (after Fullscreen monitor), read by the renderer from the
settings snapshot:
main.VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT: the window stays composed, so capture sees every frame.VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT, acquired after the chain is made while thewindow is fullscreen;
VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXTfrom an acquire or a present is handled as out ofdate (the chain is made again and takes it again).
Read first:
gpu/vk/vk_main.cpp(VK_KHR_get_surface_capabilities2on the instance,VK_EXT_full_screen_exclusiveonthe device, Windows only; the structs chained in
create_swapchainand the acquire after it),gpu/vk/vk_replay.cpp(
present_image's remake key now includes the row, and with Exclusive the window's fullscreen state; the threeMODE_LOST mappings). The row is
game/mods/graphics/mod.toml;game/settings_abi.handsettings_abi.rsareschema-gen's. Docs:
docs/dev/reference/fullscreen.md,docs/user/graphics-and-controls.md.Testing
Tested: Radeon RX 580 8 GB, AMD driver 23.10.01.14 (0x800106), Windows 11 build 26200, Xeon E5-2699 v3: Graphics > Fullscreen mode > Borderless, borderless fullscreen with the window focused, streamed with Sunshine to Moonlight on a Nintendo Switch. On main the stream lagged badly only while the fullscreen game was focused (PresentMon: Hardware: Legacy Flip); with Borderless it streams smoothly, like a normal window. With the review's fixes, Exclusive: Exclusive, fullscreen: PresentMon Hardware: Legacy Flip; Alt+Tab away and back: taken again (log: exclusive fullscreen taken), no crash
Checks (game-free):
schema-gen --check;tests/test_menu_ini_keys.py,test_i18n_complete.py,test_menu_i18n.py,test_translation_pools.py,test_not_translated_counts.py,test_vsync_row.py,test_rt_pin.py,test_framegen_fixed_pace.py,test_pacing_policy.py,test_fullscreen_monitor_menu.py,test_fullscreen_monitor_platform.py,test_vk_swapchain_compat.pypass.vk_main.cppandvk_replay.cppcompile(syntax) for
x86_64-w64-windows-gnuwith tools.lock's llvm-mingw headers and LLVM 23, and for Linux; the whole treebuilt on Windows by the builder for the in-game test above. The full suite: CI's
testsjob on this PR.Still to test:
host/fullscreen_style.h's 9070 XT note) (by hand)Measurements
Nothing to measure: Auto, the default, makes the same swapchain as
main; Borderless and Exclusive are the player's choice.Risks
without the extension logs it once and behaves as Auto.
fullscreen_mode, in the graphics table ofsettings.toml;LS_SETTINGS_LAYOUTchanges(schema-gen). Revert is enough to undo.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (CI'stestsjob: ticked once it passes)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened. (test_menu_ini_keys.py: the new key in FROZEN)mainand here, for a change that shows on screen. (the new row, in a comment;mainhas no such row)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Radeon RX 580 8 GB, AMD driver 23.10.01.14 (0x800106), Windows 11 build 26200, Xeon E5-2699 v3: Graphics > Fullscreen mode > Borderless, borderless fullscreen with the window focused, streamed with Sunshine to Moonlight on a Nintendo Switch. On main the stream lagged badly only while the fullscreen game was focused (PresentMon: Hardware: Legacy Flip); with Borderless it streams smoothly, like a normal window.
The new row: Graphics > Screen > Fullscreen mode (Auto, Borderless, Exclusive).
@review
WIP: feat(vk): Fullscreen mode row: Auto, Borderless, Exclusive (Windows)to feat(vk): Fullscreen mode row: Auto, Borderless, Exclusive (Windows)Recommendation: Request changes. Borderless improved the reported stream on one RX 580, but Exclusive can fail to return after focus is restored, and the new fullscreen-state read is unsynchronized. The affected presentation paths also need broader in-game testing.
Adds a Windows fullscreen presentation choice intended to keep desktop capture smooth, plus an application-controlled exclusive mode. It adds swapchain recreation and focus recovery complexity; the default remains Auto.
Blocking (2): must change before merging.
gpu/vk/vk_main.cpp:1524: Exclusive acquisition is attempted only when a swapchain is created, so a failed attempt is never retried when the window regains focus. (more on the line) Do: Track focus and exclusive ownership, and retry acquisition when a fullscreen window regains focus; handle failure without repeatedly rebuilding the chain.gpu/vk/vk_replay.cpp:7177: The new recreation key reads the plainopts.fullscreenconcurrently with settings and fullscreen updates. (more on the line) Do: Publish the actual fullscreen state through an atomic or a shared lock and use that synchronized value for both the recreation key and exclusive acquisition.Should fix (1): not blocking, but worth doing before merging.
gpu/vk/vk_replay.cpp:7177: The Windows-only setting changes the swapchain recreation key on Linux too. (more on the line) Do: Exclude the fullscreen-mode key from swapchain recreation on platforms where the setting is unsupported.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_main.cpp:1476: The new Windows presentation paths have only been exercised on an RX 580 in Borderless mode. (more on the line) Do: Run Borderless and Exclusive on Windows NVIDIA and AMD RX 6000–9000, including fullscreen entry, Alt+Tab away and back, and capture; record the observed presentation and recovery.gpu/vk/vk_main.cpp:1477: The cost of forcing composed presentation has not been measured in the game. (more on the line) Do: On the affected Windows setup, compare Auto and Borderless with repeated interleaved runs in the same scene and settings, reporting frame times and 1% lows alongside capture behavior.@fixcan do L1, L2 and L3.Questions (1) (not confirmed from the code; they don't hold the recommendation)
gpu/vk/vk_main.cpp:1473: Does the repository's fix-with-test rule apply to this selectable workaround for driver presentation behavior?Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported capture problem on one RX 580: the author reports a smooth Sunshine stream with Borderless where main stuttered. Exclusive has no reported successful run, and the effect on game frame pacing has not been measured.
Other systems: The extension is enabled on Windows even in Auto, and the new recreation key also runs on Linux. NVIDIA, newer AMD hardware, Intel, Steam Deck, frame generation, HDR and focus transitions have no reported coverage for this change.
Switches: No environment switch added. The new saved Fullscreen mode setting defaults to Auto, preserving the prior swapchain choice; Borderless and Exclusive are opt-in. Linux displays the row despite having no implementation.
Reviewed:
893956b44aagainst7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards and relevant fullscreen and screenshot rules; reviewed the diff, commit, changed settings declarations and renderer paths around swapchain creation, presentation and settings publication. Skimmed translations and generated ABI changes. The large renderer and generated settings files were not read in full; docs/review-checklist.md was absent. The screenshot attachment and Tooling repository were unavailable in the checkout.; nothing run (a code review).Checked and fine:
Testing: No commands from the project, builds or tests were run, as required for this review. The author reports an in-game RX 580 Borderless test and game-free checks; CI is still running.
Overlaps and merge order: Not checked; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -1459,0 +1473,4 @@const int fse_mode = settings_now().fullscreen_mode;VkSurfaceFullScreenExclusiveInfoEXT fse{VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT};VkSurfaceFullScreenExclusiveWin32InfoEXT fse_win{VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT};if (fse_device && (fse_mode == 1 || fse_mode == 2) && app_window()) {L4 (should fix): The new Windows presentation paths have only been exercised on an RX 580 in Borderless mode.
When: Players on NVIDIA or newer AMD drivers can select either new mode, and Exclusive must survive focus changes; no run shows those paths working on the affected Tier 1 hardware.
Do: Run Borderless and Exclusive on Windows NVIDIA and AMD RX 6000–9000, including fullscreen entry, Alt+Tab away and back, and capture; record the observed presentation and recovery.
@ -1459,0 +1474,4 @@VkSurfaceFullScreenExclusiveInfoEXT fse{VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT};VkSurfaceFullScreenExclusiveWin32InfoEXT fse_win{VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT};if (fse_device && (fse_mode == 1 || fse_mode == 2) && app_window()) {fse.fullScreenExclusive = fse_mode == 1 ? VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT : VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT;L5 (should fix): The cost of forcing composed presentation has not been measured in the game.
When: A player choosing Borderless changes the presentation path and may incur different frame pacing or latency; the reported 33.3 ms figures describe the original focus states, not repeated comparisons of this setting against Auto.
Do: On the affected Windows setup, compare Auto and Borderless with repeated interleaved runs in the same scene and settings, reporting frame times and 1% lows alongside capture behavior.
@ -1496,2 +1521,4 @@dev.swap_spare = n > caps.minImageCount ? n - caps.minImageCount : 0;dev.swap_slots = slots_made;#ifdef _WIN32if (fse_device && fse_mode == 2 && opts.fullscreen) {L1 (blocking): Exclusive acquisition is attempted only when a swapchain is created, so a failed attempt is never retried when the window regains focus.
When: After Alt+Tab causes exclusive mode to be lost, the lost result remakes the chain while the game is unfocused. If the driver refuses acquisition then, the new chain remains windowed and returning focus does not change the fullscreen setting or trigger another acquisition.
Do: Track focus and exclusive ownership, and retry acquisition when a fullscreen window regains focus; handle failure without repeatedly rebuilding the chain.
@ -7174,2 +7174,4 @@// saved value past it)const int framegen = framegen_now();// (and the Fullscreen mode row; with Exclusive, the window going in or out of fullscreen: taken or given back)const int fse_key = settings_now().fullscreen_mode == 2 ? 4 + (opts.fullscreen ? 1 : 0) : settings_now().fullscreen_mode;L2 (blocking): The new recreation key reads the plain
opts.fullscreenconcurrently with settings and fullscreen updates.When: With frame generation,
display_maincallspresent_imageon its own thread whilemenu_settings_applycan writeopts.fullscreenthrough the display applier. The read and write have no common lock or atomic synchronization, producing a data race when fullscreen changes.Do: Publish the actual fullscreen state through an atomic or a shared lock and use that synchronized value for both the recreation key and exclusive acquisition.
L3 (should fix): The Windows-only setting changes the swapchain recreation key on Linux too.
When: A Linux player changes Fullscreen mode:
vsync_changedbecomes true and recreates the swapchain even though Linux never chains the exclusive-mode structures. This can interrupt presentation despite the documented claim that the row changes nothing there.Do: Exclude the fullscreen-mode key from swapchain recreation on platforms where the setting is unsupported.
Thanks. The three code points are fixed in the second commit (
fix(vk): Fullscreen mode: Exclusive taken again after Alt+Tab, window state read from Windows):present_image's remake key now carries, with Exclusive, whether the window is fullscreen and in front (fullscreen_mode_key()). Coming back to the front changes it once: the chain is made again and takes exclusive mode again. It is asked only while the window is fullscreen and in front (Windows refuses it to a window behind another), and nothing is remade while nothing changes, so a refused acquire doesn't loop.opts.fullscreenread): true. The key and the acquire no longer readopts.fullscreen: they ask Windows itself (GetForegroundWindow, the window's style,HOS_FS_FRAMED_PROP), the same rule asfullscreen_tick(hos_fullscreen_shown), so nothing is shared between the menu's and the present's threads. It is also the window's actual state, not the row's wish.fullscreen_mode_key()is 0 elsewhere than Windows, so the row never remakes the chain there.main, so the default costs nothing; Borderless's cost is the composition's, which is the point of the choice.The
vk_main.cppandvk_replay.cppchanges compile (syntax) for Windows (llvm-mingw, LLVM 23) and Linux; the related checks (test_vsync_row,test_rt_pin,test_framegen_fixed_pace,test_pacing_policy,test_fullscreen_monitor_*,test_vk_swapchain_compat,test_menu_ini_keys,test_i18n_complete) pass. In game, after these fixes: Exclusive, fullscreen: PresentMon Hardware: Legacy Flip; Alt+Tab away and back: taken again (log: exclusive fullscreen taken), no crash@review
Recommendation: Approve. The code is ready: only testing is left. Borderless streaming and Exclusive reacquisition worked on the tested RX 580, and the code fixes the three recorded defects. The other Windows driver runs and the cost of composed presentation remain unmeasured. Recommend approval; not approved on the forge.
Adds Windows fullscreen presentation choices, with Auto preserving the existing default. Borderless improved the reported streaming case; Exclusive now retries after focus returns, at the cost of additional swapchain recreations on focus changes.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_main.cpp:1476: The new Windows presentation paths have only been exercised on an RX 580 in Borderless mode. When: Players on NVIDIA or newer AMD drivers can select either new mode, and Exclusive must survive focus changes; no run shows those paths working on the affected Tier 1 hardware. Do: Run Borderless and Exclusive on Windows NVIDIA and AMD RX 6000–9000, including fullscreen entry, Alt+Tab away and back, and capture; record the observed presentation and recovery.gpu/vk/vk_main.cpp:1477: The cost of forcing composed presentation has not been measured in the game. When: A player choosing Borderless changes the presentation path and may incur different frame pacing or latency; the reported 33.3 ms figures describe the original focus states, not repeated comparisons of this setting against Auto. Do: On the affected Windows setup, compare Auto and Borderless with repeated interleaved runs in the same scene and settings, reporting frame times and 1% lows alongside capture behavior.Since the last review (on
893956b44a)Resolved: L1 (Exclusive acquisition is attempted only when a swapchain is created, so a failed attempt i…); L2 (The new recreation key reads the plain
opts.fullscreenconcurrently with settings and fu…); L3 (The Windows-only setting changes the swapchain recreation key on Linux too.)Still open: L4 (The new Windows presentation paths have only been exercised on an RX 580 in Borderless mod…); L5 (The cost of forcing composed presentation has not been measured in the game.)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported streaming case: the author reports smooth Sunshine streaming with Borderless versus severe stutter on main on an RX 580. The performance cost of composition has not been measured.
Other systems: Linux returns a constant recreation key and does not apply the Windows modes. NVIDIA, Intel Arc and AMD RDNA presentation paths remain untested; CI is still running.
Switches: Adds the Fullscreen mode setting: Auto by default, Borderless and Exclusive are opt-in. Auto retains the driver's existing choice, which is an appropriate default.
Reviewed:
863e8288b6against7bc53f8413: Read the repository's AGENTS.md and CONTRIBUTING.md, the full diff for the renderer, settings, menu, documentation and key test, and the fix diff. Skimmed translation and generated-file changes; the large changed renderer files were read around the changes and relevant callers, not in full. The pull request template and other referenced standards were not read.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports Windows in-game testing and Windows and Linux syntax compilation; all listed CI jobs are still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@rebase
I rebased this pull request onto
main(b6330a5b0b): the new head is2610c1f2ab.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
863e8288b62610c1f2abRecommendation: Approve. The code is ready: only testing is left. Borderless improved the reported stream on the RX 580, and Exclusive survived an Alt+Tab in that test. Other Windows driver paths and the in-game cost of composition remain unmeasured. Recommend approval; not approved on the forge.
The Graphics menu adds Windows fullscreen presentation choices to help capture software receive smooth frames. Auto preserves the previous choice; the added modes introduce driver-specific behavior and an opt-in composition cost.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_main.cpp:1476: The new Windows presentation paths have only been exercised on an RX 580 in Borderless mode. When: Players on NVIDIA or newer AMD drivers can select either new mode, and Exclusive must survive focus changes; no run shows those paths working on the affected Tier 1 hardware. Do: Run Borderless and Exclusive on Windows NVIDIA and AMD RX 6000–9000, including fullscreen entry, Alt+Tab away and back, and capture; record the observed presentation and recovery.gpu/vk/vk_main.cpp:1477: The cost of forcing composed presentation has not been measured in the game. When: A player choosing Borderless changes the presentation path and may incur different frame pacing or latency; the reported 33.3 ms figures describe the original focus states, not repeated comparisons of this setting against Auto. Do: On the affected Windows setup, compare Auto and Borderless with repeated interleaved runs in the same scene and settings, reporting frame times and 1% lows alongside capture behavior.Since the last review (on
863e8288b6)Still open: L4 (The new Windows presentation paths have only been exercised on an RX 580 in Borderless mod…); L5 (The cost of forcing composed presentation has not been measured in the game.)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported capture problem on the RX 580: the author reports smooth Sunshine streaming with Borderless where Auto stuttered. The reported title-screen presents were 33.3 ms with roughly 10 ms GPU busy, but the cost of Borderless against Auto has not been measured.
Other systems: Windows NVIDIA, Intel Arc and AMD RDNA presentation paths still need the listed runs. Linux returns a constant mode key and does not apply the Windows extension; no Linux game run is reported.
Switches: Fullscreen mode adds Auto, Borderless and Exclusive, defaulting to Auto. Auto retains the prior swapchain choice and is an appropriate default; the other choices are opt-in.
Reviewed:
2610c1f2abagainstb6330a5b0b: Read the base-to-head diff, commit list, AGENTS.md, CONTRIBUTING.md, the changed declarations and settings ABI excerpts, and the fullscreen-mode references. Skimmed translations and generated settings files; the full changed renderer files, remaining repository rules and template were not read in full.; nothing run (a code review).Checked and fine:
Testing: The author reports an RX 580 Windows game run, an Exclusive Alt+Tab recovery, game-free checks, Windows and Linux syntax compilation, and a Windows build. CI checks are still running; no commands or tests were run for this review.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.