Fixed MAXFIFO_S4. Removed WAIT_IDLE_EMPTY from savage_BCI_swap which resulted
[mesa.git] / src / mesa / tnl / t_context.c
index 383e50601e2afff8ad95bde56efbec7a12604b7f..2c529afd79ed4dcaa26c5de4007a3b4f4e2c81b3 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Mesa 3-D graphics library
  * Version:  5.1
 #include "api_arrayelt.h"
 #include "glheader.h"
 #include "imports.h"
+#include "context.h"
 #include "macros.h"
 #include "mtypes.h"
 #include "dlist.h"
 #include "light.h"
 #include "vtxfmt.h"
+#include "nvfragprog.h"
 
 #include "t_context.h"
 #include "t_array_api.h"
@@ -101,6 +102,8 @@ _tnl_CreateContext( GLcontext *ctx )
    tnl->NeedNdcCoords = GL_TRUE;
    tnl->LoopbackDListCassettes = GL_FALSE;
    tnl->CalcDListNormalLengths = GL_TRUE;
+   tnl->AllowVertexFog = GL_TRUE;
+   tnl->AllowPixelFog = GL_TRUE;
 
    /* Hook our functions into exec and compile dispatch tables.
     */
@@ -131,6 +134,7 @@ _tnl_DestroyContext( GLcontext *ctx )
    _tnl_vtx_destroy( ctx );
    _tnl_save_destroy( ctx );
    _tnl_destroy_pipeline( ctx );
+   _ae_destroy_context( ctx );
 
    FREE(tnl);
    ctx->swtnl_context = 0;
@@ -142,15 +146,51 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
 
+   if (new_state & (_NEW_HINT)) {
+      ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog);
+      tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST))
+         || !tnl->AllowPixelFog;
+   }
+
    if (new_state & _NEW_ARRAY) {
       tnl->pipeline.run_input_changes |= ctx->Array.NewState; /* overkill */
    }
 
+   _ae_invalidate_state(ctx, new_state);
+
    tnl->pipeline.run_state_changes |= new_state;
    tnl->pipeline.build_state_changes |= (new_state &
                                         tnl->pipeline.build_state_trigger);
 
    tnl->vtx.eval.new_state |= new_state;
+
+   /* Calculate tnl->render_inputs:
+    */
+   if (ctx->Visual.rgbMode) {
+      tnl->render_inputs = (_TNL_BIT_POS|
+                           _TNL_BIT_COLOR0|
+                           (ctx->Texture._EnabledCoordUnits << _TNL_ATTRIB_TEX0));
+
+      if (NEED_SECONDARY_COLOR(ctx))
+        tnl->render_inputs |= _TNL_BIT_COLOR1;
+   }
+   else {
+      tnl->render_inputs |= (_TNL_BIT_POS|_TNL_BIT_INDEX);
+   }
+    
+   if (ctx->Fog.Enabled)
+      tnl->render_inputs |= _TNL_BIT_FOG;
+
+   if (ctx->Polygon.FrontMode != GL_FILL || 
+       ctx->Polygon.BackMode != GL_FILL)
+      tnl->render_inputs |= _TNL_BIT_EDGEFLAG;
+
+   if (ctx->RenderMode == GL_FEEDBACK)
+      tnl->render_inputs |= _TNL_BIT_TEX0;
+
+   if (ctx->Point._Attenuated ||
+       (ctx->VertexProgram.Enabled && ctx->VertexProgram.PointSizeEnabled))
+      tnl->render_inputs |= _TNL_BIT_POINTSIZE;
 }
 
 
@@ -227,3 +267,18 @@ _tnl_isolate_materials( GLcontext *ctx, GLboolean mode )
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    tnl->IsolateMaterials = mode;
 }
+
+void
+_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value )
+{
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+   tnl->AllowVertexFog = value;
+}
+
+void
+_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value )
+{
+   TNLcontext *tnl = TNL_CONTEXT(ctx);
+   tnl->AllowPixelFog = value;
+}
+