i965: new state dump for sandybridge
[mesa.git] / src / mesa / drivers / dri / mach64 / mach64_state.c
index 99c8bad6c1d378e8b92e879649453298b11b2da1..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 "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
@@ -388,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;
@@ -527,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 ) {
@@ -689,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:
@@ -726,35 +723,32 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
 
    FLUSH_BATCH( mmesa );
 
-   /*
-    * _DrawDestMask is easier to cope with than <mode>.
-    */
-   switch ( ctx->Color._DrawDestMask ) {
-   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 +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;
 }
@@ -1162,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;
@@ -1188,26 +1180,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;
 }