From d28e64774416742f9754b4da63727e472b7efba0 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 15 Nov 2023 23:27:11 +0000 Subject: [PATCH] st/oxr: Make debug utils forcible And don't always turn it on for XR_KHR_vulkan_enable, as it would result in crashes on old Vulkan drivers (like those on Pixel 3). --- src/xrt/state_trackers/oxr/oxr_session_gfx_vk.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/xrt/state_trackers/oxr/oxr_session_gfx_vk.c b/src/xrt/state_trackers/oxr/oxr_session_gfx_vk.c index f78cb60f0..5961d9fc6 100644 --- a/src/xrt/state_trackers/oxr/oxr_session_gfx_vk.c +++ b/src/xrt/state_trackers/oxr/oxr_session_gfx_vk.c @@ -28,6 +28,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(force_timeline_semaphores, "OXR_DEBUG_FORCE_TIMELINE_SEMAPHORES", false) +DEBUG_GET_ONCE_BOOL_OPTION(force_debug_utils, "OXR_DEBUG_FORCE_VK_DEBUG_UTILS", false) static bool @@ -111,12 +112,22 @@ oxr_session_populate_vk(struct oxr_logger *log, timeline_semaphore_enabled = true; } -#if defined(VK_EXT_debug_utils) +#ifdef OXR_HAVE_KHR_vulkan_enable2 if (sys->inst->extensions.KHR_vulkan_enable2) { debug_utils_enabled = sess->sys->vk.debug_utils_enabled; - } else if (sys->inst->extensions.KHR_vulkan_enable) { + } +#endif + + if (!debug_utils_enabled && debug_get_bool_option_force_debug_utils()) { + oxr_log(log, "Forcing VK_EXT_debug_utils on, your app better have enabled them!"); debug_utils_enabled = true; } + +#ifndef VK_EXT_debug_utils + if (debug_utils_enabled) { + oxr_log(log, "VK_EXT_debug_utils detected or forced, but not built with it!"); + debug_utils_enabled = false; + } #endif #if defined(XRT_FEATURE_RENDERDOC) && defined(XR_USE_PLATFORM_ANDROID)