33static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
34 VkDebugUtilsMessageTypeFlagsEXT type,
const VkDebugUtilsMessengerCallbackDataEXT* callbackData,
37 switch (vk::DebugUtilsMessageSeverityFlagBitsEXT(severity)) {
39 case vk::DebugUtilsMessageSeverityFlagBitsEXT::eVerbose:
43 case vk::DebugUtilsMessageSeverityFlagBitsEXT::eInfo:
46 case vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning:
49 case vk::DebugUtilsMessageSeverityFlagBitsEXT::eError:
60void Core::setupDebugMessageCallback() {
61 using MessageSeverity = vk::DebugUtilsMessageSeverityFlagBitsEXT;
62 using MessageType = vk::DebugUtilsMessageTypeFlagBitsEXT;
64 vk::DebugUtilsMessengerCreateInfoEXT createInfo;
66 createInfo.messageSeverity = MessageSeverity::eError | MessageSeverity::eWarning |
67 MessageSeverity::eInfo | MessageSeverity::eVerbose;
69 createInfo.messageSeverity = MessageSeverity::eError | MessageSeverity::eWarning;
71 createInfo.messageType = MessageType::eGeneral | MessageType::ePerformance | MessageType::eValidation;
72 createInfo.pfnUserCallback = debugCallback;
73 createInfo.pUserData =
nullptr;
75 auto func =
reinterpret_cast<PFN_vkCreateDebugUtilsMessengerEXT
>(vkGetInstanceProcAddr(
instance.get(),
76 "vkCreateDebugUtilsMessengerEXT"));
78 if (func ==
nullptr) {
83 const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo = &createInfo.operator
const VkDebugUtilsMessengerCreateInfoEXT&();
84 if (func(
instance.get(), pCreateInfo,
nullptr, &debugMessenger) != VK_SUCCESS) {
93void Core::destroyDebugMessageCallback() {
94 auto func =
reinterpret_cast<PFN_vkDestroyDebugUtilsMessengerEXT
>(vkGetInstanceProcAddr(
instance.get(),
95 "vkDestroyDebugUtilsMessengerEXT"));
97 if (func ==
nullptr) {
98 console.
error(
"Failed to load Debug Utils Deletion Extension");
102 func(
instance.get(), debugMessenger,
nullptr);
static vk::UniqueInstance instance