i965: new state dump for sandybridge
[mesa.git] / src / mesa / drivers / dri / mach64 / mach64_state.c
index 14d387ab90fdd3ff7796a0dec0603467ca48dd7a..69a5aea02ce2c987bd190c56bf182c179d4b9967 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 "buffers.h"
-#include "enums.h"
-#include "colormac.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"
 
-#include "tnl/t_pipeline.h"
-
 
 /* =============================================================
  * Alpha blending
@@ -389,7 +385,7 @@ static void mach64UpdateClipping( GLcontext *ctx )
    mach64ScreenPtr mach64Screen = mmesa->mach64Screen;
 
    if ( mmesa->driDrawable ) {
-      __DRIdrawablePrivate *drawable = mmesa->driDrawable;
+      __DRIdrawable *drawable = mmesa->driDrawable;
       int x1 = 0;
       int y1 = 0;
       int x2 = drawable->w - 1;
@@ -528,10 +524,10 @@ static void mach64UpdateMasks( GLcontext *ctx )
    /* mach64 can't color mask with alpha blending enabled */
    if ( !ctx->Color.BlendEnabled ) {
       mask = mach64PackColor( mmesa->mach64Screen->cpp,
-                             ctx->Color.ColorMask[RCOMP],
-                             ctx->Color.ColorMask[GCOMP],
-                             ctx->Color.ColorMask[BCOMP],
-                             ctx->Color.ColorMask[ACOMP] );
+                             ctx->Color.ColorMask[0][RCOMP],
+                             ctx->Color.ColorMask[0][GCOMP],
+                             ctx->Color.ColorMask[0][BCOMP],
+                             ctx->Color.ColorMask[0][ACOMP] );
    }
 
    if ( mmesa->setup.dp_write_mask != mask ) {
@@ -647,8 +643,6 @@ static void mach64Viewport( GLcontext *ctx,
                          GLint x, GLint y,
                          GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    mach64CalcViewport( ctx );
 }
 
@@ -692,7 +686,7 @@ static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode )
 void mach64SetCliprects( GLcontext *ctx, GLenum mode )
 {
    mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-   __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
+   __DRIdrawable *dPriv = mmesa->driDrawable;
 
    switch ( mode ) {
    case GL_FRONT_LEFT:
@@ -729,24 +723,26 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
 
    FLUSH_BATCH( mmesa );
 
-   /*
-    * _DrawDestMask is easier to cope with than <mode>.
-    */
-   switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
-   case BUFFER_BIT_FRONT_LEFT:
+   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: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
       break;
-   case BUFFER_BIT_BACK_LEFT:
+   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: 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);
@@ -1026,7 +1022,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;
 }
@@ -1160,12 +1156,10 @@ void mach64DDInitStateFuncs( GLcontext *ctx )
 {
    ctx->Driver.UpdateState             = mach64DDInvalidateState;
 
-   ctx->Driver.ClearIndex              = NULL;
    ctx->Driver.ClearColor              = mach64DDClearColor;
    ctx->Driver.DrawBuffer              = mach64DDDrawBuffer;
    ctx->Driver.ReadBuffer              = mach64DDReadBuffer;
 
-   ctx->Driver.IndexMask               = NULL;
    ctx->Driver.ColorMask               = mach64DDColorMask;
    ctx->Driver.AlphaFunc               = mach64DDAlphaFunc;
    ctx->Driver.BlendEquationSeparate   = mach64DDBlendEquationSeparate;
@@ -1189,19 +1183,4 @@ void mach64DDInitStateFuncs( GLcontext *ctx )
    
    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;
 }