Mesa (main): zink: dynamically load a few functions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 13 17:05:46 UTC 2022


Module: Mesa
Branch: main
Commit: 56e9ccce7b7c69054a231274c4cb80a77495e0fe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=56e9ccce7b7c69054a231274c4cb80a77495e0fe

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Jun 23 10:23:38 2021 +0200

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 <haochengho12907 at gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11550>

---

 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++) {



More information about the mesa-commit mailing list