From 5ddfffcca182fc4444e26eea8a84ccb7f30bb1c4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 27 Nov 2020 12:16:47 -0500 Subject: [PATCH] zink: simplify some update_descriptor code by using the generic zink_program here we can shorten the code a little Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/gallium/drivers/zink/zink_draw.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/zink/zink_draw.c b/src/gallium/drivers/zink/zink_draw.c index 497e26d51fc..59c0cd81dc8 100644 --- a/src/gallium/drivers/zink/zink_draw.c +++ b/src/gallium/drivers/zink/zink_draw.c @@ -508,15 +508,12 @@ update_descriptors(struct zink_context *ctx, struct zink_screen *screen, bool is } unsigned num_descriptors; - VkDescriptorSetLayout dsl; if (is_compute) { num_descriptors = ctx->curr_compute->base.num_descriptors; - dsl = ctx->curr_compute->base.dsl; batch = &ctx->compute_batch; } else { batch = zink_curr_batch(ctx); num_descriptors = ctx->curr_program->base.num_descriptors; - dsl = ctx->curr_program->base.dsl; } if (batch->descs_used + num_descriptors >= batch->max_descs) { @@ -528,13 +525,12 @@ update_descriptors(struct zink_context *ctx, struct zink_screen *screen, bool is batch = zink_curr_batch(ctx); } } - if (is_compute) - zink_batch_reference_program(batch, &ctx->curr_compute->base); - else - zink_batch_reference_program(batch, &ctx->curr_program->base); + + struct zink_program *pg = is_compute ? &ctx->curr_compute->base : &ctx->curr_program->base; + zink_batch_reference_program(batch, pg); VkDescriptorSet desc_set = allocate_descriptor_set(screen, batch, - dsl, num_descriptors); + pg->dsl, num_descriptors); /* probably oom, so we need to stall until we free up some descriptors */ if (!desc_set) { /* update our max descriptor count so we can try and avoid this happening again */ @@ -557,7 +553,7 @@ update_descriptors(struct zink_context *ctx, struct zink_screen *screen, bool is zink_reset_batch(ctx, &ctx->batches[i]); } } - desc_set = allocate_descriptor_set(screen, batch, dsl, num_descriptors); + desc_set = allocate_descriptor_set(screen, batch, pg->dsl, num_descriptors); } assert(desc_set != VK_NULL_HANDLE);