added tnl state atom
authorBrian <brian.paul@tungstengraphics.com>
Sat, 18 Aug 2007 15:04:49 +0000 (16:04 +0100)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 18 Aug 2007 15:04:49 +0000 (16:04 +0100)
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom.h
src/mesa/state_tracker/st_atom_vs.c

index 32b8b8f..d67291e 100644 (file)
@@ -46,6 +46,7 @@ static const struct st_tracked_state *atoms[] =
    &st_update_clear_color,
    &st_update_depth,
    &st_update_clip,
+   &st_update_tnl,
    &st_update_vs,
    &st_update_fs,
    &st_update_setup,
index 2f62820..51da489 100644 (file)
@@ -48,6 +48,7 @@ const struct st_tracked_state st_update_framebuffer;
 const struct st_tracked_state st_update_clip;
 const struct st_tracked_state st_update_clear_color;
 const struct st_tracked_state st_update_depth;
+const struct st_tracked_state st_update_tnl;
 const struct st_tracked_state st_update_fs;
 const struct st_tracked_state st_update_vs;
 const struct st_tracked_state st_update_setup;
index cef6e38..c8bd805 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  * 
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  /*
   * Authors:
   *   Keith Whitwell <keith@tungstengraphics.com>
+  *   Brian Paul
   */
 
 #include "shader/prog_parameter.h"
+#include "tnl/t_vp_build.h"
 
 #include "pipe/p_context.h"
 #include "pipe/tgsi/mesa/mesa_to_tgsi.h"
@@ -39,6 +41,7 @@
 #include "st_atom.h"
 #include "st_program.h"
 
+
 #define TGSI_DEBUG 0
 
 static void compile_vs( struct st_context *st,
@@ -59,8 +62,10 @@ static void update_vs( struct st_context *st )
    struct st_vertex_program *vp = NULL;
    struct gl_program_parameter_list *params = NULL;
 
+#if 0
    if (st->ctx->VertexProgram._MaintainTnlProgram)
       _tnl_UpdateFixedFunctionProgram( st->ctx );
+#endif
 
    if (st->ctx->Shader.CurrentProgram &&
        st->ctx->Shader.CurrentProgram->LinkStatus &&
@@ -83,6 +88,7 @@ static void update_vs( struct st_context *st )
    if (vp && params) {
       /* load program's constants array */
 
+      /* XXX this should probably be done elsewhere/separately */
       _mesa_load_state_parameters(st->ctx, params);
 
       vp->constants.nr_constants = params->NumParameters;
@@ -117,3 +123,26 @@ const struct st_tracked_state st_update_vs = {
    },
    .update = update_vs
 };
+
+
+
+
+
+/**
+ * When TnL state has changed, need to generate new vertex program.
+ * This should be done before updating the vertes shader (vs) state.
+ */
+static void update_tnl( struct st_context *st )
+{
+   if (st->ctx->VertexProgram._MaintainTnlProgram)
+      _tnl_UpdateFixedFunctionProgram( st->ctx );
+}
+
+
+const struct st_tracked_state st_update_tnl = {
+   .dirty = {
+      .mesa  = _NEW_PROGRAM | _NEW_LIGHT | _NEW_TEXTURE, /* XXX more? */
+      .st   = ST_NEW_MESA,  /* XXX correct? */
+   },
+   .update = update_tnl
+};