summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/context.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b132030b9b..4ed179a834 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1399,6 +1399,8 @@ _mesa_make_current( struct gl_context *newCtx,
struct gl_framebuffer *drawBuffer,
struct gl_framebuffer *readBuffer )
{
+ GET_CURRENT_CONTEXT(curCtx);
+
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(newCtx, "_mesa_make_current()\n");
@@ -1419,6 +1421,11 @@ _mesa_make_current( struct gl_context *newCtx,
}
}
+ if (curCtx &&
+ (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && /* make sure this context is valid for flushing */
+ curCtx != newCtx)
+ _mesa_flush(curCtx);
+
/* We used to call _glapi_check_multithread() here. Now do it in drivers */
_glapi_set_context((void *) newCtx);
ASSERT(_mesa_get_current_context() == newCtx);