mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
965: use state atom array directly
This commit is contained in:
parent
4844b9fb9d
commit
1f1506ec94
1 changed files with 5 additions and 32 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue