panfrost: Only upload UBOs when needed

If all of the used values from a UBO are pushed, it doesn't need to be
uploaded.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11700>
This commit is contained in:
Icecream95 2021-05-20 09:10:40 +12:00 committed by Marge Bot
parent b8a7355c03
commit c246af0dd8
4 changed files with 8 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);

View File

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

View File

@ -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;