Return vkDestroyDevice from vkGetDeviceProcAddr
authorDavid Harvey-Macaulay <david.harvey-macaulay@arm.com>
Mon, 13 Sep 2021 14:30:06 +0000 (15:30 +0100)
committerMatteo Franchin <matteo.franchin@arm.com>
Fri, 17 Sep 2021 12:29:15 +0000 (12:29 +0000)
The vkDestroyDevice entrypoint was listed as a instance level
entrypoint, that is, to be returned by vkGetInstanceProcAddr; however,
vkDestroyDevice is a device level entrypoint. Consequently, the layer
implementation was not called by the loader upon application calls to
vkDestroyDevice and this caused memory leaks within the layer.

Change-Id: I9d5807ff17965281580cd80eb74b07fb038073b1
Signed-off-by: David Harvey-Macaulay <david.harvey-macaulay@arm.com>
layer/layer.cpp

index 9140131..8c444bf 100644 (file)
@@ -434,6 +434,7 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI_CALL wsi_layer_vkGetDeviceProcAddr(VkDe
    GET_PROC_ADDR(vkGetSwapchainImagesKHR);
    GET_PROC_ADDR(vkAcquireNextImageKHR);
    GET_PROC_ADDR(vkQueuePresentKHR);
+   GET_PROC_ADDR(vkDestroyDevice);
 
    GET_PROC_ADDR(vkGetDeviceGroupSurfacePresentModesKHR);
    GET_PROC_ADDR(vkGetDeviceGroupPresentCapabilitiesKHR);
@@ -456,7 +457,6 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL wsi_layer_vkGetInstance
    GET_PROC_ADDR(vkCreateInstance);
    GET_PROC_ADDR(vkDestroyInstance);
    GET_PROC_ADDR(vkCreateDevice);
-   GET_PROC_ADDR(vkDestroyDevice);
    GET_PROC_ADDR(vkGetPhysicalDeviceSurfaceSupportKHR);
    GET_PROC_ADDR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
    GET_PROC_ADDR(vkGetPhysicalDeviceSurfaceFormatsKHR);