diff --git a/readme.html b/readme.html index faf6a52e..b854a59c 100644 --- a/readme.html +++ b/readme.html @@ -335,7 +335,7 @@ version of GLFW.

  • [Cocoa] Bugfix: The cursor position incorrectly rounded during conversion
  • [Cocoa] Bugfix: Cursor positioning led to nonsensical results for fullscreen windows
  • [Cocoa] Bugfix: The GLFW window was flagged as restorable
  • -
  • [X11] Added support for the GLX_EXT_swap_control extension as an alternative to GLX_SGI_swap_control
  • +
  • [X11] Added support for the GLX_EXT_swap_control and GLX_MESA_swap_control extensions as alternatives to GLX_SGI_swap_control
  • [X11] Added the POSIX CLOCK_MONOTONIC time source as the preferred method
  • [X11] Added dependency on libm, where present
  • [X11] Added support for the _NET_WM_NAME and _NET_WM_ICON_NAME EWMH window properties
  • diff --git a/src/x11_opengl.c b/src/x11_opengl.c index dc2788c8..e39d858c 100644 --- a/src/x11_opengl.c +++ b/src/x11_opengl.c @@ -544,6 +544,15 @@ int _glfwInitOpenGL(void) _glfwLibrary.GLX.SGI_swap_control = GL_TRUE; } + if (_glfwPlatformExtensionSupported("GLX_MESA_swap_control")) + { + window->GLX.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC) + _glfwPlatformGetProcAddress("glXSwapIntervalMESA"); + + if (window->GLX.SwapIntervalMESA) + window->GLX.MESA_swap_control = GL_TRUE; + } + if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig")) { _glfwLibrary.GLX.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC) @@ -722,8 +731,13 @@ void _glfwPlatformSwapInterval(int interval) window->X11.handle, interval); } - else if (_glfwLibrary.GLX.SGI_swap_control) - _glfwLibrary.GLX.SwapIntervalSGI(interval); + else if (window->GLX.MESA_swap_control) + window->GLX.SwapIntervalMESA(interval); + else if (window->GLX.SGI_swap_control) + { + if (interval > 0) + window->GLX.SwapIntervalSGI(interval); + } } diff --git a/src/x11_platform.h b/src/x11_platform.h index f87287b1..39593655 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -97,6 +97,10 @@ #define _GLFW_CONVERSION_SUCCEEDED 1 #define _GLFW_CONVERSION_FAILED 2 +#ifndef GLX_MESA_swap_control +typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); +#endif + //======================================================================== // GLFW platform specific types @@ -242,6 +246,7 @@ typedef struct _GLFWlibraryGLX // GLX extensions PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; + PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX; PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX; PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX; @@ -250,6 +255,7 @@ typedef struct _GLFWlibraryGLX GLboolean SGIX_fbconfig; GLboolean SGI_swap_control; GLboolean EXT_swap_control; + GLboolean MESA_swap_control; GLboolean ARB_multisample; GLboolean ARB_create_context; GLboolean ARB_create_context_profile;