check for null DrawBuffer values
authorKeith Whitwell <keith@tungstengraphics.com>
Mon, 9 May 2005 17:42:18 +0000 (17:42 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 9 May 2005 17:42:18 +0000 (17:42 +0000)
src/mesa/drivers/dri/i915/intel_context.c
src/mesa/drivers/dri/i915/intel_pixel.c
src/mesa/drivers/dri/i915/intel_state.c

index 0dabfad5ffddfc190135bca4bb9fdf6c1cc21bd6..f6012373534f137ff198883e89bd7a8925f4701f 100644 (file)
@@ -494,17 +494,22 @@ void intelSetBackClipRects( intelContextPtr intel )
 
 void intelWindowMoved( intelContextPtr intel )
 {
-   switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
-   case BUFFER_BIT_FRONT_LEFT:
-      intelSetFrontClipRects( intel );
-      break;
-   case BUFFER_BIT_BACK_LEFT:
-      intelSetBackClipRects( intel );
-      break;
-   default:
-      /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
+   if (!intel->ctx.DrawBuffer) {
       intelSetFrontClipRects( intel );
    }
+   else {
+      switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
+      case BUFFER_BIT_FRONT_LEFT:
+        intelSetFrontClipRects( intel );
+        break;
+      case BUFFER_BIT_BACK_LEFT:
+        intelSetBackClipRects( intel );
+        break;
+      default:
+        /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
+        intelSetFrontClipRects( intel );
+      }
+   }
 }
 
 GLboolean intelUnbindContext(__DRIcontextPrivate *driContextPriv)
@@ -529,6 +534,8 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
       _mesa_make_current(&intel->ctx,
                         (GLframebuffer *) driDrawPriv->driverPrivate,
                         (GLframebuffer *) driReadPriv->driverPrivate);
+
+      intel->ctx.Driver.DrawBuffer( &intel->ctx, intel->ctx.Color.DrawBuffer[0] );
    } else {
       _mesa_make_current(NULL, NULL, NULL);
    }
index d842273a80d7a6fb9e82c91ba673efabddc270d2..e56e46b4d7f081bcb2171c91d5c33f08bb17bb1e 100644 (file)
@@ -286,6 +286,7 @@ static void do_draw_pix( GLcontext *ctx,
 
    intelFlush( &intel->ctx );
    LOCK_HARDWARE( intel );
+   if (ctx->DrawBuffer)
    {
       y -= height;                     /* cope with pixel zoom */
    
index db6a140d2d56d88cdc25697293c42a2ce5c2aca4..cf1f3c5803616ae01b964ba3d9784704e87eaae8 100644 (file)
@@ -170,6 +170,9 @@ static void intelDrawBuffer(GLcontext *ctx, GLenum mode )
    intelScreenPrivate *screen = intel->intelScreen;
    int front = 0;
  
+   if (!ctx->DrawBuffer)
+      return;
+
    switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
    case BUFFER_BIT_FRONT_LEFT:
       front = 1;