=?UTF-8?Q?Mikl=C3=B3s=20M=C3=A1t=C3=A9=20?=: winex11: Use GLX 1.3 for windows.

Alexandre Julliard julliard at winehq.org
Mon May 30 09:43:42 CDT 2016


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

Author: Miklós Máté <mtmkls at gmail.com>
Date:   Thu May 26 23:43:14 2016 +0200

winex11: Use GLX 1.3 for windows.

Differentiate between X window and GLX window, use GLX 1.3 for GL window
create/destroy.

Signed-off-by: Miklós Máté <mtmkls at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/opengl.c | 49 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 66e92f7..d89a193 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -217,7 +217,7 @@ struct wgl_context
     int numAttribs; /* This is needed for delaying wglCreateContextAttribsARB */
     int attribList[16]; /* This is needed for delaying wglCreateContextAttribsARB */
     GLXContext ctx;
-    Drawable drawables[2];
+    GLXDrawable drawables[2];
     BOOL refresh_drawables;
     struct list entry;
 };
@@ -254,7 +254,8 @@ enum dc_gl_type
 struct gl_drawable
 {
     enum dc_gl_type                type;         /* type of GL surface */
-    Drawable                       drawable;     /* drawable for rendering to the client area */
+    GLXDrawable                    drawable;     /* drawable for rendering with GL */
+    Window                         window;       /* window if drawable is a GLXWindow */
     Pixmap                         pixmap;       /* base pixmap if drawable is a GLXPixmap */
     Colormap                       colormap;     /* colormap used for the drawable */
     const struct wgl_pixel_format *format;       /* pixel format for the drawable */
@@ -397,6 +398,8 @@ static GLXContext (*pglXCreateNewContext)( Display *dpy, GLXFBConfig config, int
 static Bool (*pglXMakeContextCurrent)( Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx );
 static GLXPixmap (*pglXCreatePixmap)( Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list );
 static void (*pglXDestroyPixmap)( Display *dpy, GLXPixmap pixmap );
+static GLXWindow (*pglXCreateWindow)( Display *dpy, GLXFBConfig config, Window win, const int *attrib_list );
+static void (*pglXDestroyWindow)( Display *dpy, GLXWindow win );
 
 /* GLX Extensions */
 static GLXContext (*pglXCreateContextAttribsARB)(Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
@@ -647,6 +650,8 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context )
     LOAD_FUNCPTR(glXGetFBConfigs);
     LOAD_FUNCPTR(glXCreatePixmap);
     LOAD_FUNCPTR(glXDestroyPixmap);
+    LOAD_FUNCPTR(glXCreateWindow);
+    LOAD_FUNCPTR(glXDestroyWindow);
 #undef LOAD_FUNCPTR
 
 /* It doesn't matter if these fail. They'll only be used if the driver reports
@@ -1199,7 +1204,7 @@ static const struct wgl_pixel_format *get_pixel_format(Display *display, int iPi
 }
 
 /* Mark any allocated context using the glx drawable 'old' to use 'new' */
-static void mark_drawable_dirty(Drawable old, Drawable new)
+static void mark_drawable_dirty(GLXDrawable old, GLXDrawable new)
 {
     struct wgl_context *ctx;
 
@@ -1229,7 +1234,7 @@ static inline void sync_context(struct wgl_context *context)
     }
 }
 
-static BOOL set_swap_interval(Drawable drawable, int interval)
+static BOOL set_swap_interval(GLXDrawable drawable, int interval)
 {
     BOOL ret = TRUE;
 
@@ -1310,7 +1315,8 @@ static void free_gl_drawable( struct gl_drawable *gl )
     switch (gl->type)
     {
     case DC_GL_CHILD_WIN:
-        XDestroyWindow( gdi_display, gl->drawable );
+        pglXDestroyWindow( gdi_display, gl->drawable );
+        XDestroyWindow( gdi_display, gl->window );
         XFreeColormap( gdi_display, gl->colormap );
         break;
     case DC_GL_PIXMAP_WIN:
@@ -1339,7 +1345,9 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
         if (data)
         {
             gl->type = DC_GL_WINDOW;
-            gl->drawable = create_client_window( data, gl->visual );
+            gl->window = create_client_window( data, gl->visual );
+            if (gl->window)
+                gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL );
             release_win_data( data );
         }
     }
@@ -1365,14 +1373,18 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
         XInstallColormap(gdi_display, attrib.colormap);
 
         gl->type = DC_GL_CHILD_WIN;
-        gl->drawable = XCreateWindow( gdi_display, dummy_parent, 0, 0,
+        gl->window = XCreateWindow( gdi_display, dummy_parent, 0, 0,
                                       gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top,
                                       0, gl->visual->depth, InputOutput, gl->visual->visual,
                                       CWColormap | CWOverrideRedirect, &attrib );
-        if (gl->drawable)
+        if (gl->window)
         {
-            pXCompositeRedirectWindow(gdi_display, gl->drawable, CompositeRedirectManual);
-            XMapWindow(gdi_display, gl->drawable);
+            gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL );
+            if (gl->drawable)
+            {
+                pXCompositeRedirectWindow(gdi_display, gl->window, CompositeRedirectManual);
+                XMapWindow(gdi_display, gl->window);
+            }
         }
         else XFreeColormap( gdi_display, gl->colormap );
     }
@@ -1498,7 +1510,7 @@ static BOOL set_pixel_format(HDC hdc, int format, BOOL allow_change)
 void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_rect )
 {
     struct gl_drawable *gl;
-    Drawable glxp;
+    GLXDrawable glxp;
     Pixmap pix;
     int mask = 0;
     XWindowChanges changes;
@@ -1516,7 +1528,7 @@ void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_r
     switch (gl->type)
     {
     case DC_GL_CHILD_WIN:
-        if (mask) XConfigureWindow( gdi_display, gl->drawable, mask, &changes );
+        if (mask) XConfigureWindow( gdi_display, gl->window, mask, &changes );
         break;
     case DC_GL_PIXMAP_WIN:
         if (!mask) break;
@@ -1553,7 +1565,7 @@ done:
 void set_gl_drawable_parent( HWND hwnd, HWND parent )
 {
     struct gl_drawable *gl;
-    Drawable old_drawable;
+    GLXDrawable old_drawable;
 
     if (!(gl = get_gl_drawable( hwnd, 0 ))) return;
 
@@ -1566,7 +1578,8 @@ void set_gl_drawable_parent( HWND hwnd, HWND parent )
         break;
     case DC_GL_CHILD_WIN:
         if (parent != GetDesktopWindow()) goto done;
-        XDestroyWindow( gdi_display, gl->drawable );
+        pglXDestroyWindow( gdi_display, gl->drawable );
+        XDestroyWindow( gdi_display, gl->window );
         XFreeColormap( gdi_display, gl->colormap );
         break;
     case DC_GL_PIXMAP_WIN:
@@ -1999,7 +2012,7 @@ static void wglFinish(void)
         switch (gl->type)
         {
         case DC_GL_PIXMAP_WIN: escape.gl_drawable = gl->pixmap; break;
-        case DC_GL_CHILD_WIN:  escape.gl_drawable = gl->drawable; break;
+        case DC_GL_CHILD_WIN:  escape.gl_drawable = gl->window; break;
         default: break;
         }
         sync_context(ctx);
@@ -2024,7 +2037,7 @@ static void wglFlush(void)
         switch (gl->type)
         {
         case DC_GL_PIXMAP_WIN: escape.gl_drawable = gl->pixmap; break;
-        case DC_GL_CHILD_WIN:  escape.gl_drawable = gl->drawable; break;
+        case DC_GL_CHILD_WIN:  escape.gl_drawable = gl->window; break;
         default: break;
         }
         sync_context(ctx);
@@ -2948,7 +2961,7 @@ static BOOL X11DRV_wglBindTexImageARB( struct wgl_pbuffer *object, int iBuffer )
         static BOOL initialized = FALSE;
         int prev_binded_texture = 0;
         GLXContext prev_context;
-        Drawable prev_drawable;
+        GLXDrawable prev_drawable;
 
         prev_context = pglXGetCurrentContext();
         prev_drawable = pglXGetCurrentDrawable();
@@ -3322,7 +3335,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
         break;
     case DC_GL_CHILD_WIN:
         if (ctx) sync_context( ctx );
-        escape.gl_drawable = gl->drawable;
+        escape.gl_drawable = gl->window;
         /* fall through */
     default:
         pglXSwapBuffers(gdi_display, gl->drawable);




More information about the wine-cvs mailing list