Module: wine Branch: refs/heads/master Commit: f4e8169e9acb59b340b2a8f521d44a9f012267bc URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=f4e8169e9acb59b340b2a8f5...
Author: Huw Davies huw@codeweavers.com Date: Fri Jun 23 12:13:55 2006 +0100
winex11: Introduce a function to retrieve the glx drawable and have both the GET_GLX_DRAWABLE Escape and SwapBuffers call it.
---
dlls/winex11.drv/init.c | 13 +------ dlls/winex11.drv/opengl.c | 89 ++++++++++++++++++++++++++++----------------- dlls/winex11.drv/x11drv.h | 2 + 3 files changed, 58 insertions(+), 46 deletions(-)
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 0aa38a4..651b2b4 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -410,18 +410,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *ph case X11DRV_GET_GLX_DRAWABLE: if (out_count >= sizeof(Drawable)) { - if(physDev->bitmap) - { - if (physDev->bitmap->hbitmap == BITMAP_stock_phys_bitmap.hbitmap) - *(Drawable *)out_data = physDev->drawable; /* PBuffer */ - else { - if(!physDev->bitmap->glxpixmap) - physDev->bitmap->glxpixmap = create_glxpixmap(physDev); - *(Drawable *)out_data = physDev->bitmap->glxpixmap; - } - } - else - *(Drawable *)out_data = physDev->drawable; + *(Drawable *)out_data = get_glxdrawable(physDev); return TRUE; } break; diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 60ebcce..2fe6c9d 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -523,12 +523,64 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVIC return TRUE; }
+static XID create_glxpixmap(X11DRV_PDEVICE *physDev) +{ + GLXPixmap ret; + XVisualInfo *vis; + XVisualInfo template; + int num; + GLXFBConfig *cfgs; + + wine_tsx11_lock(); + cfgs = pglXGetFBConfigs(gdi_display, DefaultScreen(gdi_display), &num); + pglXGetFBConfigAttrib(gdi_display, cfgs[physDev->current_pf - 1], GLX_VISUAL_ID, (int *)&template.visualid); + + vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num); + + ret = pglXCreateGLXPixmap(gdi_display, vis, physDev->bitmap->pixmap); + XFree(vis); + XFree(cfgs); + wine_tsx11_unlock(); + TRACE("return %lx\n", ret); + return ret; +} + +Drawable get_glxdrawable(X11DRV_PDEVICE *physDev) +{ + Drawable ret; + + if(physDev->bitmap) + { + if (physDev->bitmap->hbitmap == BITMAP_stock_phys_bitmap.hbitmap) + ret = physDev->drawable; /* PBuffer */ + else + { + if(!physDev->bitmap->glxpixmap) + physDev->bitmap->glxpixmap = create_glxpixmap(physDev); + ret = physDev->bitmap->glxpixmap; + } + } + else + ret = physDev->drawable; + return ret; +} + +BOOL destroy_glxpixmap(XID glxpixmap) +{ + wine_tsx11_lock(); + pglXDestroyGLXPixmap(gdi_display, glxpixmap); + wine_tsx11_unlock(); + return TRUE; +} + /** * X11DRV_SwapBuffers * * Swap the buffers of this DC */ -BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) { +BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) +{ + GLXDrawable drawable; if (!has_opengl()) { ERR("No libGL on this box - disabling OpenGL support !\n"); return 0; @@ -536,8 +588,9 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *
TRACE_(opengl)("(%p)\n", physDev);
+ drawable = get_glxdrawable(physDev); wine_tsx11_lock(); - pglXSwapBuffers(gdi_display, physDev->drawable); + pglXSwapBuffers(gdi_display, drawable); wine_tsx11_unlock();
return TRUE; @@ -587,36 +640,6 @@ XVisualInfo *X11DRV_setup_opengl_visual( return visual; }
-XID create_glxpixmap(X11DRV_PDEVICE *physDev) -{ - GLXPixmap ret; - XVisualInfo *vis; - XVisualInfo template; - int num; - GLXFBConfig *cfgs; - - wine_tsx11_lock(); - cfgs = pglXGetFBConfigs(gdi_display, DefaultScreen(gdi_display), &num); - pglXGetFBConfigAttrib(gdi_display, cfgs[physDev->current_pf - 1], GLX_VISUAL_ID, (int *)&template.visualid); - - vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num); - - ret = pglXCreateGLXPixmap(gdi_display, vis, physDev->bitmap->pixmap); - XFree(vis); - XFree(cfgs); - wine_tsx11_unlock(); - TRACE("return %lx\n", ret); - return ret; -} - -BOOL destroy_glxpixmap(XID glxpixmap) -{ - wine_tsx11_lock(); - pglXDestroyGLXPixmap(gdi_display, glxpixmap); - wine_tsx11_unlock(); - return TRUE; -} - #else /* no OpenGL includes */
void X11DRV_OpenGL_Init(Display *display) @@ -679,7 +702,7 @@ XVisualInfo *X11DRV_setup_opengl_visual( return NULL; }
-XID create_glxpixmap(X11DRV_PDEVICE *physDev) +Drawable get_glxdrawable(X11DRV_PDEVICE *physDev) { return 0; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index adbb1f7..9537b77 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -272,7 +272,7 @@ extern BOOL X11DRV_XRender_ExtTextOut(X1 extern void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev);
extern XVisualInfo *X11DRV_setup_opengl_visual(Display *display); -extern XID create_glxpixmap(X11DRV_PDEVICE *physDev); +extern Drawable get_glxdrawable(X11DRV_PDEVICE *physDev); extern BOOL destroy_glxpixmap(XID glxpixmap);
/* XIM support */