struct nv40_state {
unsigned scissor_enabled;
unsigned stipple_enabled;
+ unsigned fp_samplers;
+ unsigned dirty;
struct nouveau_stateobj *hw[NV40_STATE_MAX];
};
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;
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);
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;
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;
}
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++;
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