winex11: Load and use GLX_MESA_copy_sub_buffer for swapping buffers on a GLXPixmap.

This commit is contained in:
Chris Robinson 2007-09-26 11:01:07 -07:00 committed by Alexandre Julliard
parent 37d835bf9a
commit d053049fd5
1 changed files with 24 additions and 1 deletions

View File

@ -256,6 +256,9 @@ static BOOL (*pglXDrawableAttribATI)(Display *dpy, GLXDrawable draw, const int
static void* (*pglXAllocateMemoryNV)(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); static void* (*pglXAllocateMemoryNV)(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
static void (*pglXFreeMemoryNV)(GLvoid *pointer); static void (*pglXFreeMemoryNV)(GLvoid *pointer);
/* MESA GLX Extensions */
static void (*pglXCopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
/* Standard OpenGL */ /* Standard OpenGL */
MAKE_FUNCPTR(glBindTexture) MAKE_FUNCPTR(glBindTexture)
MAKE_FUNCPTR(glBitmap) MAKE_FUNCPTR(glBitmap)
@ -508,6 +511,10 @@ LOAD_FUNCPTR(glXFreeMemoryNV)
pglXDrawableAttribATI = (void*)pglXGetProcAddressARB((const GLubyte *) "glXDrawableAttribATI"); pglXDrawableAttribATI = (void*)pglXGetProcAddressARB((const GLubyte *) "glXDrawableAttribATI");
} }
if(glxRequireExtension("GLX_MESA_copy_sub_buffer")) {
pglXCopySubBufferMESA = (void*)pglXGetProcAddressARB((const GLubyte *) "glXCopySubBufferMESA");
}
X11DRV_WineGL_LoadExtensions(); X11DRV_WineGL_LoadExtensions();
wine_tsx11_unlock(); wine_tsx11_unlock();
@ -3268,7 +3275,23 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev)
wine_tsx11_lock(); wine_tsx11_lock();
sync_context(ctx); sync_context(ctx);
pglXSwapBuffers(gdi_display, drawable); if(physDev->pixmap) {
if(pglXCopySubBufferMESA) {
int w = physDev->dc_rect.right - physDev->dc_rect.left;
int h = physDev->dc_rect.bottom - physDev->dc_rect.top;
/* (glX)SwapBuffers has an implicit glFlush effect, however
* GLX_MESA_copy_sub_buffer doesn't. Make sure GL is flushed before
* copying */
pglFlush();
if(w > 0 && h > 0)
pglXCopySubBufferMESA(gdi_display, drawable, 0, 0, w, h);
}
else
pglXSwapBuffers(gdi_display, drawable);
}
else
pglXSwapBuffers(gdi_display, drawable);
update_drawable(physDev); update_drawable(physDev);
wine_tsx11_unlock(); wine_tsx11_unlock();