From 1f8cd768d6b981685ce6e4aa2f4d1a55e43d78d6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 13 Apr 2022 10:21:51 -0400 Subject: [PATCH] zink: flatten push descriptor template into normal template array this simplifies some code Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_descriptors.h | 1 - src/gallium/drivers/zink/zink_descriptors_lazy.c | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/zink/zink_descriptors.h b/src/gallium/drivers/zink/zink_descriptors.h index b651f216848..e743aec845a 100644 --- a/src/gallium/drivers/zink/zink_descriptors.h +++ b/src/gallium/drivers/zink/zink_descriptors.h @@ -149,7 +149,6 @@ struct zink_program_descriptor_data { struct zink_descriptor_pool_key *pool_key[ZINK_DESCRIPTOR_TYPES]; //push set doesn't need one struct zink_descriptor_layout *layouts[ZINK_DESCRIPTOR_TYPES + 1]; VkDescriptorUpdateTemplateKHR templates[ZINK_DESCRIPTOR_TYPES + 1]; - VkDescriptorUpdateTemplateKHR push_template; }; struct zink_batch_descriptor_data { diff --git a/src/gallium/drivers/zink/zink_descriptors_lazy.c b/src/gallium/drivers/zink/zink_descriptors_lazy.c index ba61c01fe4e..be3f3dfef9f 100644 --- a/src/gallium/drivers/zink/zink_descriptors_lazy.c +++ b/src/gallium/drivers/zink/zink_descriptors_lazy.c @@ -324,10 +324,7 @@ zink_descriptor_program_init_lazy(struct zink_context *ctx, struct zink_program VkDescriptorUpdateTemplateKHR t; if (VKSCR(CreateDescriptorUpdateTemplate)(screen->dev, &template[i], NULL, &t) != VK_SUCCESS) return false; - if (is_push) - pg->dd->push_template = t; - else - pg->dd->templates[i] = t; + pg->dd->templates[i] = t; } return true; } @@ -344,8 +341,6 @@ zink_descriptor_program_deinit_lazy(struct zink_context *ctx, struct zink_progra if (pg->dd->templates[i]) VKSCR(DestroyDescriptorUpdateTemplate)(screen->dev, pg->dd->templates[i], NULL); } - if (pg->dd && pg->dd->push_template) - VKSCR(DestroyDescriptorUpdateTemplate)(screen->dev, pg->dd->push_template, NULL); ralloc_free(pg->dd); } @@ -602,11 +597,11 @@ zink_descriptors_update_lazy(struct zink_context *ctx, bool is_compute) if (pg->dd->push_usage && (dd_lazy(ctx)->push_state_changed[is_compute] || bind_sets)) { if (have_KHR_push_descriptor) { if (dd_lazy(ctx)->push_state_changed[is_compute]) - VKCTX(CmdPushDescriptorSetWithTemplateKHR)(bs->cmdbuf, pg->dd->push_template, + VKCTX(CmdPushDescriptorSetWithTemplateKHR)(bs->cmdbuf, pg->dd->templates[0], pg->layout, 0, ctx); } else { if (dd_lazy(ctx)->push_state_changed[is_compute]) { - VKCTX(UpdateDescriptorSetWithTemplate)(screen->dev, push_set, pg->dd->push_template, ctx); + VKCTX(UpdateDescriptorSetWithTemplate)(screen->dev, push_set, pg->dd->templates[0], ctx); bdd->sets[is_compute][0] = push_set; } assert(push_set || bdd->sets[is_compute][0]);