From 56e9ccce7b7c69054a231274c4cb80a77495e0fe Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 23 Jun 2021 10:23:38 +0200 Subject: [PATCH] zink: dynamically load a few functions These functions are used in a bit of a limbo-situation; we haven't yet loaded the dispatch-table yet, because we have no instance yet. So let's instead load them directly from the loader when we need them. Reviewed-by: Hoe Hao Cheng Reviewed-By: Mike Blumenkrantz Part-of: --- src/gallium/drivers/zink/zink_instance.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_instance.py b/src/gallium/drivers/zink/zink_instance.py index 4d70bb607a8..1fa44804c4b 100644 --- a/src/gallium/drivers/zink/zink_instance.py +++ b/src/gallium/drivers/zink/zink_instance.py @@ -145,14 +145,20 @@ zink_create_instance(struct zink_screen *screen) bool have_moltenvk_layer = false; #endif + GET_PROC_ADDR_INSTANCE_LOCAL(screen, NULL, EnumerateInstanceExtensionProperties); + GET_PROC_ADDR_INSTANCE_LOCAL(screen, NULL, EnumerateInstanceLayerProperties); + if (!vk_EnumerateInstanceExtensionProperties || + !vk_EnumerateInstanceLayerProperties) + return false; + // Build up the extensions from the reported ones but only for the unnamed layer uint32_t extension_count = 0; - if (vkEnumerateInstanceExtensionProperties(NULL, &extension_count, NULL) != VK_SUCCESS) { + if (vk_EnumerateInstanceExtensionProperties(NULL, &extension_count, NULL) != VK_SUCCESS) { mesa_loge("ZINK: vkEnumerateInstanceExtensionProperties failed"); } else { VkExtensionProperties *extension_props = malloc(extension_count * sizeof(VkExtensionProperties)); if (extension_props) { - if (vkEnumerateInstanceExtensionProperties(NULL, &extension_count, extension_props) != VK_SUCCESS) { + if (vk_EnumerateInstanceExtensionProperties(NULL, &extension_count, extension_props) != VK_SUCCESS) { mesa_loge("ZINK: vkEnumerateInstanceExtensionProperties failed"); } else { for (uint32_t i = 0; i < extension_count; i++) { @@ -170,12 +176,12 @@ zink_create_instance(struct zink_screen *screen) // Build up the layers from the reported ones uint32_t layer_count = 0; - if (vkEnumerateInstanceLayerProperties(&layer_count, NULL) != VK_SUCCESS) { + if (vk_EnumerateInstanceLayerProperties(&layer_count, NULL) != VK_SUCCESS) { mesa_loge("ZINK: vkEnumerateInstanceLayerProperties failed"); } else { VkLayerProperties *layer_props = malloc(layer_count * sizeof(VkLayerProperties)); if (layer_props) { - if (vkEnumerateInstanceLayerProperties(&layer_count, layer_props) != VK_SUCCESS) { + if (vk_EnumerateInstanceLayerProperties(&layer_count, layer_props) != VK_SUCCESS) { mesa_loge("ZINK: vkEnumerateInstanceLayerProperties failed"); } else { for (uint32_t i = 0; i < layer_count; i++) {