nv40: move hw_dirty

This commit is contained in:
Ben Skeggs 2008-02-22 13:55:18 +11:00
parent 5b2ff28a2f
commit c2e36bdd1a
3 changed files with 19 additions and 19 deletions

View file

@ -115,7 +115,9 @@ struct nv40_blend_state {
struct nv40_state {
unsigned scissor_enabled;
unsigned stipple_enabled;
unsigned fp_samplers;
unsigned dirty;
struct nouveau_stateobj *hw[NV40_STATE_MAX];
};
@ -129,13 +131,10 @@ struct nv40_context {
int chipset;
unsigned dirty;
unsigned hw_dirty;
struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
unsigned dirty_samplers;
unsigned fp_samplers;
unsigned vp_samplers;
struct {
struct pipe_scissor_state scissor;

View file

@ -124,10 +124,11 @@ static boolean
nv40_fragtex_validate(struct nv40_context *nv40)
{
struct nv40_fragment_program *fp = nv40->pipe_state.fragprog;
struct nv40_state *state = &nv40->state;
struct nouveau_stateobj *so;
unsigned samplers, unit;
samplers = nv40->fp_samplers & ~fp->samplers;
samplers = state->fp_samplers & ~fp->samplers;
while (samplers) {
unit = ffs(samplers) - 1;
samplers &= ~(1 << unit);
@ -137,7 +138,7 @@ nv40_fragtex_validate(struct nv40_context *nv40)
so_data (so, 0);
so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
so_ref(NULL, &so);
nv40->hw_dirty |= (1 << (NV40_STATE_FRAGTEX0 + unit));
state->dirty |= (1 << (NV40_STATE_FRAGTEX0 + unit));
}
samplers = nv40->dirty_samplers & fp->samplers;
@ -148,10 +149,10 @@ nv40_fragtex_validate(struct nv40_context *nv40)
so = nv40_fragtex_build(nv40, unit);
so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
so_ref(NULL, &so);
nv40->hw_dirty |= (1 << (NV40_STATE_FRAGTEX0 + unit));
state->dirty |= (1 << (NV40_STATE_FRAGTEX0 + unit));
}
nv40->fp_samplers = fp->samplers;
nv40->state.fp_samplers = fp->samplers;
return FALSE;
}

View file

@ -31,7 +31,7 @@ nv40_state_validate(struct nv40_context *nv40)
if (nv40->dirty & e->dirty.pipe) {
if (e->validate(nv40))
nv40->hw_dirty |= (1 << e->dirty.hw);
nv40->state.dirty |= (1 << e->dirty.hw);
}
states++;
@ -60,24 +60,24 @@ nv40_state_validate(struct nv40_context *nv40)
static void
nv40_state_emit(struct nv40_context *nv40)
{
unsigned i;
struct nv40_state *state = &nv40->state;
unsigned i, samplers;
while (nv40->hw_dirty) {
unsigned idx = ffs(nv40->hw_dirty) - 1;
nv40->hw_dirty &= ~(1 << idx);
while (state->dirty) {
unsigned idx = ffs(state->dirty) - 1;
so_ref (nv40->state.hw[idx], &nv40->hw->state[idx]);
so_ref (state->hw[idx], &nv40->hw->state[idx]);
so_emit(nv40->nvws, nv40->hw->state[idx]);
state->dirty &= ~(1 << idx);
}
so_emit_reloc_markers(nv40->nvws, nv40->state.hw[NV40_STATE_FB]);
for (i = 0; i < 16; i++) {
if (!(nv40->fp_samplers & (1 << i)))
continue;
so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_FB]);
for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
so_emit_reloc_markers(nv40->nvws,
nv40->state.hw[NV40_STATE_FRAGTEX0+i]);
state->hw[NV40_STATE_FRAGTEX0+i]);
samplers &= ~(1 << i);
}
so_emit_reloc_markers(nv40->nvws, nv40->state.hw[NV40_STATE_FRAGPROG]);
so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_FRAGPROG]);
}
void