TNL module needs to implement ctx->Driver.ProgramStringNotify() function
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 28 Oct 2005 14:32:49 +0000 (14:32 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 28 Oct 2005 14:32:49 +0000 (14:32 +0000)
so that calls to glProgramStringARB() to specify a new program causes the
TNL-attached data to get recomputed.

src/mesa/drivers/common/driverfuncs.c
src/mesa/tnl/t_vb_arbprogram.c
src/mesa/tnl/tnl.h

index 8503135a87490fb79d359ad76cccf4013bebc433..9fe4ee3ad2db9a9022fc51b04d5ab87af0f7aa14 100644 (file)
@@ -45,6 +45,7 @@
 #endif
 
 #include "driverfuncs.h"
+#include "tnl/tnl.h"
 #include "swrast/swrast.h"
 
 
@@ -222,6 +223,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    driver->NeedFlush = 0;
    driver->SaveNeedFlush = 0;
 
+   driver->ProgramStringNotify = _tnl_program_string;
    driver->FlushVertices = NULL;
    driver->SaveFlushVertices = NULL;
    driver->NotifySaveBegin = NULL;
index 08b9ffc88985d4cb6cc6db3f21ec11a429f735ea..8b168356770697030b5908b257fba1be8aa570c5 100644 (file)
@@ -43,6 +43,7 @@
 #include "t_pipeline.h"
 #include "t_vb_arbprogram.h"
 
+
 #define DISASSEM 0
 
 /*--------------------------------------------------------------------------- */
@@ -1459,3 +1460,20 @@ const struct tnl_pipeline_stage _tnl_arb_vertex_program_stage =
    validate_vertex_program,    /* validate */
    run_arb_vertex_program      /* run */
 };
+
+
+/**
+ * Called via ctx->Driver.ProgramStringNotify() after a new vertex program
+ * string has been parsed.
+ */
+void
+_tnl_program_string(GLcontext *ctx, GLenum target, struct program *program)
+{
+   if (target == GL_VERTEX_PROGRAM_ARB) {
+      /* free any existing tnl data hanging off the program */
+      struct vertex_program *vprog = (struct vertex_program *) program;
+      if (vprog->TnlData) {
+         free_tnl_data(vprog);
+      }
+   }
+}
index d04310fb53e4c74936f02c582f27bb3b803188a4..428fe12788aebeb3ccbd86feeda82f401fcab023 100644 (file)
@@ -83,5 +83,7 @@ _tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value );
 extern void
 _tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value );
 
+extern void
+_tnl_program_string(GLcontext *ctx, GLenum target, struct program *program);
 
 #endif