mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
windows: prefer regular vsync instead of dwm flush syncs.
The latter can cause stuttering issues on some setups.
This commit is contained in:
@@ -106,6 +106,12 @@ Window::Window()
|
|||||||
|
|
||||||
// Make sure the screensaver doesn't activate by default.
|
// Make sure the screensaver doesn't activate by default.
|
||||||
setDisplaySleepEnabled(false);
|
setDisplaySleepEnabled(false);
|
||||||
|
|
||||||
|
#ifdef LOVE_WINDOWS
|
||||||
|
// Turned off by default, because it (ironically) causes stuttering issues
|
||||||
|
// on some setups. More investigation is needed before enabling it.
|
||||||
|
canUseDwmFlush = SDL_GetHintBoolean("LOVE_GRAPHICS_VSYNC_DWM", SDL_FALSE) != SDL_FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::~Window()
|
Window::~Window()
|
||||||
@@ -1458,7 +1464,7 @@ void Window::swapBuffers()
|
|||||||
// - DWM refreshes don't always match the refresh rate of the monitor the window is in (or the requested swap
|
// - DWM refreshes don't always match the refresh rate of the monitor the window is in (or the requested swap
|
||||||
// interval), so we only use it when they do match.
|
// interval), so we only use it when they do match.
|
||||||
// - The user may force GL vsync, and DwmFlush shouldn't be used together with GL vsync.
|
// - The user may force GL vsync, and DwmFlush shouldn't be used together with GL vsync.
|
||||||
if (!settings.fullscreen && swapInterval == 1)
|
if (canUseDwmFlush && !settings.fullscreen && swapInterval == 1)
|
||||||
{
|
{
|
||||||
// Desktop composition is always enabled in Windows 8+. But DwmIsCompositionEnabled won't always return true...
|
// Desktop composition is always enabled in Windows 8+. But DwmIsCompositionEnabled won't always return true...
|
||||||
// (see DwmIsCompositionEnabled docs).
|
// (see DwmIsCompositionEnabled docs).
|
||||||
|
|||||||
@@ -162,6 +162,10 @@ private:
|
|||||||
WindowSettings settings;
|
WindowSettings settings;
|
||||||
StrongRef<love::image::ImageData> icon;
|
StrongRef<love::image::ImageData> icon;
|
||||||
|
|
||||||
|
#ifdef LOVE_WINDOWS
|
||||||
|
bool canUseDwmFlush = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool open;
|
bool open;
|
||||||
|
|
||||||
bool mouseGrabbed;
|
bool mouseGrabbed;
|
||||||
|
|||||||
Reference in New Issue
Block a user