st: do away with dynamic state atom for const buffers
authorBrian Paul <brianp@vmware.com>
Tue, 21 Apr 2009 22:47:30 +0000 (16:47 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 21 Apr 2009 22:47:30 +0000 (16:47 -0600)
Just use the new _NEW_PROGRAM_CONSTANTS flag instead.

src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom_constbuf.c

index f79092291b0a244f1bacaae8fa222988a01746da..ff7d388ddecf103fe1ccc29120839fa2699e0972 100644 (file)
 
        
 
-/* This is used to initialize st->atoms[].  We could use this list
- * directly except for a single atom, st_update_constants, which has a
- * .dirty value which changes according to the parameters of the
- * current fragment and vertex programs, and so cannot be a static
- * value.
+/**
+ * This is used to initialize st->atoms[].
  */
 static const struct st_tracked_state *atoms[] =
 {
@@ -67,25 +64,9 @@ static const struct st_tracked_state *atoms[] =
 
 void st_init_atoms( struct st_context *st )
 {
-   GLuint i;
-
    st->atoms = _mesa_malloc(sizeof(atoms));
    st->nr_atoms = sizeof(atoms)/sizeof(*atoms);
    memcpy(st->atoms, atoms, sizeof(atoms));
-
-   /* Patch in a pointer to the dynamic state atom:
-    */
-   for (i = 0; i < st->nr_atoms; i++) {
-      if (st->atoms[i] == &st_update_vs_constants) {
-        st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_VERTEX];
-        st->atoms[i][0] = st_update_vs_constants;
-      }
-
-      if (st->atoms[i] == &st_update_fs_constants) {
-        st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_FRAGMENT];
-        st->atoms[i][0] = st_update_fs_constants;
-      }
-   }
 }
 
 
index ec3605e4d6f36bbe9483a7269cdbaa4cd926ec54..c31b120ed127ac83bd0d4d8aba11f8fbcce92387 100644 (file)
@@ -62,12 +62,6 @@ void st_upload_constants( struct st_context *st,
    if (params && params->NumParameters) {
       const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4;
 
-      /* Update our own dependency flags.  This works because this
-       * function will also be called whenever the program changes.
-       */
-      st->constants.tracked_state[id].dirty.mesa =
-         (params->StateFlags | _NEW_PROGRAM);
-
       _mesa_load_state_parameters(st->ctx, params);
 
       /* We always need to get a new buffer, to keep the drivers simple and
@@ -111,7 +105,7 @@ static void update_vs_constants(struct st_context *st )
 const struct st_tracked_state st_update_vs_constants = {
    "st_update_vs_constants",                           /* name */
    {                                                   /* dirty */
-      0,  /* set dynamically above */                  /* mesa */
+      _NEW_PROGRAM_CONSTANTS,
       ST_NEW_VERTEX_PROGRAM,                           /* st */
    },
    update_vs_constants                                 /* update */
@@ -130,7 +124,7 @@ static void update_fs_constants(struct st_context *st )
 const struct st_tracked_state st_update_fs_constants = {
    "st_update_fs_constants",                           /* name */
    {                                                   /* dirty */
-      0,  /* set dynamically above */                  /* mesa */
+      _NEW_PROGRAM_CONSTANTS,
       ST_NEW_FRAGMENT_PROGRAM,                         /* st */
    },
    update_fs_constants                                 /* update */