diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2003-04-29 13:16:37 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2003-04-29 13:16:37 +0000 |
commit | f34de59b3eb631f98db907aea04b055c87f77900 (patch) | |
tree | d19fae54cad7f245239f59852836a7be004cea24 /src | |
parent | 370d7ad007fc9a083c958fe12c1fa834aefb3c61 (diff) |
don't try to clear non-existant buffers
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/buffers.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index ab579b3d33..f7e922e2a2 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -1,5 +1,3 @@ -/* $Id: buffers.c,v 1.43 2003/03/01 01:50:20 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -118,13 +116,19 @@ _mesa_Clear( GLbitfield mask ) if (!ctx->Depth.Mask) mask &= ~GL_DEPTH_BUFFER_BIT; - /* Build bitmask to send to driver Clear function */ - ddMask = mask & (GL_DEPTH_BUFFER_BIT | - GL_STENCIL_BUFFER_BIT | - GL_ACCUM_BUFFER_BIT); - if (mask & GL_COLOR_BUFFER_BIT) { + /* Build the bitmask to send to device driver's Clear function. + * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 + * of the FRONT/BACK_LEFT/RIGHT_BIT flags. + */ + ddMask = 0; + if (mask & GL_COLOR_BUFFER_BIT) ddMask |= ctx->Color._DrawDestMask; - } + if ((mask & GL_DEPTH_BUFFER_BIT) && ctx->Visual.depthBits > 0) + ddMask |= GL_DEPTH_BUFFER_BIT; + if ((mask & GL_STENCIL_BUFFER_BIT) && ctx->Visual.stencilBits > 0) + ddMask |= GL_STENCIL_BUFFER_BIT; + if ((mask & GL_ACCUM_BUFFER_BIT) && ctx->Visual.accumRedBits > 0) + ddMask |= GL_ACCUM_BUFFER_BIT; ASSERT(ctx->Driver.Clear); ctx->Driver.Clear( ctx, ddMask, (GLboolean) !ctx->Scissor.Enabled, |