/** * Notify the binding context to validate the buffer. */ void xmesa_notify_invalid_buffer(XMesaBuffer b) { XMesaContext xmctx = XMesaGetCurrentContext(); if (xmctx && xmctx->xm_buffer == b) xmctx->st->notify_invalid_framebuffer(xmctx->st, b->stfb); }
/* * Copy sub-region of back buffer to front buffer */ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) { XMesaContext xmctx = XMesaGetCurrentContext(); xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL); xmesa_copy_st_framebuffer(b->stfb, ST_ATTACHMENT_BACK_LEFT, ST_ATTACHMENT_FRONT_LEFT, x, b->height - y - height, width, height); }
/** * Swap front and back color buffers and have winsys display front buffer. * If there's no front color buffer no swap actually occurs. */ PUBLIC void XMesaSwapBuffers( XMesaBuffer b ) { XMesaContext xmctx = XMesaGetCurrentContext(); if (xmctx && xmctx->xm_buffer == b) { xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL); } xmesa_swap_st_framebuffer(b->stfb); }
/** * Swap front and back color buffers and have winsys display front buffer. * If there's no front color buffer no swap actually occurs. */ PUBLIC void XMesaSwapBuffers( XMesaBuffer b ) { XMesaContext xmctx = XMesaGetCurrentContext(); if (xmctx && xmctx->xm_buffer == b) { xmctx->st->flush( xmctx->st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME, NULL); } xmesa_swap_st_framebuffer(b->stfb); }
/** * Swap front and back color buffers and have winsys display front buffer. * If there's no front color buffer no swap actually occurs. */ PUBLIC void XMesaSwapBuffers( XMesaBuffer b ) { XMesaContext xmctx = XMesaGetCurrentContext(); /* Need to draw HUD before flushing */ if (xmctx && xmctx->hud) { struct pipe_resource *back = xmesa_get_framebuffer_resource(b->stfb, ST_ATTACHMENT_BACK_LEFT); hud_draw(xmctx->hud, back); } if (xmctx && xmctx->xm_buffer == b) { xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL); } xmesa_swap_st_framebuffer(b->stfb); }
/* * Bind buffer b to context c and make c the current rendering context. */ PUBLIC GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, XMesaBuffer readBuffer ) { XMesaContext old_ctx = XMesaGetCurrentContext(); if (old_ctx && old_ctx != c) { XMesaFlush(old_ctx); old_ctx->xm_buffer = NULL; old_ctx->xm_read_buffer = NULL; } if (c) { if (!drawBuffer || !readBuffer) return GL_FALSE; /* must specify buffers! */ if (c == old_ctx && c->xm_buffer == drawBuffer && c->xm_read_buffer == readBuffer) return GL_TRUE; xmesa_check_buffer_size(drawBuffer); if (readBuffer != drawBuffer) xmesa_check_buffer_size(readBuffer); c->xm_buffer = drawBuffer; c->xm_read_buffer = readBuffer; stapi->make_current(stapi, c->st, drawBuffer->stfb, readBuffer->stfb); /* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */ drawBuffer->wasCurrent = GL_TRUE; } else { /* Detach */ stapi->make_current(stapi, NULL, NULL, NULL); } return GL_TRUE; }
GLXContext PUBLIC glXGetCurrentContext(void) { return (GLXContext) XMesaGetCurrentContext(); }