Move over to VK_EXT_debug_utils.

Debug marker is deprecated years ago.
This commit is contained in:
Themaister 2022-08-31 19:02:53 +02:00
parent fd41b0f90c
commit 6038d503c2
4 changed files with 38 additions and 69 deletions

View File

@ -80,43 +80,19 @@ static bool trigger_spurious_error(void)
#ifdef VULKAN_DEBUG #ifdef VULKAN_DEBUG
static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb( static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb(
VkDebugReportFlagsEXT flags, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugReportObjectTypeEXT objectType, VkDebugUtilsMessageTypeFlagsEXT messageType,
uint64_t object, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
size_t location,
int32_t messageCode,
const char *pLayerPrefix,
const char *pMessage,
void *pUserData) void *pUserData)
{ {
(void)objectType; const char *name;
(void)object;
(void)location;
(void)messageCode;
(void)pUserData; (void)pUserData;
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT &&
messageType == VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT)
{ {
RARCH_ERR("[Vulkan]: Error: %s: %s\n", RARCH_ERR("[Vulkan]: Validation Error: %s\n", pCallbackData->pMessage);
pLayerPrefix, pMessage);
} }
#if 0
else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT)
{
RARCH_WARN("[Vulkan]: Warning: %s: %s\n",
pLayerPrefix, pMessage);
}
else if (flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT)
{
RARCH_LOG("[Vulkan]: Performance warning: %s: %s\n",
pLayerPrefix, pMessage);
}
else
{
RARCH_LOG("[Vulkan]: Information: %s: %s\n",
pLayerPrefix, pMessage);
}
#endif
return VK_FALSE; return VK_FALSE;
} }
@ -1787,7 +1763,7 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
(struct retro_hw_render_context_negotiation_interface_vulkan*)video_driver_get_context_negotiation_interface(); (struct retro_hw_render_context_negotiation_interface_vulkan*)video_driver_get_context_negotiation_interface();
#ifdef VULKAN_DEBUG #ifdef VULKAN_DEBUG
static const char *instance_layers[] = { "VK_LAYER_KHRONOS_validation" }; static const char *instance_layers[] = { "VK_LAYER_KHRONOS_validation" };
instance_extensions[ext_count++] = "VK_EXT_debug_report"; instance_extensions[ext_count++] = "VK_EXT_debug_utils";
#endif #endif
if (iface && iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN) if (iface && iface->interface_type != RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN)
@ -1923,24 +1899,29 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
#ifdef VULKAN_DEBUG #ifdef VULKAN_DEBUG
VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(vk->context.instance, VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(vk->context.instance,
vkCreateDebugReportCallbackEXT); vkCreateDebugUtilsMessengerEXT);
VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(vk->context.instance, VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(vk->context.instance,
vkDebugReportMessageEXT); vkDestroyDebugUtilsMessengerEXT);
VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(vk->context.instance, VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(vk->context.instance,
vkDestroyDebugReportCallbackEXT); vkSetDebugUtilsObjectNameEXT);
{ {
VkDebugReportCallbackCreateInfoEXT info = VkDebugUtilsMessengerCreateInfoEXT info =
{ VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT }; { VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT };
info.flags = info.messageSeverity =
VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT |
VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT;
info.pfnCallback = vulkan_debug_cb; info.messageType =
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
info.pfnUserCallback = vulkan_debug_cb;
if (vk->context.instance) if (vk->context.instance)
vkCreateDebugReportCallbackEXT(vk->context.instance, &info, NULL, {
vkCreateDebugUtilsMessengerEXT(vk->context.instance, &info, NULL,
&vk->context.debug_callback); &vk->context.debug_callback);
}
} }
RARCH_LOG("[Vulkan]: Enabling Vulkan debug layers.\n"); RARCH_LOG("[Vulkan]: Enabling Vulkan debug layers.\n");
#endif #endif
@ -1957,6 +1938,7 @@ bool vulkan_context_init(gfx_ctx_vulkan_data_t *vk,
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
{ {
RARCH_ERR("Failed to create Vulkan instance (%d).\n", res); RARCH_ERR("Failed to create Vulkan instance (%d).\n", res);
RARCH_ERR("If VULKAN_DEBUG=1 is enabled, make sure Vulkan validation layers are installed.\n");
return false; return false;
} }
@ -2521,7 +2503,7 @@ void vulkan_context_destroy(gfx_ctx_vulkan_data_t *vk,
#ifdef VULKAN_DEBUG #ifdef VULKAN_DEBUG
if (vk->context.debug_callback) if (vk->context.debug_callback)
vkDestroyDebugReportCallbackEXT(vk->context.instance, vk->context.debug_callback, NULL); vkDestroyDebugUtilsMessengerEXT(vk->context.instance, vk->context.debug_callback, NULL);
#endif #endif
if (video_driver_is_video_cache_context()) if (video_driver_is_video_cache_context())

View File

@ -140,7 +140,7 @@ typedef struct vulkan_context
VkSemaphore swapchain_wait_semaphores[VULKAN_MAX_SWAPCHAIN_IMAGES]; VkSemaphore swapchain_wait_semaphores[VULKAN_MAX_SWAPCHAIN_IMAGES];
#ifdef VULKAN_DEBUG #ifdef VULKAN_DEBUG
VkDebugReportCallbackEXT debug_callback; VkDebugUtilsMessengerEXT debug_callback;
#endif #endif
uint32_t graphics_queue_index; uint32_t graphics_queue_index;
uint32_t num_swapchain_images; uint32_t num_swapchain_images;

View File

@ -317,22 +317,13 @@ extern PFN_vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayP
#define vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR #define vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR
extern PFN_vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR; extern PFN_vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR;
#define vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR #define vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR
extern PFN_vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT;
#define vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT extern PFN_vkCreateDebugUtilsMessengerEXT vulkan_symbol_wrapper_vkCreateDebugUtilsMessengerEXT;
extern PFN_vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT; #define vkCreateDebugUtilsMessengerEXT vulkan_symbol_wrapper_vkCreateDebugUtilsMessengerEXT
#define vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT extern PFN_vkDestroyDebugUtilsMessengerEXT vulkan_symbol_wrapper_vkDestroyDebugUtilsMessengerEXT;
extern PFN_vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT; #define vkDestroyDebugUtilsMessengerEXT vulkan_symbol_wrapper_vkDestroyDebugUtilsMessengerEXT
#define vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT extern PFN_vkSetDebugUtilsObjectNameEXT vulkan_symbol_wrapper_vkSetDebugUtilsObjectNameEXT;
extern PFN_vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT; #define vkSetDebugUtilsObjectNameEXT vulkan_symbol_wrapper_vkSetDebugUtilsObjectNameEXT
#define vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT
extern PFN_vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT;
#define vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT
extern PFN_vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT;
#define vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT
extern PFN_vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT;
#define vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT
extern PFN_vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT;
#define vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT
void vulkan_symbol_wrapper_init(PFN_vkGetInstanceProcAddr get_instance_proc_addr); void vulkan_symbol_wrapper_init(PFN_vkGetInstanceProcAddr get_instance_proc_addr);
PFN_vkGetInstanceProcAddr vulkan_symbol_wrapper_instance_proc_addr(void); PFN_vkGetInstanceProcAddr vulkan_symbol_wrapper_instance_proc_addr(void);

View File

@ -156,14 +156,10 @@ PFN_vkCreateDisplayModeKHR vulkan_symbol_wrapper_vkCreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR vulkan_symbol_wrapper_vkGetDisplayPlaneCapabilitiesKHR; PFN_vkGetDisplayPlaneCapabilitiesKHR vulkan_symbol_wrapper_vkGetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR; PFN_vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR;
PFN_vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR; PFN_vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR;
PFN_vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT; PFN_vkCreateDebugUtilsMessengerEXT vulkan_symbol_wrapper_vkCreateDebugUtilsMessengerEXT;
PFN_vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT; PFN_vkDestroyDebugUtilsMessengerEXT vulkan_symbol_wrapper_vkDestroyDebugUtilsMessengerEXT;
PFN_vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT; PFN_vkSetDebugUtilsObjectNameEXT vulkan_symbol_wrapper_vkSetDebugUtilsObjectNameEXT;
PFN_vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT;
PFN_vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT;
PFN_vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT;
PFN_vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT;
static PFN_vkGetInstanceProcAddr GetInstanceProcAddr; static PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
void vulkan_symbol_wrapper_init(PFN_vkGetInstanceProcAddr get_instance_proc_addr) void vulkan_symbol_wrapper_init(PFN_vkGetInstanceProcAddr get_instance_proc_addr)