/* * Bind buffer b to context c and make c the current rendering context. */ PUBLIC GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, XMesaBuffer readBuffer ) { if (c) { if (!drawBuffer || !readBuffer) return GL_FALSE; /* must specify buffers! */ if (&(c->mesa) == _mesa_get_current_context() && c->mesa.DrawBuffer == &drawBuffer->mesa_buffer && c->mesa.ReadBuffer == &readBuffer->mesa_buffer && XMESA_BUFFER(c->mesa.DrawBuffer)->wasCurrent) { /* same context and buffer, do nothing */ return GL_TRUE; } c->xm_buffer = drawBuffer; /* Call this periodically to detect when the user has begun using * GL rendering from multiple threads. */ _glapi_check_multithread(); xmesa_check_and_update_buffer_size(c, drawBuffer); if (readBuffer != drawBuffer) xmesa_check_and_update_buffer_size(c, readBuffer); _mesa_make_current(&(c->mesa), &drawBuffer->mesa_buffer, &readBuffer->mesa_buffer); /* * Must recompute and set these pixel values because colormap * can be different for different windows. */ c->clearpixel = xmesa_color_to_pixel( &c->mesa, c->clearcolor[0], c->clearcolor[1], c->clearcolor[2], c->clearcolor[3], c->xm_visual->undithered_pf); XMesaSetForeground(c->display, drawBuffer->cleargc, c->clearpixel); /* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */ drawBuffer->wasCurrent = GL_TRUE; } else { /* Detach */ _mesa_make_current( NULL, NULL, NULL ); } return GL_TRUE; }
/* * This is typically called when the window size changes and we need * to reallocate the buffer's back/depth/stencil/accum buffers. */ PUBLIC void XMesaResizeBuffers( XMesaBuffer b ) { GET_CURRENT_CONTEXT(ctx); XMesaContext xmctx = XMESA_CONTEXT(ctx); if (!xmctx) return; xmesa_check_and_update_buffer_size(xmctx, b); }
static void xm_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surf, void *context_private) { /* * The front color buffer is actually just another XImage buffer. * This function copies that XImage to the actual X Window. */ XMesaContext xmctx = (XMesaContext) context_private; xlib_softpipe_display_surface(xmctx->xm_buffer, surf); xmesa_check_and_update_buffer_size(xmctx, xmctx->xm_buffer); }