Closed ceski-1 closed 3 months ago
@MrAlaux Can you try this with your system? To make it easy, you can copy this text into a batch file and try alt+tabbing, then quitting, for each render driver:
Edit: make sure fullscreen and exclusive fullscreen are both enabled.
@MrAlaux Can you try this with your system?
All three of them work.
FWIW, D3D11 switches fastest, followed by D3D9 (if not the same, not sure), then OpenGL (definitely slower and flickers the screen more, probably takes twice as long as D3D11).
It works, but Alt-Tab is slower and there is flickering (default direct3d). To be honest, I prefer the old behaviour. Do we still need "Exclusive Fullscreen"? It seems that VRR works with borderless fullscreen?
Do we still need "Exclusive Fullscreen"? It seems that VRR works with borderless fullscreen?
My understanding is that VRR only works with the "flip" presentation model. We need exclusive fullscreen so that direct3d
and opengl
can use "flip", otherwise "gdi copy" is used instead. It seems "flip" is more performant and has less latency.
I'm not sure if exclusive fullscreen is needed for direct3d11
because the behavior is different for Windows 10 and 11 (only 11 has "optimizations for windowed games" which forces "flip"?).
direct3d12
doesn't need exclusive fullscreen because it doesn't use it. It just fakes exclusive fullscreen with a window.
You can check the presentation mode with PresentMon's overlay and see for yourself. The whole subject is complicated:
It works, but Alt-Tab is slower and there is flickering (default direct3d). To be honest, I prefer the old behaviour.
It should be a little faster now: https://github.com/fabiangreffrath/woof/compare/f29ed0f36f6857faeb02a8c64780e46f8781508d..1215b884e79d2d4b8fb9e1c58ac2504ce9a472d3
Instead of the entire window being destroyed and recreated, only the surface is recreated. Apparently a known issue with DirectX 9 in general, not just SDL, is that textures have to be reset when alt+tabbing with exclusive fullscreen. So there's no avoiding some kind of reset if you want to prevent this issue.
Here is my justification for this PR:
The alt+tab fix works for all Windows render drivers. It doesn't seem necessary for Linux and just makes switching back and forth slower there (OpenGL + Arch tested). Fixes https://github.com/fabiangreffrath/woof/issues/1752
OpenGL exclusive fullscreen didn't work right in Windows. It would just start minimized. Looking at the SDL behavior on launch, it fires off a bunch of window events during window/render creation that confuses the logic we have in Woof. There's no point in parsing those initial window events, so they're now flushed, which fixes the issue.
Since the initial events are flushed, the priority is just raised explicitly on launch. Some of the other calls were redundant, so they were removed.