This commit is contained in:
2026-09-25 20:22:29 -07:00
parent 4ebae57cf8
commit 0d145f615d
10 changed files with 100 additions and 16 deletions
+34
View File
@@ -0,0 +1,34 @@
#include "vulkan/debug_label.hpp"
namespace sophia {
static PFN_vkCmdBeginDebugUtilsLabelEXT cmdBeginDebugUtilsLabel = nullptr;
static PFN_vkCmdEndDebugUtilsLabelEXT cmdEndDebugUtilsLabel = nullptr;
void loadDebugLabelFunctions(vk::Instance instance) {
cmdBeginDebugUtilsLabel = reinterpret_cast<PFN_vkCmdBeginDebugUtilsLabelEXT>(
vkGetInstanceProcAddr(instance, "vkCmdBeginDebugUtilsLabelEXT"));
cmdEndDebugUtilsLabel = reinterpret_cast<PFN_vkCmdEndDebugUtilsLabelEXT>(
vkGetInstanceProcAddr(instance, "vkCmdEndDebugUtilsLabelEXT"));
}
void beginDebugLabel(vk::CommandBuffer commandBuffer, const char* name) {
if (!cmdBeginDebugUtilsLabel) {
return;
}
VkDebugUtilsLabelEXT label{};
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
label.pLabelName = name;
cmdBeginDebugUtilsLabel(commandBuffer, &label);
}
void endDebugLabel(vk::CommandBuffer commandBuffer) {
if (!cmdEndDebugUtilsLabel) {
return;
}
cmdEndDebugUtilsLabel(commandBuffer);
}
} // namespace sophia