summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11/xm_api.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-03-23 18:01:31 -0600
committerBrian <[email protected]>2007-03-23 18:01:31 -0600
commit8e1c3bd0b4c599bae5b64cd51cec1d74266f30fb (patch)
tree445854d36005acc98e795213e5e39eb2c3fd8bba /src/mesa/drivers/x11/xm_api.c
parent654a3084398c5ab3ac1491bcdc5703221a268d03 (diff)
Implement alpha buffer copy for SwapBuffers().
Nicolai writes: When the pixmap pixel format has no alpha channel, the x11 driver (software rendering) adds a wrapped alpha channel on request. During SwapBuffers, this alpha channel is not copied from back to front, which means that the front buffer doesn't really contain the contents that the back buffer previously contained. A subsequent glReadPixels from the front buffer will return an incorrect result. The following patch attempts to fix this.
Diffstat (limited to 'src/mesa/drivers/x11/xm_api.c')
-rw-r--r--src/mesa/drivers/x11/xm_api.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index b513dc8d40a..24b19d8eb5a 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -363,7 +363,6 @@ static XMesaBuffer
create_xmesa_buffer(XMesaDrawable d, BufferType type,
XMesaVisual vis, XMesaColormap cmap)
{
- GLboolean swAlpha;
XMesaBuffer b;
ASSERT(type == WINDOW || type == PIXMAP || type == PBUFFER);
@@ -421,10 +420,10 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
/* Visual has alpha, but pixel format doesn't support it.
* We'll use an alpha renderbuffer wrapper.
*/
- swAlpha = GL_TRUE;
+ b->swAlpha = GL_TRUE;
}
else {
- swAlpha = GL_FALSE;
+ b->swAlpha = GL_FALSE;
}
/*
@@ -435,9 +434,9 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
vis->mesa_visual.haveDepthBuffer,
vis->mesa_visual.haveStencilBuffer,
vis->mesa_visual.haveAccumBuffer,
- swAlpha,
+ b->swAlpha,
vis->mesa_visual.numAuxBuffers > 0 );
-
+
/* insert buffer into linked list */
b->Next = XMesaBufferList;
XMesaBufferList = b;
@@ -2211,6 +2210,9 @@ void XMesaSwapBuffers( XMesaBuffer b )
);
/*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/
}
+
+ if (b->swAlpha)
+ _mesa_copy_soft_alpha_renderbuffers(ctx, &b->mesa_buffer);
}
#if !defined(XFree86Server)
XSync( b->xm_visual->display, False );