2021-01-31 10:58:55 +00:00
|
|
|
#ifndef __QF_Vulkan_debug_h
|
|
|
|
#define __QF_Vulkan_debug_h
|
|
|
|
|
2022-05-07 03:38:31 +00:00
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
#define VK_NO_PROTOTYPES
|
|
|
|
#endif
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
|
|
|
#include "QF/simd/types.h"
|
|
|
|
|
2021-07-06 02:53:17 +00:00
|
|
|
#if (defined(_WIN32) && !defined(_WIN64)) || (__WORDSIZE < 64)
|
2021-04-01 23:48:11 +00:00
|
|
|
#define QFV_duCmdBeginLabel(device, cmd, name...)
|
|
|
|
#define QFV_duCmdEndLabel(device, cmd)
|
|
|
|
#define QFV_duCmdInsertLabel(device, cmd, name...)
|
|
|
|
#define QFV_duCreateMessenger(inst, severity, type, callback, data, messenger)
|
|
|
|
#define QFV_duDestroyMessenger(inst, messenger)
|
|
|
|
#define QFV_duQueueBeginLabel(device, queue, name...)
|
|
|
|
#define QFV_duQueueEndLabel(device, queue)
|
|
|
|
#define QFV_duQueueInsertLabel(device, queue, name...)
|
|
|
|
#define QFV_duSetObjectName(device, type, handle, name)
|
|
|
|
#define QFV_duSetObjectTag(device, type, handle, name, size, tag)
|
|
|
|
#define QFV_duSubmitMessage(inst, severity, types, data)
|
|
|
|
#else
|
2021-01-31 10:58:55 +00:00
|
|
|
#define QFV_duCmdBeginLabel(device, cmd, name...)\
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkCmdBeginDebugUtilsLabelEXT) { \
|
2023-01-30 04:19:53 +00:00
|
|
|
VkDebugUtilsLabelEXT qfv_du_label = { \
|
2021-01-31 10:58:55 +00:00
|
|
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
|
|
|
|
}; \
|
2023-01-30 04:19:53 +00:00
|
|
|
dfunc->vkCmdBeginDebugUtilsLabelEXT (cmd, &qfv_du_label); \
|
2021-01-31 10:58:55 +00:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duCmdEndLabel(device, cmd) \
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkCmdEndDebugUtilsLabelEXT) { \
|
|
|
|
dfunc->vkCmdEndDebugUtilsLabelEXT (cmd); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duCmdInsertLabel(device, cmd, name...) \
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkCmdInsertDebugUtilsLabelEXT) { \
|
2023-01-30 04:19:53 +00:00
|
|
|
VkDebugUtilsLabelEXT qfv_du_label = { \
|
2021-01-31 10:58:55 +00:00
|
|
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
|
|
|
|
}; \
|
2023-01-30 04:19:53 +00:00
|
|
|
dfunc->vkCmdInsertDebugUtilsLabelEXT (cmd, &qfv_du_label); \
|
2021-01-31 10:58:55 +00:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duCreateMessenger(inst, severity, type, callback, data, messenger)\
|
|
|
|
do { \
|
|
|
|
if (inst->funcs->vkCreateDebugUtilsMessengerEXT) { \
|
|
|
|
VkDebugUtilsMessengerCreateInfoEXT createInfo = { \
|
|
|
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT, 0, 0,\
|
|
|
|
severity, type, callback, data \
|
|
|
|
}; \
|
|
|
|
inst->funcs->vkCreateDebugUtilsMessengerEXT (inst, &createInfo, 0,\
|
|
|
|
messenger); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duDestroyMessenger(inst, messenger) \
|
|
|
|
do { \
|
|
|
|
if (inst->funcs->vkDestroyDebugUtilsMessengerEXT) { \
|
|
|
|
inst->funcs->vkDestroyDebugUtilsMessengerEXT (inst, messenger, 0);\
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duQueueBeginLabel(device, queue, name...) \
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkQueueBeginDebugUtilsLabelEXT) { \
|
2023-01-30 04:19:53 +00:00
|
|
|
VkDebugUtilsLabelEXT qfv_du_label = { \
|
2021-01-31 10:58:55 +00:00
|
|
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
|
|
|
|
}; \
|
2023-01-30 04:19:53 +00:00
|
|
|
dfunc->vkQueueBeginDebugUtilsLabelEXT (queue, &qfv_du_label); \
|
2021-01-31 10:58:55 +00:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duQueueEndLabel(device, queue) \
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkQueueEndDebugUtilsLabelEXT) { \
|
|
|
|
dfunc->vkQueueEndDebugUtilsLabelEXT (queue); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duQueueInsertLabel(device, queue, name...) \
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkQueueInsertDebugUtilsLabelEXT) { \
|
2023-01-30 04:19:53 +00:00
|
|
|
VkDebugUtilsLabelEXT qfv_du_label = { \
|
2021-01-31 10:58:55 +00:00
|
|
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, 0, name \
|
|
|
|
}; \
|
2023-01-30 04:19:53 +00:00
|
|
|
dfunc->vkQueueInsertDebugUtilsLabelEXT (queue, &qfv_du_label); \
|
2021-01-31 10:58:55 +00:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duSetObjectName(device, type, handle, name) \
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkSetDebugUtilsObjectNameEXT) { \
|
|
|
|
VkDebugUtilsObjectNameInfoEXT nameInfo = { \
|
|
|
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, 0, \
|
2021-03-29 10:55:05 +00:00
|
|
|
type, (uint64_t) handle, name \
|
2021-01-31 10:58:55 +00:00
|
|
|
}; \
|
|
|
|
dfunc->vkSetDebugUtilsObjectNameEXT (device->dev, &nameInfo); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duSetObjectTag(device, type, handle, name, size, tag) \
|
|
|
|
do { \
|
|
|
|
qfv_devfuncs_t *dfunc = device->funcs; \
|
|
|
|
if (dfunc->vkSetDebugUtilsObjectTagEXT) { \
|
|
|
|
VkDebugUtilsObjectTagInfoEXT tagInfo = { \
|
|
|
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT, 0, \
|
|
|
|
type, handle, name, size, tag \
|
|
|
|
}; \
|
|
|
|
dfunc->vkSetDebugUtilsObjectTagEXT (device->dev, &tagInfo); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define QFV_duSubmitMessage(inst, severity, types, data) \
|
|
|
|
do { \
|
|
|
|
if (inst->funcs->vkSubmitDebugUtilsMessageEXT) { \
|
|
|
|
inst->funcs->vkSubmitDebugUtilsMessageEXT (inst, severity, types, \
|
|
|
|
data); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2021-04-01 23:48:11 +00:00
|
|
|
#endif
|
2021-01-31 10:58:55 +00:00
|
|
|
|
2022-05-07 03:38:31 +00:00
|
|
|
struct qfv_device_s;
|
|
|
|
|
|
|
|
void QFV_CmdBeginLabel (struct qfv_device_s *device, VkCommandBuffer cmd,
|
|
|
|
const char *name, vec4f_t color);
|
|
|
|
void QFV_CmdEndLabel (struct qfv_device_s *device, VkCommandBuffer cmd);
|
|
|
|
void QFV_CmdInsertLabel (struct qfv_device_s *device, VkCommandBuffer cmd,
|
|
|
|
const char *name, vec4f_t color);
|
|
|
|
|
2021-01-31 10:58:55 +00:00
|
|
|
#endif//__QF_Vulkan_debug_h
|