--- src/misc.c.orig	Sun Mar  7 19:14:46 1999
+++ src/misc.c	Sun Mar  7 19:14:51 1999
@@ -260,8 +263,17 @@
       width  = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
 
       /* let device driver try to clear the buffers */
-      newMask = (*ctx->Driver.Clear)( ctx, mask, !ctx->Scissor.Enabled,
+      if ((mask & GL_COLOR_BUFFER_BIT) != 0 && ctx->Color.SWmasking) {
+         /* driver can't clear color buffer with color/index masking */
+         GLbitfield mask2 = mask & (~GL_COLOR_BUFFER_BIT);
+         newMask = (*ctx->Driver.Clear)( ctx, mask2, !ctx->Scissor.Enabled,
                                       x, y, width, height );
+         newMask |= GL_COLOR_BUFFER_BIT;
+      }
+      else {
+         newMask = (*ctx->Driver.Clear)( ctx, mask, !ctx->Scissor.Enabled,
+                                         x, y, width, height );
+      }
 
       /* check if only clearing of alpha buffer needed */
       if ( (mask & GL_COLOR_BUFFER_BIT) &&
