[PATCH] winex11: support GLX_MESA_swap_control for WGL_EXT_swap_control This patch allows disabling of vsync on MESA based drivers. Without this patch, we would use the broken GLX_SGI_swap_control extension, which doesn't support disabling vsync without GLX_EXT_swap_control.

Roderick Colenbrander thunderbird2k at gmail.com
Tue Sep 17 11:55:38 CDT 2013


---
 dlls/winex11.drv/opengl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 5ec33c8..e28302e 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -258,7 +258,8 @@ enum glx_swap_control_method
 {
     GLX_SWAP_CONTROL_NONE,
     GLX_SWAP_CONTROL_EXT,
-    GLX_SWAP_CONTROL_SGI
+    GLX_SWAP_CONTROL_SGI,
+    GLX_SWAP_CONTROL_MESA
 };

 /* X context to associate a struct gl_drawable to an hwnd */
@@ -404,6 +405,7 @@ static void  (*pglXFreeMemoryNV)(GLvoid *pointer);

 /* MESA GLX Extensions */
 static void (*pglXCopySubBufferMESA)(Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height);
+static int (*pglXSwapIntervalMESA)(unsigned int interval);

 /* Standard OpenGL */
 static void (*pglFinish)(void);
@@ -650,6 +652,8 @@ static BOOL has_opengl(void)
     LOAD_FUNCPTR(glXCreateContextAttribsARB);
     /* EXT GLX Extension */
     LOAD_FUNCPTR(glXSwapIntervalEXT);
+    /* MESA GLX Extension */
+    LOAD_FUNCPTR(glXSwapIntervalMESA);
     /* SGI GLX Extension */
     LOAD_FUNCPTR(glXSwapIntervalSGI);
     /* NV GLX Extension */
@@ -2963,6 +2967,10 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval)
         ret = !X11DRV_check_error();
         break;

+    case GLX_SWAP_CONTROL_MESA:
+        ret = !pglXSwapIntervalMESA(interval);
+        break;
+
     case GLX_SWAP_CONTROL_SGI:
         /* wglSwapIntervalEXT considers an interval value of zero to mean
that
          * vsync should be disabled, but glXSwapIntervalSGI considers such
a
@@ -3146,6 +3154,10 @@ static void X11DRV_WineGL_LoadExtensions(void)
             has_swap_control_tear = TRUE;
         }
     }
+    else if (has_extension( WineGLInfo.glxExtensions,
"GLX_MESA_swap_control"))
+    {
+        swap_control_method = GLX_SWAP_CONTROL_MESA;
+    }
     else if (has_extension( WineGLInfo.glxExtensions,
"GLX_SGI_swap_control"))
     {
         swap_control_method = GLX_SWAP_CONTROL_SGI;
--
1.8.3.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130917/8a48562d/attachment.html>


More information about the wine-patches mailing list