don't try to clear non-existant buffers

This commit is contained in:
Brian Paul 2003-04-29 13:16:37 +00:00
parent 370d7ad007
commit f34de59b3e

View file

@ -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,