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>
(cherry picked from commit 9d4441c71a)
This commit is contained in:
Icecream95 2022-01-01 02:15:21 +13:00 committed by Dylan Baker
parent 4a60a6be41
commit 8a22cc32af
3 changed files with 3 additions and 3 deletions

View file

@ -580,7 +580,7 @@
"description": "panfrost: Fix ubo_mask calculation",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "c246af0dd805033b743dfe0be96c1077f35e0934"
},

View file

@ -4038,7 +4038,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

@ -3228,7 +3228,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) &&
((midgard_debug & MIDGARD_DBG_INTERNAL) || !nir->info.internal)) {