From e69a59a96b241038f24a0e425445d001ea099b2c Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 6 May 2024 15:30:58 -0500 Subject: [PATCH] Destroy Instance objects before Instance & use correct allocator The loader was accidentally destroying instance level objects after it called vkDestroyInstance. This only was caught during driver unloading because in a well behaved app, all objects are destroyed before calling vkDestroyInstance. The other issue was that a non-null pAllocator was passed into object destruction but the members of VkAllocatorCallbacks were NULL, due to just taking a pointer to the instance's allocator callbacks. That has been fixed. A possible issue is that the allocator callbacks used during object creation weren't used in destruction, which has also been fixed. --- loader/debug_utils.c | 32 +++++++++----- loader/loader.c | 98 +++++++++++++++++++++++++++--------------- loader/loader.h | 3 +- loader/loader_common.h | 12 +++++- loader/trampoline.c | 1 + loader/wsi.c | 47 ++++++++++---------- 6 files changed, 125 insertions(+), 68 deletions(-) diff --git a/loader/debug_utils.c b/loader/debug_utils.c index 8a12d4a0..9644610c 100644 --- a/loader/debug_utils.c +++ b/loader/debug_utils.c @@ -184,7 +184,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstanc goto out; } - res = loader_get_next_available_entry(inst, &inst->debug_utils_messengers_list, &next_index); + res = loader_get_next_available_entry(inst, &inst->debug_utils_messengers_list, &next_index, pAllocator); if (res != VK_SUCCESS) { goto out; } @@ -248,8 +248,11 @@ out: } } if (inst->debug_utils_messengers_list.list && - inst->debug_utils_messengers_list.capacity > (*pNextIndex) * sizeof(VkBool32)) { - inst->debug_utils_messengers_list.list[*pNextIndex] = VK_FALSE; + inst->debug_utils_messengers_list.capacity > (*pNextIndex) * sizeof(struct loader_used_object_status)) { + inst->debug_utils_messengers_list.list[*pNextIndex].status = VK_FALSE; + if (NULL != pAllocator) { + inst->debug_utils_messengers_list.list[*pNextIndex].allocation_callbacks = *pAllocator; + } } loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node); loader_free_with_instance_fallback(pAllocator, inst, pNextIndex); @@ -278,8 +281,11 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugUtilsMessengerEXT(VkInstance i util_DestroyDebugUtilsMessenger(inst, messenger, pAllocator); if (inst->debug_utils_messengers_list.list && - inst->debug_utils_messengers_list.capacity > (*debug_messenger_index) * sizeof(VkBool32)) { - inst->debug_utils_messengers_list.list[*debug_messenger_index] = VK_FALSE; + inst->debug_utils_messengers_list.capacity > (*debug_messenger_index) * sizeof(struct loader_used_object_status)) { + inst->debug_utils_messengers_list.list[*debug_messenger_index].status = VK_FALSE; + if (NULL != pAllocator) { + inst->debug_utils_messengers_list.list[*debug_messenger_index].allocation_callbacks = *pAllocator; + } } loader_free_with_instance_fallback(pAllocator, inst, debug_messenger_index); @@ -454,7 +460,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstanc goto out; } - res = loader_get_next_available_entry(inst, &inst->debug_report_callbacks_list, &next_index); + res = loader_get_next_available_entry(inst, &inst->debug_report_callbacks_list, &next_index, pAllocator); if (res != VK_SUCCESS) { goto out; } @@ -518,8 +524,11 @@ out: } } if (inst->debug_report_callbacks_list.list && - inst->debug_report_callbacks_list.capacity > (*pNextIndex) * sizeof(VkBool32)) { - inst->debug_report_callbacks_list.list[*pNextIndex] = VK_FALSE; + inst->debug_report_callbacks_list.capacity > (*pNextIndex) * sizeof(struct loader_used_object_status)) { + inst->debug_report_callbacks_list.list[*pNextIndex].status = VK_FALSE; + if (NULL != pAllocator) { + inst->debug_report_callbacks_list.list[*pNextIndex].allocation_callbacks = *pAllocator; + } } loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node); loader_free_with_instance_fallback(pAllocator, inst, pNextIndex); @@ -547,8 +556,11 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance i util_DestroyDebugReportCallback(inst, callback, pAllocator); if (inst->debug_report_callbacks_list.list && - inst->debug_report_callbacks_list.capacity > (*debug_report_index) * sizeof(VkBool32)) { - inst->debug_report_callbacks_list.list[*debug_report_index] = VK_FALSE; + inst->debug_report_callbacks_list.capacity > (*debug_report_index) * sizeof(struct loader_used_object_status)) { + inst->debug_report_callbacks_list.list[*debug_report_index].status = VK_FALSE; + if (NULL != pAllocator) { + inst->debug_report_callbacks_list.list[*debug_report_index].allocation_callbacks = *pAllocator; + } } loader_free_with_instance_fallback(pAllocator, inst, debug_report_index); } diff --git a/loader/loader.c b/loader/loader.c index 3058b365..98ad3784 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -731,16 +731,22 @@ void loader_destroy_generic_list(const struct loader_instance *inst, struct load } VkResult loader_get_next_available_entry(const struct loader_instance *inst, struct loader_used_object_list *list_info, - uint32_t *free_index) { + uint32_t *free_index, const VkAllocationCallbacks *pAllocator) { if (NULL == list_info->list) { - VkResult res = loader_init_generic_list(inst, (struct loader_generic_list *)list_info, sizeof(VkBool32)); + VkResult res = + loader_init_generic_list(inst, (struct loader_generic_list *)list_info, sizeof(struct loader_used_object_status)); if (VK_SUCCESS != res) { return res; } } - for (uint32_t i = 0; i < list_info->capacity / sizeof(VkBool32); i++) { - if (list_info->list[i] == VK_FALSE) { - list_info->list[i] = VK_TRUE; + for (uint32_t i = 0; i < list_info->capacity / sizeof(struct loader_used_object_status); i++) { + if (list_info->list[i].status == VK_FALSE) { + list_info->list[i].status = VK_TRUE; + if (pAllocator) { + list_info->list[i].allocation_callbacks = *pAllocator; + } else { + memset(&list_info->list[i].allocation_callbacks, 0, sizeof(VkAllocationCallbacks)); + } *free_index = i; return VK_SUCCESS; } @@ -752,17 +758,23 @@ VkResult loader_get_next_available_entry(const struct loader_instance *inst, str if (VK_SUCCESS != res) { return res; } - uint32_t new_index = (uint32_t)(old_capacity / sizeof(VkBool32)); + uint32_t new_index = (uint32_t)(old_capacity / sizeof(struct loader_used_object_status)); // Zero out the newly allocated back half of list. memset(&list_info->list[new_index], 0, old_capacity); - list_info->list[new_index] = VK_TRUE; + list_info->list[new_index].status = VK_TRUE; + if (pAllocator) { + list_info->list[new_index].allocation_callbacks = *pAllocator; + } else { + memset(&list_info->list[new_index].allocation_callbacks, 0, sizeof(VkAllocationCallbacks)); + } *free_index = new_index; return VK_SUCCESS; } void loader_release_object_from_list(struct loader_used_object_list *list_info, uint32_t index_to_free) { - if (list_info->list && list_info->capacity > index_to_free * sizeof(VkBool32)) { - list_info->list[index_to_free] = VK_FALSE; + if (list_info->list && list_info->capacity > index_to_free * sizeof(struct loader_used_object_status)) { + list_info->list[index_to_free].status = VK_FALSE; + memset(&list_info->list[index_to_free].allocation_callbacks, 0, sizeof(VkAllocationCallbacks)); } } @@ -1351,44 +1363,57 @@ void loader_remove_logical_device(struct loader_icd_term *icd_term, struct loade loader_destroy_logical_device(found_dev, pAllocator); } -void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term, - const VkAllocationCallbacks *pAllocator) { - ptr_inst->icd_terms_count--; - for (struct loader_device *dev = icd_term->logical_device_list; dev;) { - struct loader_device *next_dev = dev->next; - loader_destroy_logical_device(dev, pAllocator); - dev = next_dev; - } +const VkAllocationCallbacks *ignore_null_callback(const VkAllocationCallbacks *callbacks) { + return NULL != callbacks->pfnAllocation && NULL != callbacks->pfnFree && NULL != callbacks->pfnReallocation && + NULL != callbacks->pfnInternalAllocation && NULL != callbacks->pfnInternalFree + ? callbacks + : NULL; +} +// Try to close any open objects on the loader_icd_term - this must be done before destroying the instance +void loader_icd_close_objects(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term) { for (uint32_t i = 0; i < icd_term->surface_list.capacity / sizeof(VkSurfaceKHR); i++) { - if (ptr_inst->surfaces_list.capacity > i * sizeof(VkBool32) && ptr_inst->surfaces_list.list[i] == VK_TRUE && - NULL != icd_term->surface_list.list && icd_term->surface_list.list[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { - icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, icd_term->surface_list.list[i], pAllocator); + if (ptr_inst->surfaces_list.capacity > i * sizeof(struct loader_used_object_status) && + ptr_inst->surfaces_list.list[i].status == VK_TRUE && NULL != icd_term->surface_list.list && + icd_term->surface_list.list[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { + icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, icd_term->surface_list.list[i], + ignore_null_callback(&(ptr_inst->surfaces_list.list[i].allocation_callbacks))); icd_term->surface_list.list[i] = (VkSurfaceKHR)(uintptr_t)NULL; } } - loader_destroy_generic_list(ptr_inst, (struct loader_generic_list *)&icd_term->surface_list); - for (uint32_t i = 0; i < icd_term->debug_utils_messenger_list.capacity / sizeof(VkDebugUtilsMessengerEXT); i++) { - if (ptr_inst->debug_utils_messengers_list.capacity > i * sizeof(VkBool32) && - ptr_inst->debug_utils_messengers_list.list[i] == VK_TRUE && NULL != icd_term->debug_utils_messenger_list.list && + if (ptr_inst->debug_utils_messengers_list.capacity > i * sizeof(struct loader_used_object_status) && + ptr_inst->debug_utils_messengers_list.list[i].status == VK_TRUE && NULL != icd_term->debug_utils_messenger_list.list && icd_term->debug_utils_messenger_list.list[i] && NULL != icd_term->dispatch.DestroyDebugUtilsMessengerEXT) { - icd_term->dispatch.DestroyDebugUtilsMessengerEXT(icd_term->instance, icd_term->debug_utils_messenger_list.list[i], - pAllocator); + icd_term->dispatch.DestroyDebugUtilsMessengerEXT( + icd_term->instance, icd_term->debug_utils_messenger_list.list[i], + ignore_null_callback(&(ptr_inst->debug_utils_messengers_list.list[i].allocation_callbacks))); icd_term->debug_utils_messenger_list.list[i] = (VkDebugUtilsMessengerEXT)(uintptr_t)NULL; } } - loader_destroy_generic_list(ptr_inst, (struct loader_generic_list *)&icd_term->debug_utils_messenger_list); - for (uint32_t i = 0; i < icd_term->debug_report_callback_list.capacity / sizeof(VkDebugReportCallbackEXT); i++) { - if (ptr_inst->debug_report_callbacks_list.capacity > i * sizeof(VkBool32) && - ptr_inst->debug_report_callbacks_list.list[i] == VK_TRUE && NULL != icd_term->debug_report_callback_list.list && + if (ptr_inst->debug_report_callbacks_list.capacity > i * sizeof(struct loader_used_object_status) && + ptr_inst->debug_report_callbacks_list.list[i].status == VK_TRUE && NULL != icd_term->debug_report_callback_list.list && icd_term->debug_report_callback_list.list[i] && NULL != icd_term->dispatch.DestroyDebugReportCallbackEXT) { - icd_term->dispatch.DestroyDebugReportCallbackEXT(icd_term->instance, icd_term->debug_report_callback_list.list[i], - pAllocator); + icd_term->dispatch.DestroyDebugReportCallbackEXT( + icd_term->instance, icd_term->debug_report_callback_list.list[i], + ignore_null_callback(&(ptr_inst->debug_report_callbacks_list.list[i].allocation_callbacks))); icd_term->debug_report_callback_list.list[i] = (VkDebugReportCallbackEXT)(uintptr_t)NULL; } } +} +// Free resources allocated inside the loader_icd_term +void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term, + const VkAllocationCallbacks *pAllocator) { + ptr_inst->icd_terms_count--; + for (struct loader_device *dev = icd_term->logical_device_list; dev;) { + struct loader_device *next_dev = dev->next; + loader_destroy_logical_device(dev, pAllocator); + dev = next_dev; + } + + loader_destroy_generic_list(ptr_inst, (struct loader_generic_list *)&icd_term->surface_list); + loader_destroy_generic_list(ptr_inst, (struct loader_generic_list *)&icd_term->debug_utils_messenger_list); loader_destroy_generic_list(ptr_inst, (struct loader_generic_list *)&icd_term->debug_report_callback_list); loader_instance_heap_free(ptr_inst, icd_term); @@ -5589,6 +5614,7 @@ out: icd_term = ptr_instance->icd_terms; ptr_instance->icd_terms = icd_term->next; if (NULL != icd_term->instance) { + loader_icd_close_objects(ptr_instance, icd_term); icd_term->dispatch.DestroyInstance(icd_term->instance, pAllocator); } loader_icd_destroy(ptr_instance, icd_term, pAllocator); @@ -5636,6 +5662,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance(VkInstance instance, const struct loader_icd_term *icd_terms = ptr_instance->icd_terms; while (NULL != icd_terms) { if (icd_terms->instance) { + loader_icd_close_objects(ptr_instance, icd_terms); icd_terms->dispatch.DestroyInstance(icd_terms->instance, pAllocator); } struct loader_icd_term *next_icd_term = icd_terms->next; @@ -6486,11 +6513,14 @@ void unload_drivers_without_physical_devices(struct loader_instance *inst) { if (cur_scanned_icd_index != UINT32_MAX) { loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "Removing driver %s due to not having any physical devices", cur_icd_term->scanned_icd->lib_name); + + const VkAllocationCallbacks *allocation_callbacks = ignore_null_callback(&(inst->alloc_callbacks)); if (cur_icd_term->instance) { - cur_icd_term->dispatch.DestroyInstance(cur_icd_term->instance, &(inst->alloc_callbacks)); + loader_icd_close_objects(inst, cur_icd_term); + cur_icd_term->dispatch.DestroyInstance(cur_icd_term->instance, allocation_callbacks); } cur_icd_term->instance = VK_NULL_HANDLE; - loader_icd_destroy(inst, cur_icd_term, &(inst->alloc_callbacks)); + loader_icd_destroy(inst, cur_icd_term, allocation_callbacks); cur_icd_term = NULL; struct loader_scanned_icd *scanned_icd_to_remove = &inst->icd_tramp_list.scanned_list[cur_scanned_icd_index]; // Iterate through preloaded ICDs and remove the corresponding driver from that list diff --git a/loader/loader.h b/loader/loader.h index 7be68f97..2bce1818 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -121,7 +121,7 @@ void free_string_list(const struct loader_instance *inst, struct loader_string_l VkResult loader_init_generic_list(const struct loader_instance *inst, struct loader_generic_list *list_info, size_t element_size); VkResult loader_resize_generic_list(const struct loader_instance *inst, struct loader_generic_list *list_info); VkResult loader_get_next_available_entry(const struct loader_instance *inst, struct loader_used_object_list *list_info, - uint32_t *free_index); + uint32_t *free_index, const VkAllocationCallbacks *pAllocator); void loader_release_object_from_list(struct loader_used_object_list *list_info, uint32_t index_to_free); bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, const uint32_t count, const VkExtensionProperties *ext_array); @@ -157,6 +157,7 @@ VkResult loader_init_scanned_icd_list(const struct loader_instance *inst, struct void loader_clear_scanned_icd_list(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list); VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, const VkInstanceCreateInfo *pCreateInfo, bool *skipped_portability_drivers); +void loader_icd_close_objects(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term); void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term, const VkAllocationCallbacks *pAllocator); VkResult loader_scan_for_layers(struct loader_instance *inst, struct loader_layer_list *instance_layers, diff --git a/loader/loader_common.h b/loader/loader_common.h index 0b76387e..1097d51c 100644 --- a/loader/loader_common.h +++ b/loader/loader_common.h @@ -90,10 +90,20 @@ struct loader_device_extension_list { struct loader_dev_ext_props *list; }; +struct loader_used_object_status { + VkBool32 status; + VkAllocationCallbacks allocation_callbacks; +}; + struct loader_used_object_list { size_t capacity; uint32_t padding; // count variable isn't used - VkBool32 *list; + struct loader_used_object_status *list; +}; + +struct loader_surface_allocation { + VkSurfaceKHR surface; + VkAllocationCallbacks allocation_callbacks; }; struct loader_surface_list { diff --git a/loader/trampoline.c b/loader/trampoline.c index fec36d89..2df9248e 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -792,6 +792,7 @@ out: // Call destroy Instance on each driver in case we successfully called down the chain but failed on // our way back out of it. if (icd_term->instance) { + loader_icd_close_objects(ptr_instance, icd_term); icd_term->dispatch.DestroyInstance(icd_term->instance, pAllocator); } icd_term->instance = VK_NULL_HANDLE; diff --git a/loader/wsi.c b/loader/wsi.c index 5183f11f..47177502 100644 --- a/loader/wsi.c +++ b/loader/wsi.c @@ -549,10 +549,10 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, co } VkResult allocate_icd_surface_struct(struct loader_instance *instance, size_t base_size, size_t platform_size, - VkIcdSurface **out_icd_surface) { + const VkAllocationCallbacks *pAllocator, VkIcdSurface **out_icd_surface) { uint32_t next_index = 0; VkIcdSurface *icd_surface = NULL; - VkResult res = loader_get_next_available_entry(instance, &instance->surfaces_list, &next_index); + VkResult res = loader_get_next_available_entry(instance, &instance->surfaces_list, &next_index, pAllocator); if (res != VK_SUCCESS) { goto out; } @@ -609,8 +609,11 @@ void cleanup_surface_creation(struct loader_instance *loader_inst, VkResult resu } } if (loader_inst->surfaces_list.list && - loader_inst->surfaces_list.capacity > icd_surface->surface_index * sizeof(VkBool32)) { - loader_inst->surfaces_list.list[icd_surface->surface_index] = VK_FALSE; + loader_inst->surfaces_list.capacity > icd_surface->surface_index * sizeof(struct loader_used_object_status)) { + loader_inst->surfaces_list.list[icd_surface->surface_index].status = VK_FALSE; + if (NULL != pAllocator) { + loader_inst->surfaces_list.list[icd_surface->surface_index].allocation_callbacks = *pAllocator; + } } loader_instance_heap_free(loader_inst, icd_surface); } @@ -653,8 +656,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance insta } // Next, if so, proceed with the implementation of this function: - result = - allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->win_surf.base), sizeof(icd_surface->win_surf), &icd_surface); + result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->win_surf.base), sizeof(icd_surface->win_surf), pAllocator, + &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -760,7 +763,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance ins // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->wayland_surf.base), sizeof(icd_surface->wayland_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -869,8 +872,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instanc } // Next, if so, proceed with the implementation of this function: - result = - allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->xcb_surf.base), sizeof(icd_surface->xcb_surf), &icd_surface); + result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->xcb_surf.base), sizeof(icd_surface->xcb_surf), pAllocator, + &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -982,8 +985,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instan } // Next, if so, proceed with the implementation of this function: - result = - allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->xlib_surf.base), sizeof(icd_surface->xlib_surf), &icd_surface); + result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->xlib_surf.base), sizeof(icd_surface->xlib_surf), + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -1095,7 +1098,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDirectFBSurfaceEXT(VkInstance in // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->directfb_surf.base), sizeof(icd_surface->directfb_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -1252,7 +1255,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateHeadlessSurfaceEXT(VkInstance in // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->headless_surf.base), sizeof(icd_surface->headless_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -1343,7 +1346,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMacOSSurfaceMVK(VkInstance insta // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->macos_surf.base), sizeof(icd_surface->macos_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -1460,8 +1463,8 @@ terminator_CreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamD } // Next, if so, proceed with the implementation of this function: - result = - allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->ggp_surf.base), sizeof(icd_surface->ggp_surf), &icd_surface); + result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->ggp_surf.base), sizeof(icd_surface->ggp_surf), pAllocator, + &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -1523,7 +1526,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMetalSurfaceEXT(VkInstance insta // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->metal_surf.base), sizeof(icd_surface->metal_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -1589,7 +1592,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateScreenSurfaceQNX(VkInstance inst // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->screen_surf.base), sizeof(icd_surface->screen_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -1696,8 +1699,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateViSurfaceNN(VkInstance instance, } // Next, if so, proceed with the implementation of this function: - result = - allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->vi_surf.base), sizeof(icd_surface->vi_surf), &icd_surface); + result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->vi_surf.base), sizeof(icd_surface->vi_surf), pAllocator, + &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -2011,7 +2014,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstanc // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->display_surf.base), sizeof(icd_surface->display_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } @@ -2456,7 +2459,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateImagePipeSurfaceFUCHSIA(VkInstan // Next, if so, proceed with the implementation of this function: result = allocate_icd_surface_struct(loader_inst, sizeof(icd_surface->imagepipe_surf.base), sizeof(icd_surface->imagepipe_surf), - &icd_surface); + pAllocator, &icd_surface); if (VK_SUCCESS != result) { goto out; } -- 2.34.1