winex11: Use ExtEscape to flush the GL drawable to the physdev.

Based on a patch by Chris Robinson.
This commit is contained in:
Alexandre Julliard 2007-10-10 17:33:35 +02:00
parent 235532ce28
commit 771d61a886
3 changed files with 19 additions and 5 deletions

View File

@ -436,6 +436,9 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
case X11DRV_FLUSH_GL_DRAWABLE:
flush_gl_drawable(physDev);
return TRUE;
} }
} }
break; break;

View File

@ -1967,7 +1967,7 @@ static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
static inline void update_drawable(X11DRV_PDEVICE *physDev) void flush_gl_drawable(X11DRV_PDEVICE *physDev)
{ {
int w, h; int w, h;
@ -1983,9 +1983,11 @@ static inline void update_drawable(X11DRV_PDEVICE *physDev)
/* The GL drawable may be lagged behind if we don't flush first, so /* The GL drawable may be lagged behind if we don't flush first, so
* flush the display make sure we copy up-to-date data */ * flush the display make sure we copy up-to-date data */
wine_tsx11_lock();
XFlush(gdi_display); XFlush(gdi_display);
XCopyArea(gdi_display, src, physDev->drawable, physDev->gc, 0, 0, w, h, XCopyArea(gdi_display, src, physDev->drawable, physDev->gc, 0, 0, w, h,
physDev->dc_rect.left, physDev->dc_rect.top); physDev->dc_rect.left, physDev->dc_rect.top);
wine_tsx11_unlock();
} }
} }
@ -1993,23 +1995,25 @@ static inline void update_drawable(X11DRV_PDEVICE *physDev)
static void WINAPI X11DRV_wglFinish(void) static void WINAPI X11DRV_wglFinish(void)
{ {
Wine_GLContext *ctx = NtCurrentTeb()->glContext; Wine_GLContext *ctx = NtCurrentTeb()->glContext;
enum x11drv_escape_codes code = X11DRV_FLUSH_GL_DRAWABLE;
wine_tsx11_lock(); wine_tsx11_lock();
sync_context(ctx); sync_context(ctx);
pglFinish(); pglFinish();
update_drawable(ctx->physDev);
wine_tsx11_unlock(); wine_tsx11_unlock();
ExtEscape(ctx->hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL );
} }
static void WINAPI X11DRV_wglFlush(void) static void WINAPI X11DRV_wglFlush(void)
{ {
Wine_GLContext *ctx = NtCurrentTeb()->glContext; Wine_GLContext *ctx = NtCurrentTeb()->glContext;
enum x11drv_escape_codes code = X11DRV_FLUSH_GL_DRAWABLE;
wine_tsx11_lock(); wine_tsx11_lock();
sync_context(ctx); sync_context(ctx);
pglFlush(); pglFlush();
update_drawable(ctx->physDev);
wine_tsx11_unlock(); wine_tsx11_unlock();
ExtEscape(ctx->hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL );
} }
/** /**
@ -3292,7 +3296,8 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev)
} }
else else
pglXSwapBuffers(gdi_display, drawable); pglXSwapBuffers(gdi_display, drawable);
update_drawable(physDev);
flush_gl_drawable(physDev);
wine_tsx11_unlock(); wine_tsx11_unlock();
/* FPS support */ /* FPS support */
@ -3375,6 +3380,10 @@ void mark_drawable_dirty(Drawable old, Drawable new)
{ {
} }
void flush_gl_drawable(X11DRV_PDEVICE *physDev)
{
}
Drawable create_glxpixmap(Display *display, XVisualInfo *vis, Pixmap parent) Drawable create_glxpixmap(Display *display, XVisualInfo *vis, Pixmap parent)
{ {
return 0; return 0;

View File

@ -477,7 +477,8 @@ enum x11drv_escape_codes
X11DRV_GET_DCE, /* get the DCE pointer */ X11DRV_GET_DCE, /* get the DCE pointer */
X11DRV_SET_DCE, /* set the DCE pointer */ X11DRV_SET_DCE, /* set the DCE pointer */
X11DRV_GET_GLX_DRAWABLE, /* get current glx drawable for a DC */ X11DRV_GET_GLX_DRAWABLE, /* get current glx drawable for a DC */
X11DRV_SYNC_PIXMAP /* sync the dibsection to its pixmap */ X11DRV_SYNC_PIXMAP, /* sync the dibsection to its pixmap */
X11DRV_FLUSH_GL_DRAWABLE /* flush changes made to the gl drawable */
}; };
struct x11drv_escape_set_drawable struct x11drv_escape_set_drawable
@ -676,6 +677,7 @@ extern int pixelformat_from_fbconfig_id( XID fbconfig_id );
extern XVisualInfo *visual_from_fbconfig_id( XID fbconfig_id ); extern XVisualInfo *visual_from_fbconfig_id( XID fbconfig_id );
extern void mark_drawable_dirty( Drawable old, Drawable new ); extern void mark_drawable_dirty( Drawable old, Drawable new );
extern Drawable create_glxpixmap( Display *display, XVisualInfo *vis, Pixmap parent ); extern Drawable create_glxpixmap( Display *display, XVisualInfo *vis, Pixmap parent );
extern void flush_gl_drawable( X11DRV_PDEVICE *physDev );
extern void alloc_window_dce( struct x11drv_win_data *data ); extern void alloc_window_dce( struct x11drv_win_data *data );
extern void free_window_dce( struct x11drv_win_data *data ); extern void free_window_dce( struct x11drv_win_data *data );