mesa: handle GL_NONE draw buffers correctly in glClear
authorMarek Olšák <marek.olsak@amd.com>
Wed, 8 Jan 2014 00:23:43 +0000 (01:23 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 13 Jan 2014 14:48:07 +0000 (15:48 +0100)
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/clear.c

index f0b525fa017fa47213e3362f62eae5ab21930692..fd5bb35b95734a53b0c9c1a849e66a8be7aa2dd9 100644 (file)
@@ -179,7 +179,11 @@ _mesa_Clear( GLbitfield mask )
       if (mask & GL_COLOR_BUFFER_BIT) {
          GLuint i;
          for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
-            bufferMask |= (1 << ctx->DrawBuffer->_ColorDrawBufferIndexes[i]);
+            GLint buf = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
+
+            if (buf >= 0) {
+               bufferMask |= 1 << buf;
+            }
          }
       }