loader: Add initialization of loader dispatch table for wsi device extensions
authorJon Ashburn <jon@lunarg.com>
Tue, 1 Dec 2015 00:21:25 +0000 (17:21 -0700)
committerJon Ashburn <jon@lunarg.com>
Tue, 1 Dec 2015 17:51:02 +0000 (10:51 -0700)
Since we had trampoline code for these, layers were getting skipped when called
thru the trampoline code.

loader/loader.c
loader/table_ops.h

index df720c6..10473a6 100644 (file)
@@ -959,12 +959,12 @@ static VkExtensionProperties *get_extension_property(
 }
 
 /*
- * For global exenstions implemented within the loader (i.e. DEBUG_REPORT
+ * For global extensions implemented within the loader (i.e. DEBUG_REPORT
  * the extension must provide two entry points for the loader to use:
  * - "trampoline" entry point - this is the address returned by GetProcAddr
  * and will always do what's necessary to support a global call.
  * - "terminator" function - this function will be put at the end of the
- * instance chain and will contain the necessary logica to call / process
+ * instance chain and will contain the necessary logic to call / process
  * the extension for the appropriate ICDs that are available.
  * There is no generic mechanism for including these functions, the references
  * must be placed into the appropriate loader entry points.
@@ -3332,6 +3332,11 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDevice(
     /* finally can call down the chain */
     res = dev->loader_dispatch.core_dispatch.CreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice);
 
+    /* initialize WSI device extensions as part of core dispatch since loader has
+     * dedicated trampoline code for these*/
+    loader_init_device_extension_dispatch_table(&dev->loader_dispatch,
+                                                dev->loader_dispatch.core_dispatch.GetDeviceProcAddr,
+                                                *pDevice);
     dev->loader_dispatch.core_dispatch.CreateDevice = icd->CreateDevice;
 
     return res;
index 98eebe5..ed9f8d6 100644 (file)
@@ -169,9 +169,14 @@ static inline void loader_init_device_dispatch_table(struct loader_dev_dispatch_
     table->CmdNextSubpass = (PFN_vkCmdNextSubpass) gpa(dev, "vkCmdNextSubpass");
     table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass) gpa(dev, "vkCmdEndRenderPass");
     table->CmdExecuteCommands = (PFN_vkCmdExecuteCommands) gpa(dev, "vkCmdExecuteCommands");
-//TODO move into it's own table
-//TODO also consider dropping trampoline code for these device level extensions entirely
-// then don't need loader to know about these at all but then not queryable via GIPA
+
+}
+
+static inline void loader_init_device_extension_dispatch_table(struct loader_dev_dispatch_table *dev_table,
+                                                    PFN_vkGetDeviceProcAddr gpa,
+                                                    VkDevice dev)
+{
+    VkLayerDispatchTable *table = &dev_table->core_dispatch;
     table->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(dev, "vkAcquireNextImageKHR");
     table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(dev, "vkCreateSwapchainKHR");
     table->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) gpa(dev, "vkDestroySwapchainKHR");