etnaviv: Optimize sampler view iteration with u_foreach_bit(..)

Replace loop over all PIPE_MAX_SAMPLERS with u_foreach_bit(..) to iterate
only over active sampler views. This avoids unnecessary iterations.

Improves drawoverhead test 1 performance by ~10%.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36831>
This commit is contained in:
Christian Gmeiner
2025-08-18 13:53:04 +02:00
committed by Marge Bot
parent a6e0cbd110
commit e689b342fe

View File

@@ -364,17 +364,15 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
}
/* Mark textures as being read */
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
if (ctx->sampler_view[i]) {
if (ctx->dirty & ETNA_DIRTY_SAMPLER_VIEWS)
resource_read(ctx, ctx->sampler_view[i]->texture);
u_foreach_bit(i, ctx->active_sampler_views) {
if (ctx->dirty & ETNA_DIRTY_SAMPLER_VIEWS)
resource_read(ctx, ctx->sampler_view[i]->texture);
/* if texture was modified since the last update,
* we need to clear the texture cache and possibly
* resolve/update ts
*/
etna_update_sampler_source(ctx->sampler_view[i], i);
}
/* if texture was modified since the last update,
* we need to clear the texture cache and possibly
* resolve/update ts
*/
etna_update_sampler_source(ctx->sampler_view[i], i);
}
if (indirect) {