summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2021-01-09 19:48:54 -0500
committerMarge Bot <eric+marge@anholt.net>2021-01-20 21:53:13 +0000
commitae5df516f1ed0ce01ffdcbacb869aa1374d6b248 (patch)
tree22b1a106577a868e90ee987178ef44736dca1d39
parent2206840f6c1e21435908abe1ca735ea524d850c5 (diff)
radeonsi: clear dirty_atoms and dirty_states only if we entered the emit loop
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index 685336755e6..181aa50ddc5 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -1484,24 +1484,30 @@ static void si_emit_all_states(struct si_context *sctx, const struct pipe_draw_i
/* Emit state atoms. */
unsigned mask = sctx->dirty_atoms & ~skip_atom_mask;
- while (mask)
- sctx->atoms.array[u_bit_scan(&mask)].emit(sctx);
+ if (mask) {
+ do {
+ sctx->atoms.array[u_bit_scan(&mask)].emit(sctx);
+ } while (mask);
- sctx->dirty_atoms &= skip_atom_mask;
+ sctx->dirty_atoms &= skip_atom_mask;
+ }
/* Emit states. */
mask = sctx->dirty_states;
- while (mask) {
- unsigned i = u_bit_scan(&mask);
- struct si_pm4_state *state = sctx->queued.array[i];
+ if (mask) {
+ do {
+ unsigned i = u_bit_scan(&mask);
+ struct si_pm4_state *state = sctx->queued.array[i];
- if (!state || sctx->emitted.array[i] == state)
- continue;
+ if (!state || sctx->emitted.array[i] == state)
+ continue;
+
+ si_pm4_emit(sctx, state);
+ sctx->emitted.array[i] = state;
+ } while (mask);
- si_pm4_emit(sctx, state);
- sctx->emitted.array[i] = state;
+ sctx->dirty_states = 0;
}
- sctx->dirty_states = 0;
/* Emit draw states. */
si_emit_vs_state<GFX_VERSION, HAS_TESS, HAS_GS, NGG>(sctx, info->index_size);