965: use state atom array directly
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 13 Dec 2007 10:55:16 +0000 (10:55 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 13 Dec 2007 15:37:19 +0000 (15:37 +0000)
src/mesa/pipe/i965simple/brw_state_upload.c

index 1ca74849587d4c969a5cfc4904aa05d815a04e17..10f1d4812aa9c5ec229f42b6f3d58daa2de12421 100644 (file)
@@ -102,34 +102,13 @@ void brw_init_state( struct brw_context *brw )
    brw_init_pools(brw);
    brw_init_caches(brw);
 
-   brw->state.atoms = MALLOC(sizeof(atoms));
-   brw->state.nr_atoms = sizeof(atoms)/sizeof(*atoms);
-   memcpy(brw->state.atoms, atoms, sizeof(atoms));
-
-   /* Patch in a pointer to the dynamic state atom:
-    */
-   for (i = 0; i < brw->state.nr_atoms; i++)
-      if (brw->state.atoms[i] == NULL)
-        brw->state.atoms[i] = &brw->curbe.tracked_state;
-
-   memcpy(&brw->curbe.tracked_state,
-               &brw_constant_buffer,
-               sizeof(brw_constant_buffer));
-
    brw->state.dirty.brw = ~0;
    brw->emit_state_always = 0;
-
-
 }
 
 
 void brw_destroy_state( struct brw_context *brw )
 {
-   if (brw->state.atoms) {
-      FREE(brw->state.atoms);
-      brw->state.atoms = NULL;
-   }
-
    brw_destroy_caches(brw);
    brw_destroy_batch_cache(brw);
    brw_destroy_pools(brw);
@@ -189,21 +168,17 @@ void brw_validate_state( struct brw_context *brw )
       memset(&examined, 0, sizeof(examined));
       prev = *state;
 
-      for (i = 0; i < brw->state.nr_atoms; i++) {
-        const struct brw_tracked_state *atom = brw->state.atoms[i];
+      for (i = 0; i < Elements(atoms); i++) {
+        const struct brw_tracked_state *atom = atoms[i];
         struct brw_state_flags generated;
 
         assert(atom->dirty.brw ||
                atom->dirty.cache);
         assert(atom->update);
 
-        if (check_state(state, &atom->dirty) || atom->always_update) {
+        if (check_state(state, &atom->dirty)) {
            atom->update( brw );
-
-/*         emit_foo(brw); */
         }
-        if (atom->emit_reloc != NULL)
-           atom->emit_reloc(brw);
 
         accumulate_state(&examined, &atom->dirty);
 
@@ -218,12 +193,10 @@ void brw_validate_state( struct brw_context *brw )
    }
    else {
       for (i = 0; i < Elements(atoms); i++) {
-        const struct brw_tracked_state *atom = brw->state.atoms[i];
+        const struct brw_tracked_state *atom = atoms[i];
 
-        if (check_state(state, &atom->dirty) || atom->always_update)
+        if (check_state(state, &atom->dirty))
            atom->update( brw );
-        if (atom->emit_reloc != NULL)
-           atom->emit_reloc(brw);
       }
    }