summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-22 21:11:55 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-22 21:11:55 -0700
commit2a077500a84819d1e6ac62e84ded130aa655c5e9 (patch)
treee16cbba8051acc5ee5fc4409e5697e11d0041989 /src/mesa/drivers/x11
parente1ae5b89fce51ce1138a5cbe93caa0e1fccf219f (diff)
Fix some issues with glDrawBuffer(GL_NONE), bug 14198
Set _ColorDrawBuffers[0] = NULL if no renderbuffers enabled. Check that _ColorDrawBuffers[0] is non-null before dereferencing in a few places.
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/xm_dd.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index e7d41401f9..56c30ab949 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -436,7 +436,12 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx,
{
const SWcontext *swrast = SWRAST_CONTEXT( ctx );
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
- struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped);
+ struct xmesa_renderbuffer *xrb;
+
+ if (!rb)
+ return;
+
+ xrb = xmesa_renderbuffer(rb->Wrapped);
if (swrast->NewState)
_swrast_validate_derived( ctx );
@@ -543,18 +548,22 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels )
{
- struct xmesa_renderbuffer *xrb
- = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped);
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
const SWcontext *swrast = SWRAST_CONTEXT( ctx );
XMesaDisplay *dpy = xmesa->xm_visual->display;
XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */
+ struct xmesa_renderbuffer *xrb;
ASSERT(dpy);
ASSERT(gc);
ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B);
+ if (!ctx->DrawBuffer->_ColorDrawBuffers[0])
+ return;
+
+ xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped);
+
if (swrast->NewState)
_swrast_validate_derived( ctx );
@@ -651,14 +660,18 @@ xmesa_CopyPixels( GLcontext *ctx,
XMesaDisplay *dpy = xmesa->xm_visual->display;
XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */
- struct xmesa_renderbuffer *srcXrb
- = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped);
- struct xmesa_renderbuffer *dstXrb
- = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped);
+ struct xmesa_renderbuffer *srcXrb, *dstXrb;
+
+ if (!ctx->ReadBuffer->_ColorReadBuffer ||
+ !ctx->DrawBuffer->_ColorDrawBuffers[0])
+ return;
ASSERT(dpy);
ASSERT(gc);
+ srcXrb = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped);
+ dstXrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped);
+
if (swrast->NewState)
_swrast_validate_derived( ctx );