From 1d8424e207a393687e43c4ab6868e6b3927269cd Mon Sep 17 00:00:00 2001 From: Cliff Smolinsky <40178962+kliffy542@users.noreply.github.com> Date: Tue, 19 Mar 2019 09:22:59 -0700 Subject: [PATCH] Bypass DwmIsCompositionEnabled checks on Win8+. DWM composition is always enabled on Win8+, so there's no need to call DwmIsCompositionEnabled on those platforms. --- src/wgl_context.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/wgl_context.c b/src/wgl_context.c index b3e0303cd..85ea91053 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -321,10 +321,15 @@ static void swapBuffersWGL(_GLFWwindow* window) { if (IsWindowsVistaOrGreater()) { - BOOL enabled; + BOOL enabled = FALSE; + + // DWM Composition is always enabled on Win8+ + if (IsWindows8OrGreater()) + enabled = TRUE; // HACK: Use DwmFlush when desktop composition is enabled - if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) + if (enabled || + (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)) { int count = abs(window->context.wgl.interval); while (count--) @@ -346,11 +351,16 @@ static void swapIntervalWGL(int interval) { if (IsWindowsVistaOrGreater()) { - BOOL enabled; + BOOL enabled = FALSE; + + // DWM Composition is always enabled on Win8+ + if (IsWindows8OrGreater()) + enabled = TRUE; // HACK: Disable WGL swap interval when desktop composition is enabled to // avoid interfering with DWM vsync - if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) + if (enabled || + (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)) interval = 0; } }