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:
parent
7c6febe6eb
commit
f4e8169e9a
|
@ -410,18 +410,7 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
|
||||||
case X11DRV_GET_GLX_DRAWABLE:
|
case X11DRV_GET_GLX_DRAWABLE:
|
||||||
if (out_count >= sizeof(Drawable))
|
if (out_count >= sizeof(Drawable))
|
||||||
{
|
{
|
||||||
if(physDev->bitmap)
|
*(Drawable *)out_data = get_glxdrawable(physDev);
|
||||||
{
|
|
||||||
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;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -523,12 +523,64 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
|
||||||
return TRUE;
|
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
|
* X11DRV_SwapBuffers
|
||||||
*
|
*
|
||||||
* Swap the buffers of this DC
|
* Swap the buffers of this DC
|
||||||
*/
|
*/
|
||||||
BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) {
|
BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev)
|
||||||
|
{
|
||||||
|
GLXDrawable drawable;
|
||||||
if (!has_opengl()) {
|
if (!has_opengl()) {
|
||||||
ERR("No libGL on this box - disabling OpenGL support !\n");
|
ERR("No libGL on this box - disabling OpenGL support !\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -536,8 +588,9 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev) {
|
||||||
|
|
||||||
TRACE_(opengl)("(%p)\n", physDev);
|
TRACE_(opengl)("(%p)\n", physDev);
|
||||||
|
|
||||||
|
drawable = get_glxdrawable(physDev);
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
pglXSwapBuffers(gdi_display, physDev->drawable);
|
pglXSwapBuffers(gdi_display, drawable);
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -587,36 +640,6 @@ XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
|
||||||
return 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 */
|
#else /* no OpenGL includes */
|
||||||
|
|
||||||
void X11DRV_OpenGL_Init(Display *display)
|
void X11DRV_OpenGL_Init(Display *display)
|
||||||
|
@ -679,7 +702,7 @@ XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XID create_glxpixmap(X11DRV_PDEVICE *physDev)
|
Drawable get_glxdrawable(X11DRV_PDEVICE *physDev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev);
|
||||||
|
|
||||||
extern XVisualInfo *X11DRV_setup_opengl_visual(Display *display);
|
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);
|
extern BOOL destroy_glxpixmap(XID glxpixmap);
|
||||||
|
|
||||||
/* XIM support */
|
/* XIM support */
|
||||||
|
|
Loading…
Reference in New Issue