Commit 1a0aa38a authored by Icecream95's avatar Icecream95
Browse files

panfrost: Deduplicate adding to the push uniform list



The logic will be expanded to deal with ranges, so first move it to a
separate function pan_add_pushed_ubo.
Reviewed-by: Alyssa Rosenzweig's avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
parent 1e33b6a3
......@@ -100,14 +100,8 @@ bi_pick_ubo(struct panfrost_ubo_push *push, struct bi_ubo_analysis *analysis)
if (push->count > PAN_MAX_PUSH - range)
return;
for (unsigned offs = 0; offs < range; ++offs) {
struct panfrost_ubo_word word = {
.ubo = ubo,
.offset = (r + offs) * 4
};
push->words[push->count++] = word;
}
for (unsigned offs = 0; offs < range; ++offs)
pan_add_pushed_ubo(push, ubo, (r + offs) * 4);
/* Mark it as pushed so we can rewrite */
BITSET_SET(block->pushed, r);
......
......@@ -103,14 +103,8 @@ mir_pick_ubo(struct panfrost_ubo_push *push, struct mir_ubo_analysis *analysis,
if (push->count > max_words - 4)
return;
for (unsigned offs = 0; offs < 4; ++offs) {
struct panfrost_ubo_word word = {
.ubo = ubo,
.offset = (vec4 * 16) + (offs * 4)
};
push->words[push->count++] = word;
}
for (unsigned offs = 0; offs < 4; ++offs)
pan_add_pushed_ubo(push, ubo, (vec4 * 16) + (offs * 4));
/* Mark it as pushed so we can rewrite */
BITSET_SET(block->pushed, vec4);
......
......@@ -148,3 +148,14 @@ pan_lookup_pushed_ubo(struct panfrost_ubo_push *push, unsigned ubo, unsigned off
unreachable("UBO not pushed");
}
void
pan_add_pushed_ubo(struct panfrost_ubo_push *push, unsigned ubo, unsigned offs)
{
struct panfrost_ubo_word word = {
.ubo = ubo,
.offset = offs,
};
push->words[push->count++] = word;
}
......@@ -105,6 +105,9 @@ struct panfrost_ubo_push {
unsigned
pan_lookup_pushed_ubo(struct panfrost_ubo_push *push, unsigned ubo, unsigned offs);
void
pan_add_pushed_ubo(struct panfrost_ubo_push *push, unsigned ubo, unsigned offs);
struct hash_table_u64 *
panfrost_init_sysvals(struct panfrost_sysvals *sysvals, void *memctx);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment