brw_state_upload.c File Reference

Include dependency graph for brw_state_upload.c:

Go to the source code of this file.

Functions

void brw_init_state (struct brw_context *brw)
void brw_destroy_state (struct brw_context *brw)
static boolean check_state (const struct brw_state_flags *a, const struct brw_state_flags *b)
static void accumulate_state (struct brw_state_flags *a, const struct brw_state_flags *b)
static void xor_states (struct brw_state_flags *result, const struct brw_state_flags *a, const struct brw_state_flags *b)
void brw_validate_state (struct brw_context *brw)

Variables

struct brw_tracked_stateatoms []


Function Documentation

static void accumulate_state ( struct brw_state_flags a,
const struct brw_state_flags b 
) [static]

Definition at line 121 of file brw_state_upload.c.

References brw_state_flags::brw, and brw_state_flags::cache.

00123 {
00124    a->brw |= b->brw;
00125    a->cache |= b->cache;
00126 }

void brw_destroy_state ( struct brw_context brw  ) 

Definition at line 104 of file brw_state_upload.c.

References brw_destroy_batch_cache(), brw_destroy_caches(), and brw_destroy_pools().

00105 {
00106    brw_destroy_caches(brw);
00107    brw_destroy_batch_cache(brw);
00108    brw_destroy_pools(brw);
00109 }

void brw_init_state ( struct brw_context brw  ) 

Definition at line 94 of file brw_state_upload.c.

References brw_state_flags::brw, brw_init_caches(), brw_init_pools(), brw_context::dirty, brw_context::emit_state_always, and brw_context::state.

00095 {
00096    brw_init_pools(brw);
00097    brw_init_caches(brw);
00098 
00099    brw->state.dirty.brw = ~0;
00100    brw->emit_state_always = 0;
00101 }

void brw_validate_state ( struct brw_context brw  ) 

Definition at line 141 of file brw_state_upload.c.

References accumulate_state(), assert, brw_state_flags::brw, brw_clear_batch_cache_flush(), BRW_DEBUG, BRW_NEW_SCENE, brw_state_flags::cache, check_state(), brw_tracked_state::dirty, brw_context::dirty, Elements, brw_context::emit_state_always, brw_context::state, brw_tracked_state::update, and xor_states().

00142 {
00143    struct brw_state_flags *state = &brw->state.dirty;
00144    unsigned i;
00145 
00146    if (brw->emit_state_always) 
00147       state->brw |= ~0;
00148 
00149    if (state->cache == 0 &&
00150        state->brw == 0)
00151       return;
00152 
00153    if (brw->state.dirty.brw & BRW_NEW_SCENE)
00154       brw_clear_batch_cache_flush(brw);
00155 
00156    if (BRW_DEBUG) {
00157       /* Debug version which enforces various sanity checks on the
00158        * state flags which are generated and checked to help ensure
00159        * state atoms are ordered correctly in the list.
00160        */
00161       struct brw_state_flags examined, prev;
00162       memset(&examined, 0, sizeof(examined));
00163       prev = *state;
00164 
00165       for (i = 0; i < Elements(atoms); i++) {
00166          const struct brw_tracked_state *atom = atoms[i];
00167          struct brw_state_flags generated;
00168 
00169          assert(atom->dirty.brw ||
00170                 atom->dirty.cache);
00171          assert(atom->update);
00172 
00173          if (check_state(state, &atom->dirty)) {
00174             atom->update( brw );
00175          }
00176 
00177          accumulate_state(&examined, &atom->dirty);
00178 
00179          /* generated = (prev ^ state)
00180           * if (examined & generated)
00181           *     fail;
00182           */
00183          xor_states(&generated, &prev, state);
00184          assert(!check_state(&examined, &generated));
00185          prev = *state;
00186       }
00187    }
00188    else {
00189       for (i = 0; i < Elements(atoms); i++) {
00190          const struct brw_tracked_state *atom = atoms[i];
00191 
00192          assert(atom->dirty.brw ||
00193                 atom->dirty.cache);
00194          assert(atom->update);
00195 
00196          if (check_state(state, &atom->dirty))
00197             atom->update( brw );
00198       }
00199    }
00200 
00201    memset(state, 0, sizeof(*state));
00202 }

static boolean check_state ( const struct brw_state_flags a,
const struct brw_state_flags b 
) [static]

Definition at line 114 of file brw_state_upload.c.

References brw_state_flags::brw, and brw_state_flags::cache.

00116 {
00117    return ((a->brw & b->brw) ||
00118            (a->cache & b->cache));
00119 }

static void xor_states ( struct brw_state_flags result,
const struct brw_state_flags a,
const struct brw_state_flags b 
) [static]

Definition at line 129 of file brw_state_upload.c.

References brw_state_flags::brw, and brw_state_flags::cache.

00132 {
00133    result->brw = a->brw ^ b->brw;
00134    result->cache = a->cache ^ b->cache;
00135 }


Variable Documentation

struct brw_tracked_state* atoms[]

Definition at line 44 of file brw_state_upload.c.


Generated on Tue Sep 29 06:25:38 2009 for Gallium3D by  doxygen 1.5.4