1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 12:18:51 -05:00

Added forcing of swap interval on DWM composition.

This commit is contained in:
Camilla Berglund 2013-07-07 23:29:13 +02:00
parent 0e12fb869c
commit 1c80e99008
4 changed files with 18 additions and 0 deletions

View File

@ -16,6 +16,10 @@ option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
option(GLFW_INSTALL "Generate installation target" ON)
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
if (WIN32)
option(GLFW_USE_DWM_SWAP_INTERVAL "Set swap interval even when DWM compositing is enabled" OFF)
endif()
if (APPLE)
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
option(GLFW_USE_CHDIR "Make glfwInit chdir to Contents/Resources" ON)
@ -151,6 +155,10 @@ if (_GLFW_WIN32)
set(_GLFW_NO_DLOAD_WINMM 1)
list(APPEND glfw_LIBRARIES winmm)
endif()
if (GLFW_USE_DWM_SWAP_INTERVAL)
set(_GLFW_USE_DWM_SWAP_INTERVAL 1)
endif()
endif()
#--------------------------------------------------------------------

View File

@ -72,6 +72,10 @@ directory of bundled applications to the `Contents/Resources` directory.
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version or the
static library version of the Visual C++ runtime library.
`GLFW_USE_DWM_SWAP_INTERVAL` determines whether the swap interval is set even
when DWM compositing is enabled. This can lead to severe jitter and is not
usually recommended.
#### EGL specific options
@ -101,6 +105,8 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/).
- Bugfix: The `-Wall` flag was not used with Clang and other GCC compatibles
- Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero
- [Win32] Added `_GLFW_USE_DWM_SWAP_INTERVAL` for forcing the swap interval
to be set even when DWM compositing is enabled
- [Win32] Bugfix: The clipboard string was not freed on terminate
- [Win32] Bugfix: Entry points for OpenGL 1.0 and 1.1 functions were not
returned by `glfwGetProcAddress`

View File

@ -56,6 +56,8 @@
// Define this to 1 to disable dynamic loading of winmm
#cmakedefine _GLFW_NO_DLOAD_WINMM
// Define this to 1 if glfwSwapInterval should ignore DWM compositing status
#cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL
// Define this to 1 if glXGetProcAddress is available
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS

View File

@ -600,12 +600,14 @@ void _glfwPlatformSwapInterval(int interval)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
if (_glfwIsCompositionEnabled())
{
// Don't enabled vsync when desktop compositing is enabled, as it leads
// to frame jitter
return;
}
#endif
if (window->wgl.EXT_swap_control)
window->wgl.SwapIntervalEXT(interval);