diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index ed9ae48dba7..045db35a4d1 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -1727,6 +1727,7 @@ zink_descriptors_deinit(struct zink_context *ctx) VKSCR(DestroyDescriptorSetLayout)(screen->dev, ctx->dd.push_dsl[0]->layout, NULL); if (ctx->dd.push_dsl[1]) VKSCR(DestroyDescriptorSetLayout)(screen->dev, ctx->dd.push_dsl[1]->layout, NULL); + VKSCR(DestroyDescriptorSetLayout)(screen->dev, ctx->dd.old_push_dsl, NULL); } /* called on screen creation */ @@ -1768,7 +1769,8 @@ zink_descriptor_util_init_fbfetch(struct zink_context *ctx) return; struct zink_screen *screen = zink_screen(ctx->base.screen); - VKSCR(DestroyDescriptorSetLayout)(screen->dev, ctx->dd.push_dsl[0]->layout, NULL); + /* save this layout; it may be used by programs, and tracking that is extra complexity */ + ctx->dd.old_push_dsl = ctx->dd.push_dsl[0]->layout; //don't free these now, let ralloc free on teardown to avoid invalid access //ralloc_free(ctx->dd.push_dsl[0]); //ralloc_free(ctx->dd.push_layout_keys[0]); diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index b40e35133a2..48a2340f653 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -437,6 +437,7 @@ struct zink_descriptor_data { uint8_t state_changed[ZINK_PIPELINE_MAX]; //gfx, compute, mesh struct zink_descriptor_layout_key *push_layout_keys[2]; //gfx, compute struct zink_descriptor_layout *push_dsl[2]; //gfx, compute + VkDescriptorSetLayout old_push_dsl; //the non-fbfetch layout; this can't be destroyed because it may be in use VkDescriptorUpdateTemplate push_template[2]; //gfx, compute struct zink_descriptor_layout *dummy_dsl;