diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-04 16:09:07 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-04 16:09:11 +0200 |
commit | 8a47cdc93363865cb7da5dad34f328a3fc948489 (patch) | |
tree | 196360f558e7a47b62dc8025a32e864022dc4489 | |
parent | e5aa5eb8067fada41ad8ecb5027a7917d6d5084c (diff) |
Vulkan: Initialize VK_EXT_debug_utils only for dev build or verbose mode
End users would get spammed with messages of varying verbosity due to the
mess that thirdparty layers/extensions and drivers seem to leave in their
wake, making the Windows registry a bottomless pit of broken layer JSON.
I'm all for helping end users clean up mess in their registry / system paths
for Vulkan ICDs, layers and extensions, but the way this is done by
VK_EXT_debug_utils is just horrible - and the way for them to fix it (manual
edit of system files) is also not a good thing to recommend.
Closes countless issues where users think Godot is broken because it reports
weird errors.
-rw-r--r-- | drivers/vulkan/vulkan_context.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 98adc0f16e..3441afdb82 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -85,19 +85,6 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback( return VK_FALSE; } - // Workaround for Vulkan-Loader usability bug: https://github.com/KhronosGroup/Vulkan-Loader/issues/262. - if (strstr(pCallbackData->pMessage, "wrong ELF class: ELFCLASS32") != nullptr) { - return VK_FALSE; - } - -#ifdef WINDOWS_ENABLED - // Some software installs Vulkan overlays in Windows registry and never cleans them up on uninstall. - // So we get spammy error level messages from the loader about those - make them verbose instead. - if (strstr(pCallbackData->pMessage, "loader_get_json: Failed to open JSON file") != nullptr) { - messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT; - } -#endif - if (pCallbackData->pMessageIdName && strstr(pCallbackData->pMessageIdName, "UNASSIGNED-CoreValidation-DrawState-ClearCmdBeforeDraw") != nullptr) { return VK_FALSE; } @@ -320,6 +307,16 @@ Error VulkanContext::_initialize_extensions() { VkBool32 platformSurfaceExtFound = 0; memset(extension_names, 0, sizeof(extension_names)); + // Only enable debug utils in verbose mode or DEV_ENABLED. + // End users would get spammed with messages of varying verbosity due to the + // mess that thirdparty layers/extensions and drivers seem to leave in their + // wake, making the Windows registry a bottomless pit of broken layer JSON. +#ifdef DEV_ENABLED + bool want_debug_utils = true; +#else + bool want_debug_utils = OS::get_singleton()->is_stdout_verbose(); +#endif + VkResult err = vkEnumerateInstanceExtensionProperties(nullptr, &instance_extension_count, nullptr); ERR_FAIL_COND_V(err != VK_SUCCESS && err != VK_INCOMPLETE, ERR_CANT_CREATE); @@ -347,8 +344,10 @@ Error VulkanContext::_initialize_extensions() { } } if (!strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instance_extensions[i].extensionName)) { - extension_names[enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME; - enabled_debug_utils = true; + if (want_debug_utils) { + extension_names[enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME; + enabled_debug_utils = true; + } } if (!strcmp(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, instance_extensions[i].extensionName)) { extension_names[enabled_extension_count++] = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME; |