i965: the brw_constant_buffer state atom is no longer dynamic
authorBrian Paul <brianp@vmware.com>
Wed, 22 Apr 2009 15:23:15 +0000 (09:23 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 22 Apr 2009 15:23:15 +0000 (09:23 -0600)
No more dynamic atoms so we can simplify the state validation code a little.

src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_state_upload.c

index a0b3b06309fa61b0b89e18ce7c4a7c9da4e543cf..af9fef5e22bf942b5616ed4eef3d138f81599310 100644 (file)
@@ -448,8 +448,6 @@ struct brw_context
 
    struct {
       struct brw_state_flags dirty;
-      struct brw_tracked_state **atoms;
-      GLuint nr_atoms;
 
       GLuint nr_color_regions;
       struct intel_region *color_regions[MAX_DRAW_BUFFERS];
@@ -553,11 +551,6 @@ struct brw_context
       GLuint vs_size;
       GLuint total_size;
 
-      /* Dynamic tracker which changes to reflect the state referenced
-       * by active fp and vp program parameters:
-       */
-      struct brw_tracked_state tracked_state;
-
       dri_bo *curbe_bo;
       /** Offset within curbe_bo of space for current curbe entry */
       GLuint curbe_offset;
index 197efeb1b739856612cdbb187d13bbd05869030e..491e2e2452bc1d95bca8d1d4af6b5345d2e9655e 100644 (file)
@@ -102,39 +102,18 @@ const struct brw_tracked_state *atoms[] =
    &brw_indices,
    &brw_vertices,
 
-   NULL,                       /* brw_constant_buffer */
+   &brw_constant_buffer
 };
 
 
 void brw_init_state( struct brw_context *brw )
 {
-   GLuint i;
-
    brw_init_cache(brw);
-
-   brw->state.atoms = _mesa_malloc(sizeof(atoms));
-   brw->state.nr_atoms = sizeof(atoms)/sizeof(*atoms);
-   _mesa_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;
-
-   _mesa_memcpy(&brw->curbe.tracked_state, 
-               &brw_constant_buffer,
-               sizeof(brw_constant_buffer));
 }
 
 
 void brw_destroy_state( struct brw_context *brw )
 {
-   if (brw->state.atoms) {
-      _mesa_free(brw->state.atoms);
-      brw->state.atoms = NULL;
-   }
-
    brw_destroy_cache(brw);
    brw_destroy_batch_cache(brw);
 }
@@ -337,7 +316,7 @@ void brw_validate_state( struct brw_context *brw )
 
    /* do prepare stage for all atoms */
    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 (brw->intel.Fallback)
          break;
@@ -368,8 +347,8 @@ void brw_upload_state(struct brw_context *brw)
       _mesa_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.mesa ||
@@ -398,7 +377,7 @@ void brw_upload_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 (brw->intel.Fallback)
            break;