anv: Add a per-instance dispatch table
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 17 Jan 2018 02:11:03 +0000 (18:11 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 23 Jan 2018 08:15:40 +0000 (00:15 -0800)
We also switch GetInstanceProcAddr over to use it.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h

index c3a8fbb..d827aec 100644 (file)
@@ -574,6 +574,7 @@ VkResult anv_CreateInstance(
 
    instance->apiVersion = client_version;
    instance->enabled_extensions = enabled_extensions;
+   instance->dispatch = anv_dispatch_table;
    instance->physicalDeviceCount = -1;
 
    result = vk_debug_report_instance_init(&instance->debug_report_callbacks);
@@ -1088,7 +1089,11 @@ PFN_vkVoidFunction anv_GetInstanceProcAddr(
    if (instance == NULL)
       return NULL;
 
-   return anv_lookup_entrypoint(NULL, pName);
+   int idx = anv_get_entrypoint_index(pName);
+   if (idx < 0)
+      return NULL;
+
+   return instance->dispatch.entrypoints[idx];
 }
 
 /* With version 1+ of the loader interface the ICD should expose
index 1fd7c39..d1b2ebc 100644 (file)
@@ -797,6 +797,7 @@ struct anv_instance {
 
     uint32_t                                    apiVersion;
     struct anv_instance_extension_table         enabled_extensions;
+    struct anv_dispatch_table                   dispatch;
 
     int                                         physicalDeviceCount;
     struct anv_physical_device                  physicalDevice;