move _mesa_load_state_parameters() to state validation stage
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 27 Feb 2004 02:13:29 +0000 (02:13 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 27 Feb 2004 02:13:29 +0000 (02:13 +0000)
src/mesa/swrast/s_context.c
src/mesa/swrast/s_nvfragprog.c

index 800f79080f88208f413153c9fdac2cf1c64288f8..0a81048e6f598b65e02c67a3a958d34b4986b4b9 100644 (file)
@@ -30,6 +30,7 @@
 #include "context.h"
 #include "colormac.h"
 #include "mtypes.h"
+#include "program.h"
 #include "texobj.h"
 #include "nvfragprog.h"
 
@@ -201,6 +202,16 @@ _swrast_update_fog_state( GLcontext *ctx )
 }
 
 
+static void
+_swrast_update_fragment_program( GLcontext *ctx )
+{
+   if (ctx->FragmentProgram.Enabled) {
+      struct fragment_program *program = ctx->FragmentProgram.Current;
+      _mesa_load_state_parameters(ctx, program->Parameters);
+   }
+}
+
+
 
 #define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK |  \
                             _NEW_TEXTURE |             \
@@ -432,9 +443,11 @@ _swrast_validate_derived( GLcontext *ctx )
       if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE)
         _swrast_update_texture_env( ctx );
 
-      if (swrast->NewState & _NEW_FOG) {
+      if (swrast->NewState & _NEW_FOG)
          _swrast_update_fog_state( ctx );
-      }
+
+      if (swrast->NewState & _NEW_PROGRAM)
+        _swrast_update_fragment_program( ctx );
 
       swrast->NewState = 0;
       swrast->StateChanges = 0;
index 62f95706d9ac029dbe917de38b3f2ea99181b161..ace531e0e2a06a548439003c8abb607afe1749c9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.0
+ * Version:  6.1
  *
  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
  *
@@ -586,11 +586,6 @@ execute_program( GLcontext *ctx,
    printf("execute fragment program --------------------\n");
 #endif
 
-   /* XXX: This should go someplace else, but it is safe here (and slow!) 
-    *        - karl
-    */
-   _mesa_load_state_parameters(ctx, program->Parameters); 
-
    for (pc = 0; pc < maxInst; pc++) {
       const struct fp_instruction *inst = program->Instructions + pc;