iris: Optimize out redundant sampler state binds

This cuts roughly 85% of the 3DSTATE_SAMPLER_STATE_POINTERS_PS calls in
the J2DBench images test.  For some reason, the state tracker is calling
bind_sampler_state with the same sampler state in a bunch of cases.
This commit is contained in:
Kenneth Graunke 2019-09-07 22:30:02 -07:00
parent 325e25d689
commit 7d28e9ddd6
1 changed files with 8 additions and 2 deletions

View File

@ -1606,11 +1606,17 @@ iris_bind_sampler_states(struct pipe_context *ctx,
assert(start + count <= IRIS_MAX_TEXTURE_SAMPLERS);
bool dirty = false;
for (int i = 0; i < count; i++) {
shs->samplers[start + i] = states[i];
if (shs->samplers[start + i] != states[i]) {
shs->samplers[start + i] = states[i];
dirty = true;
}
}
ice->state.dirty |= IRIS_DIRTY_SAMPLER_STATES_VS << stage;
if (dirty)
ice->state.dirty |= IRIS_DIRTY_SAMPLER_STATES_VS << stage;
}
/**