diff options
| author | Jon Ashburn <jon@lunarg.com> | 2015-10-01 12:03:17 -0600 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2015-10-01 13:32:55 -0600 |
| commit | 8ec45b01e3a30111b247d896290bd13f4a3b50c2 (patch) | |
| tree | 2cbb43619e7abb891e5180ad1275ce903d111757 /loader | |
| parent | a1eff8b7a2c3f045b25fc80ad957e6fd0d973c53 (diff) | |
| download | usermoji-8ec45b01e3a30111b247d896290bd13f4a3b50c2.tar.xz | |
loader: Fix vkGetInstanceProcAddr to handle debug_report extension
Need loader entrypoints for debug_report extension including the utility
functions. Don't call down the instance chain GPA for this extension.
Remove instance extensions decoding when GPA instance == NULL as don't want
to return extension entrypoints unless they are enabled.
This meant the WSI swapchain instance GPA was no longer used so remove it.
Diffstat (limited to 'loader')
| -rw-r--r-- | loader/debug_report.c | 45 | ||||
| -rw-r--r-- | loader/debug_report.h | 5 | ||||
| -rw-r--r-- | loader/loader.c | 25 | ||||
| -rw-r--r-- | loader/wsi_swapchain.c | 13 | ||||
| -rw-r--r-- | loader/wsi_swapchain.h | 3 |
5 files changed, 43 insertions, 48 deletions
diff --git a/loader/debug_report.c b/loader/debug_report.c index 63c86c6f..c8686dc0 100644 --- a/loader/debug_report.c +++ b/loader/debug_report.c @@ -320,23 +320,34 @@ static void VKAPI BreakCallback( #endif } -void *debug_report_instance_gpa( +bool debug_report_instance_gpa( struct loader_instance *ptr_instance, - const char* name) + const char* name, + void **addr) { - if (ptr_instance == VK_NULL_HANDLE || !ptr_instance->debug_report_enabled) - return NULL; - - if (!strcmp("vkDbgCreateMsgCallback", name)) - return (void *) debug_report_DbgCreateMsgCallback; - else if (!strcmp("vkDbgDestroyMsgCallback", name)) - return (void *) debug_report_DbgDestroyMsgCallback; - else if (!strcmp("vkDbgStringCallback", name)) - return (void *) StringCallback; - else if (!strcmp("vkDbgStdioCallback", name)) - return (void *) StdioCallback; - else if (!strcmp("vkDbgBreakCallback", name)) - return (void *) BreakCallback; - - return NULL; + *addr = NULL; + if (ptr_instance == VK_NULL_HANDLE) + return false; + + if (!strcmp("vkDbgCreateMsgCallback", name)) { + *addr = ptr_instance->debug_report_enabled ? (void *) debug_report_DbgCreateMsgCallback : NULL; + return true; + } + if (!strcmp("vkDbgDestroyMsgCallback", name)) { + *addr = ptr_instance->debug_report_enabled ? (void *) debug_report_DbgDestroyMsgCallback : NULL; + return true; + } + if (!strcmp("vkDbgStringCallback", name)) { + *addr = ptr_instance->debug_report_enabled ? (void *) StringCallback : NULL; + return true; + } + if (!strcmp("vkDbgStdioCallback", name)) { + *addr = ptr_instance->debug_report_enabled ? (void *) StdioCallback : NULL; + return true; + } + if (!strcmp("vkDbgBreakCallback", name)) { + *addr = ptr_instance->debug_report_enabled ? (void *) BreakCallback : NULL; + return true; + } + return false; } diff --git a/loader/debug_report.h b/loader/debug_report.h index a04386a0..7b008d35 100644 --- a/loader/debug_report.h +++ b/loader/debug_report.h @@ -98,9 +98,10 @@ void debug_report_create_instance( struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); -void *debug_report_instance_gpa( +bool debug_report_instance_gpa( struct loader_instance *ptr_instance, - const char* name); + const char* name, + void **addr); VkResult VKAPI loader_DbgCreateMsgCallback( VkInstance instance, diff --git a/loader/loader.c b/loader/loader.c index 6cee2a69..a0817aac 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -3019,30 +3019,29 @@ LOADER_EXPORT PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(VkInstance instance void *addr; if (instance == VK_NULL_HANDLE) { - struct loader_instance *ptr_instance = (struct loader_instance *) instance; - /* get entrypoint addresses that are global (in the loader)*/ + /* get entrypoint addresses that are global (in the loader), + doesn't include any instance extensions since they may not be enabled yet*/ addr = globalGetProcAddr(pName); - if (addr) - return addr; - - /* return any extension global entrypoints */ - addr = debug_report_instance_gpa(ptr_instance, pName); - if (addr) { - return addr; - } - - addr = wsi_swapchain_GetInstanceProcAddr(ptr_instance, pName); return addr; } + /* return any instance entrypoints that must resolve to loader code */ addr = loader_non_passthrough_gipa(pName); if (addr) { return addr; } - /* return the instance dispatch table entrypoint for extensions */ + /* debug_report is a special case; need to return loader trampoline entrypoints + * unless the extension is not enabled; also need to handle debug_report + * utility functions */ + struct loader_instance *ptr_instance = (struct loader_instance *) instance; + if (debug_report_instance_gpa(ptr_instance, pName, &addr)) { + return addr; + } + + /* return the instance dispatch table entrypoint for core and extensions */ const VkLayerInstanceDispatchTable *disp_table = * (VkLayerInstanceDispatchTable **) instance; if (disp_table == NULL) return NULL; diff --git a/loader/wsi_swapchain.c b/loader/wsi_swapchain.c index 19c917ed..5bdf284d 100644 --- a/loader/wsi_swapchain.c +++ b/loader/wsi_swapchain.c @@ -109,17 +109,4 @@ VkResult VKAPI loader_GetPhysicalDeviceSurfaceSupportKHR( } -void *wsi_swapchain_GetInstanceProcAddr( - struct loader_instance *ptr_instance, - const char* pName) -{ - if (ptr_instance == VK_NULL_HANDLE || !ptr_instance->wsi_swapchain_enabled) { - return NULL; - } - if (!strcmp(pName, "vkGetPhysicalDeviceSurfaceSupportKHR")) { - return (void*) wsi_swapchain_GetPhysicalDeviceSurfaceSupportKHR; - } - - return NULL; -} diff --git a/loader/wsi_swapchain.h b/loader/wsi_swapchain.h index 93c99544..c0647a01 100644 --- a/loader/wsi_swapchain.h +++ b/loader/wsi_swapchain.h @@ -39,9 +39,6 @@ void wsi_swapchain_create_instance( struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); -void *wsi_swapchain_GetInstanceProcAddr( - struct loader_instance *ptr_instance, - const char* pName); VkResult VKAPI loader_GetPhysicalDeviceSurfaceSupportKHR( VkPhysicalDevice physicalDevice, |
