panfrost: Fix ubo_mask calculation

BITSET_MASK returns ~0 when given an input of zero, when we need it to
return 0 instead.

Fixes shaders with only sysvals but no UBOs when push constants are
disabled.

This breaks when 31 or 32 UBOs are used, but PAN_MAX_CONST_BUFFERS is
currently set to 16.

Fixes: c246af0dd8 ("panfrost: Only upload UBOs when needed")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15250>
This commit is contained in:
Icecream95 2022-01-01 02:15:21 +13:00 committed by Alyssa Rosenzweig
parent 0b232b8659
commit 9d4441c71a
2 changed files with 2 additions and 2 deletions

View file

@ -4238,7 +4238,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
bi_compile_variant(nir, inputs, binary, sysval_to_id, info, BI_IDVS_NONE);
}
info->ubo_mask &= BITSET_MASK(nir->info.num_ubos);
info->ubo_mask &= (1 << nir->info.num_ubos) - 1;
_mesa_hash_table_u64_destroy(sysval_to_id);
}

View file

@ -3313,7 +3313,7 @@ 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);
info->ubo_mask = ctx->ubo_mask & ((1 << ctx->nir->info.num_ubos) - 1);
if (midgard_debug & MIDGARD_DBG_SHADERS && !skip_internal) {
disassemble_midgard(stdout, binary->data,