From 91d4e399c81e63bc53fa0b32cd7e39c409125996 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 3 Nov 2023 14:22:59 +0000 Subject: [PATCH] a/vk: Add VK_EXT_debug_utils --- scripts/generate_vk_helpers.py | 14 ++++++++++++++ src/xrt/auxiliary/vk/vk_bundle_init.c | 8 ++++++++ src/xrt/auxiliary/vk/vk_function_loaders.c | 19 +++++++++++++++++++ src/xrt/auxiliary/vk/vk_helpers.h | 20 ++++++++++++++++++++ src/xrt/compositor/main/comp_compositor.c | 3 +++ 5 files changed, 64 insertions(+) diff --git a/scripts/generate_vk_helpers.py b/scripts/generate_vk_helpers.py index b0601e337..2f986dac3 100755 --- a/scripts/generate_vk_helpers.py +++ b/scripts/generate_vk_helpers.py @@ -171,6 +171,15 @@ def get_device_cmds(): None, Cmd("vkGetImageDrmFormatModifierPropertiesEXT", requires=("VK_EXT_image_drm_format_modifier",)), None, + Cmd("vkCmdBeginDebugUtilsLabelEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkCmdEndDebugUtilsLabelEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkCmdInsertDebugUtilsLabelEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkQueueBeginDebugUtilsLabelEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkQueueEndDebugUtilsLabelEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkQueueInsertDebugUtilsLabelEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkSetDebugUtilsObjectNameEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkSetDebugUtilsObjectTagEXT", requires=("VK_EXT_debug_utils",)), + None, Cmd("vkCmdDebugMarkerBeginEXT", requires=("VK_EXT_debug_marker",)), Cmd("vkCmdDebugMarkerEndEXT", requires=("VK_EXT_debug_marker",)), Cmd("vkCmdDebugMarkerInsertEXT", requires=("VK_EXT_debug_marker",)), @@ -254,6 +263,10 @@ def get_instance_cmds(): Cmd("vkCreateWin32SurfaceKHR", requires=("VK_USE_PLATFORM_WIN32_KHR",)), None, Cmd("vkGetPhysicalDeviceSurfaceCapabilities2EXT", requires=("VK_EXT_display_surface_counter",)), + None, + Cmd("vkCreateDebugUtilsMessengerEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkSubmitDebugUtilsMessageEXT", requires=("VK_EXT_debug_utils",)), + Cmd("vkDestroyDebugUtilsMessengerEXT", requires=("VK_EXT_debug_utils",)), ] @@ -261,6 +274,7 @@ def get_instance_cmds(): INSTANCE_EXTENSIONS_TO_CHECK = [ "VK_EXT_display_surface_counter", "VK_EXT_swapchain_colorspace", + "VK_EXT_debug_utils", ] # Sorted KHR, EXT, Vendor, interally alphabetically DEVICE_EXTENSIONS_TO_CHECK = [ diff --git a/src/xrt/auxiliary/vk/vk_bundle_init.c b/src/xrt/auxiliary/vk/vk_bundle_init.c index 978ba5136..e44e4525d 100644 --- a/src/xrt/auxiliary/vk/vk_bundle_init.c +++ b/src/xrt/auxiliary/vk/vk_bundle_init.c @@ -189,6 +189,7 @@ vk_fill_in_has_instance_extensions(struct vk_bundle *vk, struct u_string_list *e // Reset before filling out. vk->has_EXT_display_surface_counter = false; vk->has_EXT_swapchain_colorspace = false; + vk->has_EXT_debug_utils = false; const char *const *exts = u_string_list_get_data(ext_list); uint32_t ext_count = u_string_list_get_size(ext_list); @@ -209,6 +210,13 @@ vk_fill_in_has_instance_extensions(struct vk_bundle *vk, struct u_string_list *e continue; } #endif // defined(VK_EXT_swapchain_colorspace) + +#if defined(VK_EXT_debug_utils) + if (strcmp(ext, VK_EXT_DEBUG_UTILS_EXTENSION_NAME) == 0) { + vk->has_EXT_debug_utils = true; + continue; + } +#endif // defined(VK_EXT_debug_utils) } // end of GENERATED instance extension code - do not modify - used by scripts } diff --git a/src/xrt/auxiliary/vk/vk_function_loaders.c b/src/xrt/auxiliary/vk/vk_function_loaders.c index 6f7f33442..4ccb4d74c 100644 --- a/src/xrt/auxiliary/vk/vk_function_loaders.c +++ b/src/xrt/auxiliary/vk/vk_function_loaders.c @@ -134,8 +134,15 @@ vk_get_instance_functions(struct vk_bundle *vk) #if defined(VK_EXT_display_surface_counter) vk->vkGetPhysicalDeviceSurfaceCapabilities2EXT = GET_INS_PROC(vk, vkGetPhysicalDeviceSurfaceCapabilities2EXT); + #endif // defined(VK_EXT_display_surface_counter) +#if defined(VK_EXT_debug_utils) + vk->vkCreateDebugUtilsMessengerEXT = GET_INS_PROC(vk, vkCreateDebugUtilsMessengerEXT); + vk->vkSubmitDebugUtilsMessageEXT = GET_INS_PROC(vk, vkSubmitDebugUtilsMessageEXT); + vk->vkDestroyDebugUtilsMessengerEXT = GET_INS_PROC(vk, vkDestroyDebugUtilsMessengerEXT); +#endif // defined(VK_EXT_debug_utils) + // end of GENERATED instance loader code - do not modify - used by scripts // clang-format on @@ -310,6 +317,18 @@ vk_get_device_functions(struct vk_bundle *vk) #endif // defined(VK_EXT_image_drm_format_modifier) +#if defined(VK_EXT_debug_utils) + vk->vkCmdBeginDebugUtilsLabelEXT = GET_DEV_PROC(vk, vkCmdBeginDebugUtilsLabelEXT); + vk->vkCmdEndDebugUtilsLabelEXT = GET_DEV_PROC(vk, vkCmdEndDebugUtilsLabelEXT); + vk->vkCmdInsertDebugUtilsLabelEXT = GET_DEV_PROC(vk, vkCmdInsertDebugUtilsLabelEXT); + vk->vkQueueBeginDebugUtilsLabelEXT = GET_DEV_PROC(vk, vkQueueBeginDebugUtilsLabelEXT); + vk->vkQueueEndDebugUtilsLabelEXT = GET_DEV_PROC(vk, vkQueueEndDebugUtilsLabelEXT); + vk->vkQueueInsertDebugUtilsLabelEXT = GET_DEV_PROC(vk, vkQueueInsertDebugUtilsLabelEXT); + vk->vkSetDebugUtilsObjectNameEXT = GET_DEV_PROC(vk, vkSetDebugUtilsObjectNameEXT); + vk->vkSetDebugUtilsObjectTagEXT = GET_DEV_PROC(vk, vkSetDebugUtilsObjectTagEXT); + +#endif // defined(VK_EXT_debug_utils) + #if defined(VK_EXT_debug_marker) vk->vkCmdDebugMarkerBeginEXT = GET_DEV_PROC(vk, vkCmdDebugMarkerBeginEXT); vk->vkCmdDebugMarkerEndEXT = GET_DEV_PROC(vk, vkCmdDebugMarkerEndEXT); diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h index 88c2a29e6..47d83c341 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.h +++ b/src/xrt/auxiliary/vk/vk_helpers.h @@ -116,6 +116,7 @@ struct vk_bundle // beginning of GENERATED instance extension code - do not modify - used by scripts bool has_EXT_display_surface_counter; bool has_EXT_swapchain_colorspace; + bool has_EXT_debug_utils; // end of GENERATED instance extension code - do not modify - used by scripts // beginning of GENERATED device extension code - do not modify - used by scripts @@ -250,8 +251,15 @@ struct vk_bundle #if defined(VK_EXT_display_surface_counter) PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT; + #endif // defined(VK_EXT_display_surface_counter) +#if defined(VK_EXT_debug_utils) + PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT; + PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT; + PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT; +#endif // defined(VK_EXT_debug_utils) + // end of GENERATED instance loader code - do not modify - used by scripts // beginning of GENERATED device loader code - do not modify - used by scripts @@ -417,6 +425,18 @@ struct vk_bundle #endif // defined(VK_EXT_image_drm_format_modifier) +#if defined(VK_EXT_debug_utils) + PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT; + PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT; + PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT; + PFN_vkQueueBeginDebugUtilsLabelEXT vkQueueBeginDebugUtilsLabelEXT; + PFN_vkQueueEndDebugUtilsLabelEXT vkQueueEndDebugUtilsLabelEXT; + PFN_vkQueueInsertDebugUtilsLabelEXT vkQueueInsertDebugUtilsLabelEXT; + PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT; + PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT; + +#endif // defined(VK_EXT_debug_utils) + #if defined(VK_EXT_debug_marker) PFN_vkCmdDebugMarkerBeginEXT vkCmdDebugMarkerBeginEXT; PFN_vkCmdDebugMarkerEndEXT vkCmdDebugMarkerEndEXT; diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c index d0db7b048..90b2f401c 100644 --- a/src/xrt/compositor/main/comp_compositor.c +++ b/src/xrt/compositor/main/comp_compositor.c @@ -468,6 +468,9 @@ static const char *optional_instance_extensions[] = { #ifdef VK_EXT_display_surface_counter VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, #endif +#if defined VK_EXT_debug_utils && !defined NDEBUG + VK_EXT_DEBUG_UTILS_EXTENSION_NAME, +#endif }; // Note: Keep synchronized with comp_vk_glue - we should have everything they