radeon: add more fbconfigs
[mesa.git] / src / mesa / tnl / t_pipeline.c
index 914121969c9b76fd80e7c8a149489c8548df20b5..357ef1e24b5bf4914fe2b3e3b4e31d86eb314ae3 100644 (file)
@@ -1,9 +1,8 @@
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.5.3
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  *    Keith Whitwell <keith@tungstengraphics.com>
  */
 
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
-#include "state.h"
-#include "mtypes.h"
-
-#include "math/m_translate.h"
-#include "math/m_xform.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
+#include "main/state.h"
+#include "main/mtypes.h"
 
 #include "t_context.h"
 #include "t_pipeline.h"
 #include "t_vp_build.h"
+#include "t_vertex.h"
 
 void _tnl_install_pipeline( GLcontext *ctx,
                            const struct tnl_pipeline_stage **stages )
@@ -80,7 +77,7 @@ static GLuint check_input_changes( GLcontext *ctx )
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    GLuint i;
    
-   for (i = 0; i < _TNL_ATTRIB_EDGEFLAG; i++) {
+   for (i = 0; i <= _TNL_LAST_MAT; i++) {
       if (tnl->vb.AttribPtr[i]->size != tnl->pipeline.last_attrib_size[i] ||
          tnl->vb.AttribPtr[i]->stride != tnl->pipeline.last_attrib_stride[i]) {
         tnl->pipeline.last_attrib_size[i] = tnl->vb.AttribPtr[i]->size;
@@ -89,11 +86,15 @@ static GLuint check_input_changes( GLcontext *ctx )
       }
    }
 
+   if (tnl->pipeline.input_changes &&
+      tnl->Driver.NotifyInputChanges) 
+      tnl->Driver.NotifyInputChanges( ctx, tnl->pipeline.input_changes );
+
    return tnl->pipeline.input_changes;
 }
 
 
-static void check_output_changes( GLcontext *ctx )
+static GLuint check_output_changes( GLcontext *ctx )
 {
 #if 0
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -109,6 +110,10 @@ static void check_output_changes( GLcontext *ctx )
 
    if (tnl->pipeline.output_changes) 
       tnl->Driver.NotifyOutputChanges( ctx, tnl->pipeline.output_changes );
+   
+   return tnl->pipeline.output_changes;
+#else
+   return ~0;
 #endif
 }
 
@@ -126,6 +131,9 @@ void _tnl_run_pipeline( GLcontext *ctx )
     * (ie const or non-const).
     */
    if (check_input_changes( ctx ) || tnl->pipeline.new_state) {
+      if (ctx->VertexProgram._MaintainTnlProgram)
+        _tnl_UpdateFixedFunctionProgram( ctx );
+
       for (i = 0; i < tnl->pipeline.nr_stages ; i++) {
         struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i];
         if (s->validate)
@@ -134,10 +142,15 @@ void _tnl_run_pipeline( GLcontext *ctx )
       
       tnl->pipeline.new_state = 0;
       tnl->pipeline.input_changes = 0;
-      check_output_changes( ctx );
+      
+      /* Pipeline can only change its output in response to either a
+       * statechange or an input size/stride change.  No other changes
+       * are allowed.
+       */
+      if (check_output_changes( ctx ))
+        _tnl_notify_pipeline_output_change( ctx );
    }
 
-
    START_FAST_MATH(__tmp);
 
    for (i = 0; i < tnl->pipeline.nr_stages ; i++) {
@@ -183,20 +196,20 @@ void _tnl_run_pipeline( GLcontext *ctx )
  * case, if it becomes necessary to do so.
  */
 const struct tnl_pipeline_stage *_tnl_default_pipeline[] = {
-#if TNL_FIXED_FUNCTION_PROGRAM
-   &_tnl_arb_vertex_program_stage,
-#else
    &_tnl_vertex_transform_stage,
    &_tnl_normal_transform_stage,
    &_tnl_lighting_stage,
-   &_tnl_fog_coordinate_stage,
    &_tnl_texgen_stage,
    &_tnl_texture_transform_stage,
    &_tnl_point_attenuation_stage,
-#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_ARB_vertex_program)
-   &_tnl_vertex_program_stage,
-#endif
-#endif
+   &_tnl_vertex_program_stage, 
+   &_tnl_fog_coordinate_stage,
    &_tnl_render_stage,
    NULL 
 };
+
+const struct tnl_pipeline_stage *_tnl_vp_pipeline[] = {
+   &_tnl_vertex_program_stage,
+   &_tnl_render_stage,
+   NULL
+};