Ken Thomases : winemac: Force swap interval to 0 for single-buffered contexts to avoid vsync' ed flushes.

Alexandre Julliard julliard at winehq.org
Tue Jul 2 14:31:29 CDT 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Tue Jul  2 01:25:00 2013 -0500

winemac: Force swap interval to 0 for single-buffered contexts to avoid vsync'ed flushes.

---

 dlls/winemac.drv/opengl.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index 904158b..69f94e2 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -2901,7 +2901,9 @@ static BOOL macdrv_wglSwapIntervalEXT(int interval)
         return FALSE;
     }
 
-    if (interval > 1)
+    if (!pixel_formats[context->format - 1].double_buffer)
+        interval = 0;
+    else if (interval > 1)
         interval = 1;
 
     value = interval;
@@ -3238,8 +3240,14 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share)
     }
 
     /* According to the WGL_EXT_swap_control docs, the default swap interval for
-       a context is 1.  CGL contexts default to 0, so we need to set it. */
-    swap_interval = 1;
+       a context is 1.  CGL contexts default to 0, so we need to set it.  This
+       only make sense for double-buffered contexts, though.  In theory, for
+       single-buffered contexts, there's no such thing as a swap.  But OS X
+       will synchronize flushes of single-buffered contexts if this is set. */
+    if (pf->double_buffer)
+        swap_interval = 1;
+    else
+        swap_interval = 0;
     err = CGLSetParameter(context->cglcontext, kCGLCPSwapInterval, (GLint*)&swap_interval);
     if (err != kCGLNoError)
         WARN("CGLSetParameter(kCGLCPSwapInterval) failed with error %d %s; leaving un-vsynced\n", err, CGLErrorString(err));




More information about the wine-cvs mailing list