panfrost: Use util_last_bit for images

Probbaly more correct for hols in image_mask.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
This commit is contained in:
Alyssa Rosenzweig
2021-06-01 19:14:06 -04:00
committed by Marge Bot
parent 619b1bc23b
commit 0566fa2db4
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -1626,7 +1626,7 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch,
struct panfrost_shader_state *vs = panfrost_get_shader_state(ctx, PIPE_SHADER_VERTEX);
bool instanced = ctx->indirect_draw || ctx->instance_count > 1;
uint32_t image_mask = ctx->image_mask[PIPE_SHADER_VERTEX];
unsigned nr_images = util_bitcount(image_mask);
unsigned nr_images = util_last_bit(image_mask);
/* Worst case: everything is NPOT, which is only possible if instancing
* is enabled. Otherwise single record is gauranteed.
@@ -1795,7 +1795,7 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch,
k = ALIGN_POT(k, 2);
emit_image_attribs(ctx, PIPE_SHADER_VERTEX, out + so->num_elements, k);
emit_image_bufs(batch, PIPE_SHADER_VERTEX, bufs + k, k);
k += util_bitcount(ctx->image_mask[PIPE_SHADER_VERTEX]);
k += util_last_bit(ctx->image_mask[PIPE_SHADER_VERTEX]);
/* We need an empty attrib buf to stop the prefetching on Bifrost */
if (pan_is_bifrost(dev))
+1 -1
View File
@@ -270,7 +270,7 @@ pan_shader_compile(const struct panfrost_device *dev,
else
info->ubo_count = s->info.num_ubos;
info->attribute_count += util_bitcount(s->info.images_used);
info->attribute_count += util_last_bit(s->info.images_used);
info->writes_global = s->info.writes_memory;
info->sampler_count = info->texture_count = BITSET_LAST_BIT(s->info.textures_used);