zink: simplify check for knowing whether descriptor updating is needed

if a program has at least one pool object set then it will have descriptors

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9348>
This commit is contained in:
Mike Blumenkrantz 2020-10-06 14:43:15 -04:00 committed by Marge Bot
parent fe31566fbb
commit 80d9f3aa34
2 changed files with 12 additions and 2 deletions

View File

@ -962,7 +962,7 @@ zink_draw_vbo(struct pipe_context *pctx,
}
}
if (zink_program_num_descriptors(&gfx_program->base))
if (zink_program_has_descriptors(&gfx_program->base))
update_descriptors(ctx, screen, false);
struct zink_batch *batch = zink_batch_rp(ctx);
@ -1171,7 +1171,7 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
VkPipeline pipeline = zink_get_compute_pipeline(screen, comp_program,
&ctx->compute_pipeline_state);
if (zink_program_num_descriptors(&comp_program->base))
if (zink_program_has_descriptors(&comp_program->base))
update_descriptors(ctx, screen, true);

View File

@ -118,6 +118,16 @@ zink_desc_type_from_vktype(VkDescriptorType type)
}
static inline bool
zink_program_has_descriptors(const struct zink_program *pg)
{
for (unsigned i = 0; i < ARRAY_SIZE(pg->pool); i++) {
if (pg->pool[i])
return true;
}
return false;
}
unsigned
zink_program_num_descriptors(const struct zink_program *pg);