Merge branch 'master' into gallium-0.2
[mesa.git] / src / mesa / drivers / dri / mach64 / mach64_state.c
index 91f588bb78811746bdd92812c56b01897484a014..3a023187ce73f776c1d3b0caec2197c678140753 100644 (file)
@@ -1,4 +1,4 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
+/* -*- mode: c; c-basic-offset: 3 -*- */
 /*
  * Copyright 2000 Gareth Hughes
  * All Rights Reserved.
 #include "mach64_vb.h"
 #include "mach64_tex.h"
 
-#include "context.h"
-#include "enums.h"
-#include "colormac.h"
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/colormac.h"
 #include "swrast/swrast.h"
-#include "array_cache/acache.h"
+#include "vbo/vbo.h"
 #include "tnl/tnl.h"
 #include "swrast_setup/swrast_setup.h"
 
@@ -726,35 +726,32 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
 
    FLUSH_BATCH( mmesa );
 
-   /*
-    * _DrawDestMask is easier to cope with than <mode>.
-    */
-   switch ( ctx->Color._DrawDestMask[0] ) {
-   case DD_FRONT_LEFT_BIT:
+   if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
+      /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
+      FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_TRUE );
+      return;
+   }
+
+   switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
+   case BUFFER_FRONT_LEFT:
       FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
       mach64SetCliprects( ctx, GL_FRONT_LEFT );
       if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
-        fprintf(stderr,"%s: DD_FRONT_LEFT_BIT\n", __FUNCTION__);
+        fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
       break;
-   case DD_BACK_LEFT_BIT:
+   case BUFFER_BACK_LEFT:
       FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
       mach64SetCliprects( ctx, GL_BACK_LEFT );
       if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
-        fprintf(stderr,"%s: DD_BACK_LEFT_BIT\n", __FUNCTION__);
+        fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
       break;
    default:
-      /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
       FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_TRUE );
       if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
         fprintf(stderr,"%s: fallback (mode=%d)\n", __FUNCTION__, mode);
       break;
    }
 
-   /* We want to update the s/w rast state too so that mach64SetBuffer()
-    * gets called.
-    */
-   _swrast_DrawBuffer(ctx, mode);
-
    mmesa->setup.dst_off_pitch = (((mmesa->drawPitch/8) << 22) |
                                 (mmesa->drawOffset >> 3));
 
@@ -1028,7 +1025,7 @@ static void mach64DDInvalidateState( GLcontext *ctx, GLuint new_state )
 {
    _swrast_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
-   _ac_InvalidateState( ctx, new_state );
+   _vbo_InvalidateState( ctx, new_state );
    _tnl_InvalidateState( ctx, new_state );
    MACH64_CONTEXT(ctx)->NewGLState |= new_state;
 }
@@ -1188,26 +1185,7 @@ void mach64DDInitStateFuncs( GLcontext *ctx )
    ctx->Driver.RenderMode              = mach64DDRenderMode;
    ctx->Driver.Scissor                 = mach64DDScissor;
    ctx->Driver.ShadeModel              = mach64DDShadeModel;
-   ctx->Driver.ClearStencil            = NULL;
-   ctx->Driver.StencilFunc             = NULL;
-   ctx->Driver.StencilMask             = NULL;
-   ctx->Driver.StencilOp               = NULL;
    
    ctx->Driver.DepthRange              = mach64DepthRange;
    ctx->Driver.Viewport                        = mach64Viewport;
-   
-   /* Pixel path fallbacks.
-    */
-   ctx->Driver.Accum = _swrast_Accum;
-   ctx->Driver.Bitmap = _swrast_Bitmap;
-   ctx->Driver.CopyPixels = _swrast_CopyPixels;
-   ctx->Driver.DrawPixels = _swrast_DrawPixels;
-   ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
-   /* Swrast hooks for imaging extensions:
-    */
-   ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
-   ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
-   ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
-   ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
 }