mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-08 14:20:30 +01:00
xlib st: Fix makeCurrent.
Flush if we change context. Also reinstate the old optimization of doing nothing if nothing changes. Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
This commit is contained in:
parent
ae36fadb7f
commit
d405ba3151
2 changed files with 17 additions and 11 deletions
|
|
@ -763,7 +763,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
|
|||
|
||||
c->xm_visual = v;
|
||||
c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */
|
||||
|
||||
c->xm_read_buffer = NULL;
|
||||
|
||||
/* XXX: create once per Xlib Display.
|
||||
*/
|
||||
screen = driver.create_pipe_screen();
|
||||
|
|
@ -1037,22 +1038,25 @@ 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 0
|
||||
/* XXX restore this optimization */
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
if (c == old_ctx &&
|
||||
c->xm_buffer == drawBuffer &&
|
||||
c->xm_read_buffer == readBuffer)
|
||||
return GL_TRUE;
|
||||
|
||||
c->xm_buffer = drawBuffer;
|
||||
c->xm_read_buffer = readBuffer;
|
||||
|
||||
/* Call this periodically to detect when the user has begun using
|
||||
* GL rendering from multiple threads.
|
||||
|
|
@ -1071,6 +1075,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
|
|||
else {
|
||||
/* Detach */
|
||||
st_make_current( NULL, NULL, NULL );
|
||||
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ struct xmesa_context {
|
|||
struct st_context *st;
|
||||
XMesaVisual xm_visual; /** pixel format info */
|
||||
XMesaBuffer xm_buffer; /** current drawbuffer */
|
||||
XMesaBuffer xm_read_buffer; /** current readbuffer */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue