From 1f1506ec94f3d44091de88d8bcd7ab9c20a6e7b2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 13 Dec 2007 10:55:16 +0000 Subject: [PATCH] 965: use state atom array directly --- src/mesa/pipe/i965simple/brw_state_upload.c | 37 +++------------------ 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/src/mesa/pipe/i965simple/brw_state_upload.c b/src/mesa/pipe/i965simple/brw_state_upload.c index 1ca74849587..10f1d4812aa 100644 --- a/src/mesa/pipe/i965simple/brw_state_upload.c +++ b/src/mesa/pipe/i965simple/brw_state_upload.c @@ -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); } } -- 2.30.2