opengl32: make the old code before the "sync the dibsection to its pixmap" patch be selectable at runtime.

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Mar 14 09:35:20 CST 2006


On Sun, Mar 12, 2006 at 05:44:57PM +0100, Leon Freitag wrote:
> The patch 
> http://source.winehq.org/git/?p=wine.git;a=commit;h=13268261bbe0d4013937a6a9804fbda378244512
> has introduced an annoying performance regression which affected all opengl 
> games. (see http://bugs.winehq.org/show_bug.cgi?id=4499).

Does this help?

Huw.
-- 
Huw Davies
huw at codeweavers.com
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 56c8ad1..aecba9c 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -78,6 +78,7 @@ static char* internal_gl_extensions = NU
 
 typedef struct wine_glcontext {
   HDC hdc;
+  DWORD type;
   Display *display;
   XVisualInfo *vis;
   GLXFBConfig fb_conf;
@@ -106,7 +107,7 @@ void enter_gl(void)
     ctx = get_context_from_GLXContext(gl_ctx);
     wine_tsx11_unlock_ptr(); /* unlock before calling GDI apis */
 
-    if(ctx && GetObjectType(ctx->hdc) == OBJ_MEMDC)
+    if(ctx && ctx->type == OBJ_MEMDC)
         ExtEscape(ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL);
 
     wine_tsx11_lock_ptr();
@@ -250,6 +251,7 @@ HGLRC WINAPI wglCreateContext(HDC hdc)
   ret = alloc_context();
   LEAVE_GL();
   ret->hdc = hdc;
+  ret->type = GetObjectType(hdc);
   ret->display = display;
   ret->fb_conf = cur_cfg;
   /*ret->vis = vis;*/
@@ -673,7 +675,7 @@ BOOL WINAPI wglShareLists(HGLRC hglrc1,
     if (org->ctx == NULL) {
       ENTER_GL();
       describeContext(org);
-      org->ctx = glXCreateContext(org->display, org->vis, NULL, GetObjectType(org->hdc) == OBJ_MEMDC ? False : True);
+      org->ctx = glXCreateContext(org->display, org->vis, NULL, org->type == OBJ_MEMDC ? False : True);
       LEAVE_GL();
       TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org);
     }
@@ -681,7 +683,7 @@ BOOL WINAPI wglShareLists(HGLRC hglrc1,
       ENTER_GL();
       describeContext(dest);
       /* Create the destination context with display lists shared */
-      dest->ctx = glXCreateContext(org->display, dest->vis, org->ctx, GetObjectType(org->hdc) == OBJ_MEMDC ? False : True);
+      dest->ctx = glXCreateContext(org->display, dest->vis, org->ctx, org->type == OBJ_MEMDC ? False : True);
       LEAVE_GL();
       TRACE(" created a delayed OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx);
       return TRUE;



More information about the wine-devel mailing list