mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-27 00:51:46 +00:00
a/vk: Use VK_EXT_debug_utils to name objects
This commit is contained in:
parent
91d4e399c8
commit
c7dc483b9a
|
@ -10,29 +10,35 @@
|
|||
#include "vk/vk_helpers.h"
|
||||
|
||||
|
||||
#ifdef VK_EXT_debug_marker
|
||||
#ifdef VK_EXT_debug_utils
|
||||
|
||||
void
|
||||
vk_name_object(struct vk_bundle *vk, VkDebugReportObjectTypeEXT object_type, uint64_t object, const char *name)
|
||||
vk_name_object(struct vk_bundle *vk, VkObjectType type, uint64_t object, const char *name)
|
||||
{
|
||||
if (!vk->has_EXT_debug_marker) {
|
||||
if (!vk->has_EXT_debug_utils) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (object == 0) {
|
||||
U_LOG_W("Called with null object!");
|
||||
/*
|
||||
* VUID-VkDebugUtilsObjectNameInfoEXT-objectType-02589
|
||||
* If objectType is VK_OBJECT_TYPE_UNKNOWN, objectHandle must not be VK_NULL_HANDLE
|
||||
*/
|
||||
if (type == VK_OBJECT_TYPE_UNKNOWN && object == 0) {
|
||||
U_LOG_W("Unknown object type can't be VK_NULL_HANDLE");
|
||||
return;
|
||||
}
|
||||
|
||||
VkDebugMarkerObjectNameInfoEXT name_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
.objectType = object_type,
|
||||
.object = object,
|
||||
const VkDebugUtilsObjectNameInfoEXT name_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
|
||||
.objectType = type,
|
||||
.objectHandle = object,
|
||||
.pObjectName = name,
|
||||
};
|
||||
|
||||
vk->vkDebugMarkerSetObjectNameEXT(vk->device, &name_info);
|
||||
VkResult ret = vk->vkSetDebugUtilsObjectNameEXT(vk->device, &name_info);
|
||||
if (ret != VK_SUCCESS) {
|
||||
VK_ERROR(vk, "vkSetDebugUtilsObjectNameEXT: %s", vk_result_string(ret));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -621,15 +621,15 @@ xrt_swapchain_usage_flag_string(enum xrt_swapchain_usage_bits bits, bool null_on
|
|||
*
|
||||
*/
|
||||
|
||||
#if defined(VK_EXT_debug_marker) || defined(XRT_DOXYGEN)
|
||||
#if defined(VK_EXT_debug_utils) || defined(XRT_DOXYGEN)
|
||||
|
||||
/*!
|
||||
* Uses VK_EXT_debug_marker to name objects for easier debugging.
|
||||
* Uses VK_EXT_debug_utils to set a name for an object, for easier debugging.
|
||||
*
|
||||
* @ingroup aux_vk
|
||||
*/
|
||||
void
|
||||
vk_name_object(struct vk_bundle *vk, VkDebugReportObjectTypeEXT object_type, uint64_t object, const char *name);
|
||||
vk_name_object(struct vk_bundle *vk, VkObjectType type, uint64_t object, const char *name);
|
||||
|
||||
/*!
|
||||
* Small helper for @ref vk_name_object that makes use of pre-process to avoid
|
||||
|
@ -637,10 +637,12 @@ vk_name_object(struct vk_bundle *vk, VkDebugReportObjectTypeEXT object_type, uin
|
|||
*
|
||||
* @ingroup aux_vk
|
||||
*/
|
||||
#define VK_NAME_OBJECT(vk, TYPE, obj, name) \
|
||||
if (vk->has_EXT_debug_marker) { \
|
||||
vk_name_object(vk, VK_DEBUG_REPORT_OBJECT_TYPE_##TYPE##_EXT, (uint64_t)obj, name); \
|
||||
}
|
||||
#define VK_NAME_OBJECT(VK, TYPE, OBJ, NAME) \
|
||||
do { \
|
||||
if ((VK)->has_EXT_debug_utils) { \
|
||||
vk_name_object(VK, VK_OBJECT_TYPE_##TYPE, (uint64_t)OBJ, NAME); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#else
|
||||
|
||||
|
|
Loading…
Reference in a new issue