lavapipe: fix descriptor set layout freeing.
authorDave Airlie <airlied@redhat.com>
Wed, 24 Feb 2021 07:02:51 +0000 (17:02 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 24 Feb 2021 18:38:44 +0000 (04:38 +1000)
Have to store the used allocator otherwise ends up being free wrong.

Fix for
dEQP-VK.api.object_management.alloc_callback_fail.descriptor_set_layout*

Fixes: f94a5f30e0ebd ("lavapipe: add reference counting to descriptor set layout")

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9247>

src/gallium/frontends/lavapipe/lvp_descriptor_set.c
src/gallium/frontends/lavapipe/lvp_private.h

index 19e34de..1df9a12 100644 (file)
@@ -59,6 +59,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDescriptorSetLayout(
    struct lvp_sampler **samplers =
       (struct lvp_sampler **)&set_layout->binding[max_binding + 1];
 
+   set_layout->alloc = pAllocator;
    set_layout->binding_count = max_binding + 1;
    set_layout->shader_stages = 0;
    set_layout->size = 0;
@@ -163,7 +164,7 @@ lvp_descriptor_set_layout_destroy(struct lvp_device *device,
 {
    assert(layout->ref_cnt == 0);
    vk_object_base_finish(&layout->base);
-   vk_free(&device->vk.alloc, layout);
+   vk_free2(&device->vk.alloc, layout->alloc, layout);
 }
 
 VKAPI_ATTR void VKAPI_CALL lvp_DestroyDescriptorSetLayout(
index ac651cf..c37111a 100644 (file)
@@ -419,6 +419,7 @@ struct lvp_descriptor_set_binding_layout {
 struct lvp_descriptor_set_layout {
    struct vk_object_base base;
 
+   const VkAllocationCallbacks *alloc;
    /* Descriptor set layouts can be destroyed at almost any time */
    uint32_t ref_cnt;