x11drv: glx drawable escape
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Fri Sep 23 08:21:47 CDT 2005
GLX needs a GLXPixmap and not a XPixmap to draw into off-screen
drawables. So this escape will be used by opengl32 to get the correct
glxdrawable when rendering into dibs.
Huw Davies <huw at codeweavers.com>
Add an x11drv escape that returns a glx drawable.
--
Huw Davies
huw at codeweavers.com
Index: dlls/x11drv/bitmap.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/bitmap.c,v
retrieving revision 1.17
diff -u -p -r1.17 bitmap.c
--- dlls/x11drv/bitmap.c 13 Apr 2005 15:23:15 -0000 1.17
+++ dlls/x11drv/bitmap.c 23 Sep 2005 13:05:40 -0000
@@ -416,6 +416,7 @@ BOOL X11DRV_DeleteBitmap( HBITMAP hbitma
if (GetObjectW( hbitmap, sizeof(dib), &dib ) == sizeof(dib))
X11DRV_DIB_DeleteDIBSection( physBitmap, &dib );
+ if (physBitmap->glxpixmap) destroy_glxpixmap(physBitmap->glxpixmap);
wine_tsx11_lock();
if (physBitmap->pixmap) XFreePixmap( gdi_display, physBitmap->pixmap );
XDeleteContext( gdi_display, (XID)hbitmap, bitmap_context );
Index: dlls/x11drv/init.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/init.c,v
retrieving revision 1.21
diff -u -p -r1.21 init.c
--- dlls/x11drv/init.c 29 Jun 2005 19:28:06 -0000 1.21
+++ dlls/x11drv/init.c 23 Sep 2005 13:05:41 -0000
@@ -407,6 +407,21 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *ph
return TRUE;
}
break;
+ case X11DRV_GET_GLX_DRAWABLE:
+ if (out_count >= sizeof(Drawable))
+ {
+ if(physDev->bitmap)
+ {
+ if(!physDev->bitmap->glxpixmap)
+ physDev->bitmap->glxpixmap = create_glxpixmap(physDev);
+
+ *(Drawable *)out_data = physDev->bitmap->glxpixmap;
+ }
+ else
+ *(Drawable *)out_data = physDev->drawable;
+ return TRUE;
+ }
+ break;
}
}
break;
Index: dlls/x11drv/opengl.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/opengl.c,v
retrieving revision 1.13
diff -u -p -r1.13 opengl.c
--- dlls/x11drv/opengl.c 22 Aug 2005 09:22:19 -0000 1.13
+++ dlls/x11drv/opengl.c 23 Sep 2005 13:05:41 -0000
@@ -122,6 +122,8 @@ MAKE_FUNCPTR(glXQueryExtension)
MAKE_FUNCPTR(glXGetFBConfigs)
MAKE_FUNCPTR(glXChooseFBConfig)
MAKE_FUNCPTR(glXGetFBConfigAttrib)
+MAKE_FUNCPTR(glXCreateGLXPixmap)
+MAKE_FUNCPTR(glXDestroyGLXPixmap)
#undef MAKE_FUNCPTR
static BOOL has_opengl(void)
@@ -147,6 +149,8 @@ LOAD_FUNCPTR(glXQueryExtension)
LOAD_FUNCPTR(glXGetFBConfigs)
LOAD_FUNCPTR(glXChooseFBConfig)
LOAD_FUNCPTR(glXGetFBConfigAttrib)
+LOAD_FUNCPTR(glXCreateGLXPixmap)
+LOAD_FUNCPTR(glXDestroyGLXPixmap)
#undef LOAD_FUNCPTR
wine_tsx11_lock();
@@ -499,6 +503,32 @@ XVisualInfo *X11DRV_setup_opengl_visual(
return visual;
}
+XID create_glxpixmap(X11DRV_PDEVICE *physDev)
+{
+ GLXPixmap ret;
+ XVisualInfo *vis;
+ XVisualInfo template;
+ int num;
+
+ wine_tsx11_lock();
+ template.visualid = XVisualIDFromVisual(visual);
+ vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num);
+
+ ret = pglXCreateGLXPixmap(gdi_display, vis, physDev->bitmap->pixmap);
+ XFree(vis);
+ 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)
@@ -561,4 +591,14 @@ XVisualInfo *X11DRV_setup_opengl_visual(
return NULL;
}
+XID create_glxpixmap(X11DRV_PDEVICE *physDev)
+{
+ return NULL;
+}
+
+BOOL destroy_glxpixmap(XID glxpixmap)
+{
+ return FALSE;
+}
+
#endif /* defined(HAVE_OPENGL) */
Index: dlls/x11drv/x11drv.h
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11drv.h,v
retrieving revision 1.78
diff -u -p -r1.78 x11drv.h
--- dlls/x11drv/x11drv.h 14 Sep 2005 11:31:46 -0000 1.78
+++ dlls/x11drv/x11drv.h 23 Sep 2005 13:05:41 -0000
@@ -99,6 +99,7 @@ typedef struct
{
HBITMAP hbitmap;
Pixmap pixmap;
+ XID glxpixmap;
int pixmap_depth;
/* the following fields are only used for DIB section bitmaps */
int status, p_status; /* mapping status */
@@ -274,6 +275,8 @@ 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 BOOL destroy_glxpixmap(XID glxpixmap);
/* XIM support */
extern XIC X11DRV_CreateIC(XIM xim, Display *display, Window win);
@@ -479,6 +482,7 @@ enum x11drv_escape_codes
X11DRV_END_EXPOSURES, /* end graphics exposures */
X11DRV_GET_DCE, /* get the DCE pointer */
X11DRV_SET_DCE, /* set the DCE pointer */
+ X11DRV_GET_GLX_DRAWABLE /* get current glx drawable for a DC */
};
struct x11drv_escape_set_drawable
More information about the wine-patches
mailing list