-/* $Id: buffers.c,v 1.43 2003/03/01 01:50:20 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
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,