st_validate_state() shows up in benchmarks. This patch makes it a little bit faster in 64-bit mode.
Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com> --- src/mesa/state_tracker/st_atom.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 94e012a..210f6f3 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -155,7 +155,6 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline ) { struct gl_context *ctx = st->ctx; uint64_t dirty, pipeline_mask; - uint32_t dirty_lo, dirty_hi; /* Get Mesa driver state. * @@ -200,17 +199,19 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline ) if (!dirty) return; - dirty_lo = dirty; - dirty_hi = dirty >> 32; - - /* Update states. - * - * Don't use u_bit_scan64, it may be slower on 32-bit. - */ - while (dirty_lo) - atoms[u_bit_scan(&dirty_lo)]->update(st); - while (dirty_hi) - atoms[32 + u_bit_scan(&dirty_hi)]->update(st); + /* Update states. */ + if (sizeof(void*) > 4) { + while (dirty) + atoms[u_bit_scan64(&dirty)]->update(st); + } else { + /* Don't use u_bit_scan64, it may be slower on 32-bit. */ + uint32_t dirty_lo = dirty; + uint32_t dirty_hi = dirty >> 32; + while (dirty_lo) + atoms[u_bit_scan(&dirty_lo)]->update(st); + while (dirty_hi) + atoms[32 + u_bit_scan(&dirty_hi)]->update(st); + } /* Clear the render or compute state bits. */ st->dirty &= ~pipeline_mask; _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev