}
-/* XXX these may have to be removed due to thread-safety issues. */
-static GLXContext MakeCurrent_PrevContext = 0;
-
-
/* GLX 1.3 and later */
PUBLIC Bool
glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
GLXDrawable read, GLXContext ctx )
{
GLXContext glxCtx = ctx;
+ GLXContext current = GetCurrentContext();
static boolean firsttime = 1, no_rast = 0;
if (firsttime) {
XMesaContext xmctx = glxCtx->xmesaContext;
/* Find the XMesaBuffer which corresponds to the GLXDrawable 'draw' */
- if (ctx == MakeCurrent_PrevContext) {
+ if (ctx == current) {
drawBuffer = XMesaFindBuffer( dpy, draw );
}
if (!drawBuffer) {
}
/* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */
- if (ctx == MakeCurrent_PrevContext) {
+ if (ctx == current) {
readBuffer = XMesaFindBuffer( dpy, read );
}
if (!readBuffer) {
}
}
- if (no_rast && MakeCurrent_PrevContext == ctx)
+ if (no_rast && current == ctx)
return True;
- MakeCurrent_PrevContext = ctx;
-
/* Now make current! */
if (XMesaMakeCurrent2(xmctx, drawBuffer, readBuffer)) {
ctx->currentDpy = dpy;
else if (!ctx && !draw && !read) {
/* release current context w/out assigning new one. */
XMesaMakeCurrent2( NULL, NULL, NULL );
- MakeCurrent_PrevContext = 0;
SetCurrentContext(NULL);
return True;
}
XMesaContext xm_src = src->xmesaContext;
XMesaContext xm_dst = dst->xmesaContext;
(void) dpy;
- if (MakeCurrent_PrevContext == src) {
+ if (GetCurrentContext() == src) {
glFlush();
}
XMesaCopyContext(xm_src, xm_dst, mask);
if (ctx) {
GLXContext glxCtx = ctx;
(void) dpy;
- MakeCurrent_PrevContext = 0;
XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect();
free(glxCtx);