zink: don't destroy old push layout when enabling fbfetch descriptor

this may be in use by programs, and adding tracking/refcounting just to
delete a descriptor layout isn't worth the effort

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38141>
This commit is contained in:
Mike Blumenkrantz 2025-10-29 12:47:42 -04:00 committed by Marge Bot
parent c6ff8ce373
commit 272cf1db8e
2 changed files with 4 additions and 1 deletions

View file

@ -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]);

View file

@ -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;