diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index e5af9959985..a03715052bd 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1221,12 +1221,10 @@ panfrost_emit_const_buf(struct panfrost_batch *batch, /* The rest are honest-to-goodness UBOs */ - for (unsigned ubo = 0; ubo < ubo_count; ++ubo) { + u_foreach_bit(ubo, ss->info.ubo_mask & buf->enabled_mask) { size_t usz = buf->cb[ubo].buffer_size; - bool enabled = buf->enabled_mask & (1 << ubo); - bool empty = usz == 0; - if (!enabled || empty) { + if (usz == 0) { ubo_ptr[ubo] = 0; continue; } diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 4a53f9da7c0..b3b7192eb4f 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -3467,6 +3467,8 @@ bifrost_compile_shader_nir(nir_shader *nir, info->bifrost.wait_6 = (first_deps & (1 << 6)); info->bifrost.wait_7 = (first_deps & (1 << 7)); + info->ubo_mask = ctx->ubo_mask & BITSET_MASK(ctx->nir->info.num_ubos); + if (bifrost_debug & BIFROST_DBG_SHADERS && !skip_internal) { disassemble_bifrost(stdout, binary->data, binary->size, bifrost_debug & BIFROST_DBG_VERBOSE); diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index a8d254802fa..e9729eca55b 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -3230,6 +3230,8 @@ midgard_compile_shader_nir(nir_shader *nir, /* Report the very first tag executed */ info->midgard.first_tag = midgard_get_first_tag_from_block(ctx, 0); + info->ubo_mask = ctx->ubo_mask & BITSET_MASK(ctx->nir->info.num_ubos); + if ((midgard_debug & MIDGARD_DBG_SHADERS) && ((midgard_debug & MIDGARD_DBG_INTERNAL) || !nir->info.internal)) { disassemble_midgard(stdout, binary->data, diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index 910bacad5bf..1ff240b3070 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -216,6 +216,8 @@ struct pan_shader_info { * Uniforms (Bifrost) */ struct panfrost_ubo_push push; + uint32_t ubo_mask; + union { struct bifrost_shader_info bifrost; struct midgard_shader_info midgard;