v3dv: add a helper to destoy pipeline layouts

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>
This commit is contained in:
Iago Toral Quiroga 2022-08-25 08:12:29 +02:00 committed by Marge Bot
parent adad285fc9
commit 425f8aa7a4
2 changed files with 19 additions and 4 deletions

View file

@ -381,6 +381,19 @@ v3dv_CreatePipelineLayout(VkDevice _device,
return VK_SUCCESS;
}
void
v3dv_pipeline_layout_destroy(struct v3dv_device *device,
struct v3dv_pipeline_layout *layout,
const VkAllocationCallbacks *alloc)
{
assert(layout);
for (uint32_t i = 0; i < layout->num_sets; i++)
v3dv_descriptor_set_layout_unref(device, layout->set[i].layout);
vk_object_free(&device->vk, alloc, layout);
}
VKAPI_ATTR void VKAPI_CALL
v3dv_DestroyPipelineLayout(VkDevice _device,
VkPipelineLayout _pipelineLayout,
@ -392,10 +405,7 @@ v3dv_DestroyPipelineLayout(VkDevice _device,
if (!pipeline_layout)
return;
for (uint32_t i = 0; i < pipeline_layout->num_sets; i++)
v3dv_descriptor_set_layout_unref(device, pipeline_layout->set[i].layout);
vk_object_free(&device->vk, pAllocator, pipeline_layout);
v3dv_pipeline_layout_destroy(device, pipeline_layout, pAllocator);
}
VKAPI_ATTR VkResult VKAPI_CALL

View file

@ -1845,6 +1845,11 @@ struct v3dv_pipeline_layout {
unsigned char sha1[20];
};
void
v3dv_pipeline_layout_destroy(struct v3dv_device *device,
struct v3dv_pipeline_layout *layout,
const VkAllocationCallbacks *alloc);
/*
* We are using descriptor maps for ubo/ssbo and texture/samplers, so we need
* it to be big enough to include the max value for all of them.