Use DwmFlush when DWM is enabled.

Use DwmFlush instead of WGL_EXT_swap_control when desktop compositing is
enabled, to avoid the jitter of DWM and WGL vsync fighting.

Fixes #516.
This commit is contained in:
Camilla Berglund
2015-05-21 14:48:11 +02:00
parent 22e9451192
commit 8309e0ecb0
10 changed files with 29 additions and 29 deletions
+14 -6
View File
@@ -570,6 +570,14 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
{
// HACK: Use DwmFlush when desktop composition is enabled
if (_glfwIsCompositionEnabled())
{
int count = window->wgl.interval;
while (count--)
_glfw_DwmFlush();
}
SwapBuffers(window->wgl.dc);
}
@@ -577,12 +585,12 @@ void _glfwPlatformSwapInterval(int interval)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
// HACK: Don't enabled vsync when desktop compositing is enabled, as it
// leads to severe frame jitter on some cards
if (_glfwIsCompositionEnabled() && interval)
return;
#endif
window->wgl.interval = interval;
// HACK: Disable WGL swap interval when desktop composition is enabled to
// avoid interfering with DWM vsync
if (_glfwIsCompositionEnabled())
interval = 0;
if (window->wgl.EXT_swap_control)
window->wgl.SwapIntervalEXT(interval);