lavapipe: fix descriptor set layout reference counting in layout merge
When taking the descriptor set layouts from the pipeline layout, make
sure to take references
Fixes: d4d5a7abba
("lavapipe: implement EXT_graphics_pipeline_library")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20630>
This commit is contained in:
@@ -681,6 +681,10 @@ merge_layouts(struct lvp_pipeline *dst, struct lvp_pipeline_layout *src)
|
||||
/* no layout created yet: copy onto ralloc ctx allocation for auto-free */
|
||||
dst->layout = ralloc(dst->mem_ctx, struct lvp_pipeline_layout);
|
||||
memcpy(dst->layout, src, sizeof(struct lvp_pipeline_layout));
|
||||
for (unsigned i = 0; i < dst->layout->vk.set_count; i++) {
|
||||
if (dst->layout->vk.set_layouts[i])
|
||||
vk_descriptor_set_layout_ref(dst->layout->vk.set_layouts[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
@@ -703,8 +707,10 @@ merge_layouts(struct lvp_pipeline *dst, struct lvp_pipeline_layout *src)
|
||||
}
|
||||
#endif
|
||||
for (unsigned i = 0; i < src->vk.set_count; i++) {
|
||||
if (!dst->layout->vk.set_layouts[i])
|
||||
if (!dst->layout->vk.set_layouts[i]) {
|
||||
dst->layout->vk.set_layouts[i] = src->vk.set_layouts[i];
|
||||
vk_descriptor_set_layout_ref(src->vk.set_layouts[i]);
|
||||
}
|
||||
}
|
||||
dst->layout->vk.set_count = MAX2(dst->layout->vk.set_count,
|
||||
src->vk.set_count);
|
||||
|
Reference in New Issue
Block a user