From: Brian Paul Date: Fri, 23 Sep 2005 01:17:07 +0000 (+0000) Subject: improve the test for using software alpha buffer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5fce1694cdfca615022bf7b987835384902aceb;p=mesa.git improve the test for using software alpha buffer --- diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 53ee56e46cb..a402d608e04 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -340,6 +340,8 @@ alloc_xmesa_buffer(XMesaVisual vis, BufferType type, XMesaColormap cmap) { XMesaBuffer b = (XMesaBuffer) CALLOC_STRUCT(xmesa_buffer); if (b) { + GLboolean swAlpha; + b->display = vis->display; b->xm_visual = vis; b->type = type; @@ -369,12 +371,25 @@ alloc_xmesa_buffer(XMesaVisual vis, BufferType type, XMesaColormap cmap) &b->backxrb->Base); } + /* determine if we need software alpha planes */ + if (vis->mesa_visual.alphaBits > 0 + && vis->undithered_pf != PF_8A8B8G8R + && vis->undithered_pf != PF_8A8R8G8B) { + /* Visual has alpha, but pixel format doesn't support it. + * We'll use an alpha renderbuffer wrapper. + */ + swAlpha = GL_TRUE; + } + else { + swAlpha = GL_FALSE; + } + _mesa_add_soft_renderbuffers(&b->mesa_buffer, GL_FALSE, /* color */ vis->mesa_visual.haveDepthBuffer, vis->mesa_visual.haveStencilBuffer, vis->mesa_visual.haveAccumBuffer, - vis->mesa_visual.alphaBits > 0, + swAlpha, vis->mesa_visual.numAuxBuffers > 0 ); /* insert into linked list */