vulkan/device_select: remove get_pdevice_proc_addr
authorChia-I Wu <olvaffe@gmail.com>
Tue, 3 May 2022 17:55:03 +0000 (10:55 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 6 Jul 2022 23:53:25 +0000 (23:53 +0000)
It is optional and is needed only when a layer has physical device
extensions that may be unknown to the loader.

This simplifies the layer a bit, but more importantly, it works around a
bug in the loader when there is another layer in the layer chain that
wraps VkInstance.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16307>

src/vulkan/device-select-layer/device_select_layer.c

index 30f849d..ee8bfc1 100644 (file)
@@ -47,7 +47,6 @@ struct instance_info {
    PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
    PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups;
    PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
-   PFN_GetPhysicalDeviceProcAddr  GetPhysicalDeviceProcAddr;
    PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
    PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
    PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2;
@@ -167,7 +166,6 @@ static VkResult device_select_CreateInstance(const VkInstanceCreateInfo *pCreate
    info->has_vulkan11 = pCreateInfo->pApplicationInfo &&
                         pCreateInfo->pApplicationInfo->apiVersion >= VK_MAKE_VERSION(1, 1, 0);
 
-   info->GetPhysicalDeviceProcAddr = (PFN_GetPhysicalDeviceProcAddr)info->GetInstanceProcAddr(*pInstance, "vk_layerGetPhysicalDeviceProcAddr");
 #define DEVSEL_GET_CB(func) info->func = (PFN_vk##func)info->GetInstanceProcAddr(*pInstance, "vk" #func)
    DEVSEL_GET_CB(DestroyInstance);
    DEVSEL_GET_CB(EnumeratePhysicalDevices);
@@ -607,12 +605,6 @@ out:
    return result;
 }
 
-static void  (*get_pdevice_proc_addr(VkInstance instance, const char* name))()
-{
-   struct instance_info *info = device_select_layer_get_instance(instance);
-   return info->GetPhysicalDeviceProcAddr(instance, name);
-}
-
 static void  (*get_instance_proc_addr(VkInstance instance, const char* name))()
 {
    if (strcmp(name, "vkGetInstanceProcAddr") == 0)
@@ -637,7 +629,6 @@ VK_LAYER_EXPORT VkResult vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayer
    pVersionStruct->loaderLayerInterfaceVersion = 2;
 
    pVersionStruct->pfnGetInstanceProcAddr = get_instance_proc_addr;
-   pVersionStruct->pfnGetPhysicalDeviceProcAddr = get_pdevice_proc_addr;
 
    return VK_SUCCESS;
 }