Andrew Nguyen : winex11.drv: Enhance the wrapper functions for WGL_EXT_swap_control.

Alexandre Julliard julliard at winehq.org
Mon Dec 27 10:03:59 CST 2010


Module: wine
Branch: master
Commit: a7346e9fc85ae6bb27ebda494fa67bc5929d817f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a7346e9fc85ae6bb27ebda494fa67bc5929d817f

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Mon Dec 27 06:44:11 2010 -0600

winex11.drv: Enhance the wrapper functions for WGL_EXT_swap_control.

---

 dlls/winex11.drv/opengl.c |   44 ++++++++++++++++++++++++++++++++++++--------
 1 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 8ea7ddb..792bc13 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -505,9 +505,11 @@ static BOOL has_opengl(void)
 /* It doesn't matter if these fail. They'll only be used if the driver reports
    the associated extension is available (and if a driver reports the extension
    is available but fails to provide the functions, it's quite broken) */
-#define LOAD_FUNCPTR(f) p##f = (void*)pglXGetProcAddressARB((const unsigned char*)#f)
+#define LOAD_FUNCPTR(f) p##f = pglXGetProcAddressARB((const GLubyte *)#f)
     /* ARB GLX Extension */
     LOAD_FUNCPTR(glXCreateContextAttribsARB);
+    /* SGI GLX Extension */
+    LOAD_FUNCPTR(glXSwapIntervalSGI);
     /* NV GLX Extension */
     LOAD_FUNCPTR(glXAllocateMemoryNV);
     LOAD_FUNCPTR(glXFreeMemoryNV);
@@ -3400,7 +3402,9 @@ static const char * WINAPI X11DRV_wglGetExtensionsStringEXT(void) {
  * WGL_EXT_swap_control: wglGetSwapIntervalEXT
  */
 static int WINAPI X11DRV_wglGetSwapIntervalEXT(VOID) {
-    FIXME("(),stub!\n");
+    /* GLX_SGI_swap_control doesn't have any provisions for getting the swap
+     * interval, so the swap interval has to be tracked. */
+    TRACE("()\n");
     return swap_interval;
 }
 
@@ -3413,13 +3417,37 @@ static BOOL WINAPI X11DRV_wglSwapIntervalEXT(int interval) {
     BOOL ret = TRUE;
 
     TRACE("(%d)\n", interval);
-    swap_interval = interval;
-    if (NULL != pglXSwapIntervalSGI) {
-        wine_tsx11_lock();
-        ret = !pglXSwapIntervalSGI(interval);
-        wine_tsx11_unlock();
+
+    if (interval < 0)
+    {
+        SetLastError(ERROR_INVALID_DATA);
+        return FALSE;
+    }
+    else if (interval == 0)
+    {
+        /* wglSwapIntervalEXT considers an interval value of zero to mean that
+         * vsync should be disabled, but glXSwapIntervalSGI considers such a
+         * value to be an error. Just silently ignore the request for now. */
+        WARN("Request to disable vertical sync is not handled\n");
+        swap_interval = 0;
+    }
+    else
+    {
+        if (pglXSwapIntervalSGI)
+        {
+            wine_tsx11_lock();
+            ret = !pglXSwapIntervalSGI(interval);
+            wine_tsx11_unlock();
+        }
+        else
+            WARN("GLX_SGI_swap_control extension is not available\n");
+
+        if (ret)
+            swap_interval = interval;
+        else
+            SetLastError(ERROR_DC_NOT_FOUND);
     }
-    else WARN("(): GLX_SGI_swap_control extension seems not supported\n");
+
     return ret;
 }
 




More information about the wine-cvs mailing list