#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;
}
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,
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;
}
-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;
-}
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,