26 #define VK_FILELOG(msg, ...) if(vk_log->value && vk_logfp) { \
27 fprintf(vk_logfp, msg, __VA_ARGS__); \
33 int g = (
type & VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT) != 0 ? 1 : 0;
34 int p = (
type & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) != 0 ? 1 : 0;
35 int v = (
type & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) != 0 ? 1 : 0;
38 if (p && !
v)
return "(performance)";
39 if (p &&
v)
return "(performance and validation)";
40 if (
v)
return "(validation)";
46 static VKAPI_ATTR VkBool32 VKAPI_CALL
debugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT msgSeverity,
47 VkDebugUtilsMessageTypeFlagsEXT msgType,
48 const VkDebugUtilsMessengerCallbackDataEXT *callbackData,
53 case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
57 case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
61 case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
64 assert(!
"Vulkan warning occured!");
69 assert(!
"Vulkan error occured!");
76 VkDebugUtilsMessengerCreateInfoEXT callbackInfo = {
77 .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
80 .messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
81 VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
82 .messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
83 VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
84 VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT,
91 callbackInfo.messageSeverity |= VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
92 VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;