Roderick Colenbrander : winex11: Move all delayed GLX context creation code to create_glxcontext in order to prepare for WGL_ARB_create_context .

Alexandre Julliard julliard at winehq.org
Mon Oct 27 08:03:24 CDT 2008


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

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Sat Oct 25 21:36:32 2008 +0000

winex11: Move all delayed GLX context creation code to create_glxcontext in order to prepare for WGL_ARB_create_context.

---

 dlls/winex11.drv/opengl.c |   41 ++++++++++++++++++-----------------------
 1 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index bf1a9b6..b4845ad 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1013,6 +1013,18 @@ static inline void sync_context(Wine_GLContext *context)
 }
 
 
+static GLXContext create_glxcontext(Display *display, Wine_GLContext *context, GLXContext shareList, BOOL direct)
+{
+    GLXContext ctx;
+    if(context->vis)
+        ctx = pglXCreateContext(gdi_display, context->vis, shareList, direct);
+    else /* Create a GLX Context for a pbuffer */
+        ctx = pglXCreateNewContext(gdi_display, context->fmt->fbconfig, context->fmt->render_type, shareList, direct);
+
+    return ctx;
+}
+
+
 Drawable create_glxpixmap(Display *display, XVisualInfo *vis, Pixmap parent)
 {
     return pglXCreateGLXPixmap(display, vis, parent);
@@ -1581,19 +1593,13 @@ BOOL X11DRV_wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) {
         if (!src->ctx) {
             DWORD type = GetObjectType(src->hdc);
             wine_tsx11_lock();
-            if(src->vis)
-                src->ctx = pglXCreateContext(gdi_display, src->vis, NULL, type == OBJ_MEMDC ? False : True);
-            else /* Create a GLX Context for a pbuffer */
-                src->ctx = pglXCreateNewContext(gdi_display, src->fmt->fbconfig, src->fmt->render_type, NULL, True);
+            src->ctx = create_glxcontext(gdi_display, src, NULL, type == OBJ_MEMDC ? False : True);
             TRACE(" created a delayed OpenGL context (%p)\n", src->ctx);
         }
         else if (!dst->ctx) {
             DWORD type = GetObjectType(dst->hdc);
             wine_tsx11_lock();
-            if(dst->vis)
-                dst->ctx = pglXCreateContext(gdi_display, dst->vis, NULL, type == OBJ_MEMDC ? False : True);
-            else /* Create a GLX Context for a pbuffer */
-                dst->ctx = pglXCreateNewContext(gdi_display, dst->fmt->fbconfig, dst->fmt->render_type, NULL, True);
+            dst->ctx = create_glxcontext(gdi_display, dst, NULL, type == OBJ_MEMDC ? False : True);
             TRACE(" created a delayed OpenGL context (%p)\n", dst->ctx);
         }
     }
@@ -1772,11 +1778,7 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
              * We are certain that the drawable and context are compatible as we only allow compatible formats.
              */
             TRACE(" Creating GLX Context\n");
-            if(ctx->vis)
-                ctx->ctx = pglXCreateContext(gdi_display, ctx->vis, NULL, type == OBJ_MEMDC ? False : True);
-            else /* Create a GLX Context for a pbuffer */
-                ctx->ctx = pglXCreateNewContext(gdi_display, ctx->fmt->fbconfig, ctx->fmt->render_type, NULL, True);
-
+            ctx->ctx = create_glxcontext(gdi_display, ctx, NULL, type == OBJ_MEMDC ? False : True);
             TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx);
         }
         TRACE(" make current for dis %p, drawable %p, ctx %p\n", gdi_display, (void*) drawable, ctx->ctx);
@@ -1829,7 +1831,7 @@ BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* pDrawDev, X11DRV_PDEVICE* p
             Drawable d_read = get_glxdrawable(pReadDev);
 
             if (ctx->ctx == NULL) {
-                ctx->ctx = pglXCreateContext(gdi_display, ctx->vis, NULL, !indirect);
+                ctx->ctx = create_glxcontext(gdi_display, ctx, NULL, !indirect);
                 TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx);
             }
             ctx->hdc = pDrawDev->hdc;
@@ -1869,10 +1871,7 @@ BOOL X11DRV_wglShareLists(HGLRC hglrc1, HGLRC hglrc2) {
             wine_tsx11_lock();
             describeContext(org);
 
-            if(org->vis)
-                org->ctx = pglXCreateContext(gdi_display, org->vis, NULL, !indirect);
-            else /* Create a GLX Context for a pbuffer */
-                org->ctx = pglXCreateNewContext(gdi_display, org->fmt->fbconfig, org->fmt->render_type, NULL, True);
+            org->ctx = create_glxcontext(gdi_display, org, NULL, !indirect);
             wine_tsx11_unlock();
             TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org);
         }
@@ -1880,11 +1879,7 @@ BOOL X11DRV_wglShareLists(HGLRC hglrc1, HGLRC hglrc2) {
             int indirect = (GetObjectType(dest->hdc) == OBJ_MEMDC);
             wine_tsx11_lock();
             describeContext(dest);
-            /* Create the destination context with display lists shared */
-            if(dest->vis)
-                dest->ctx = pglXCreateContext(gdi_display, dest->vis, org->ctx, !indirect);
-            else /* Create a GLX Context for a pbuffer */
-                dest->ctx = pglXCreateNewContext(gdi_display, dest->fmt->fbconfig, dest->fmt->render_type, org->ctx, True);
+            dest->ctx = create_glxcontext(gdi_display, dest, org->ctx, !indirect);
             wine_tsx11_unlock();
             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-cvs mailing list