summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-03-04 20:31:02 +0100
committerGitHub <noreply@github.com>2020-03-04 20:31:02 +0100
commit398f714dfcb99c229c7ace06c906374a3fd93e3c (patch)
tree982b78e02ff529e08fd59e870bdedeadea3e069b
parentfadcb75e482fe70f0100a7d7286146a1bb33c266 (diff)
parent3625b057afec5fd655db7d36ee837da12fd92987 (diff)
Merge pull request #36792 from akien-mga/vulkan-better-debug-prints
Vulkan: Use Godot print macros matching MessageSeverity flag
-rw-r--r--drivers/vulkan/vulkan_context.cpp46
1 files changed, 22 insertions, 24 deletions
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 90d32c9703..038cae7f96 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -44,7 +44,8 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define APP_SHORT_NAME "GodotEngine"
-VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
+VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(
+ VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
void *pUserData) {
@@ -67,24 +68,6 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(VkDebugU
return VK_FALSE;
}
- String severity_string;
- switch (messageSeverity) {
- case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
- severity_string = "VERBOSE : ";
- break;
- case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
- severity_string = "INFO : ";
- break;
- case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
- severity_string = "WARNING : ";
- break;
- case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT:
- severity_string = "ERROR : ";
- break;
- case VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT:
- break;
- }
-
String type_string;
switch (messageType) {
case (VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT):
@@ -133,16 +116,31 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(VkDebugU
}
}
- String error_message(severity_string + type_string +
+ String error_message(type_string +
" - Message Id Number: " + String::num_int64(pCallbackData->messageIdNumber) +
" | Message Id Name: " + pCallbackData->pMessageIdName +
"\n\t" + pCallbackData->pMessage +
objects_string + labels_string);
- ERR_PRINT(error_message);
-
- CRASH_COND_MSG(Engine::get_singleton()->is_abort_on_gpu_errors_enabled(),
- "Crashing, because abort on GPU errors is enabled.");
+ // Convert VK severity to our own log macros.
+ switch (messageSeverity) {
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
+ print_verbose(error_message);
+ break;
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
+ print_line(error_message);
+ break;
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
+ WARN_PRINT(error_message);
+ break;
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT:
+ ERR_PRINT(error_message);
+ CRASH_COND_MSG(Engine::get_singleton()->is_abort_on_gpu_errors_enabled(),
+ "Crashing, because abort on GPU errors is enabled.");
+ break;
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT:
+ break; // Shouldn't happen, only handling to make compilers happy.
+ }
return VK_FALSE;
}