winex11: Introduce a function to retrieve the glx drawable and have

both the GET_GLX_DRAWABLE Escape and SwapBuffers call it.
This commit is contained in:
Huw Davies 2006-06-23 12:13:55 +01:00 committed by Alexandre Julliard
parent 7c6febe6eb
commit f4e8169e9a
3 changed files with 58 additions and 46 deletions

View File

@ -410,18 +410,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
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;

View File

@ -523,12 +523,64 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
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 *physDev) {
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( Display *display )
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( Display *display )
return NULL;
}
XID create_glxpixmap(X11DRV_PDEVICE *physDev)
Drawable get_glxdrawable(X11DRV_PDEVICE *physDev)
{
return 0;
}

View File

@ -272,7 +272,7 @@ extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UIN
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 */