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
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include <vulkan/vulkan.hpp>
namespace sophia {
void loadDebugLabelFunctions(vk::Instance instance);
void beginDebugLabel(vk::CommandBuffer commandBuffer, const char* name);
void endDebugLabel(vk::CommandBuffer commandBuffer);
} // namespace sophia
+4
View File
@@ -5,6 +5,8 @@
#include <set>
#include <sophia/util/logger.hpp>
#include "vulkan/debug_label.hpp"
namespace sophia {
static VKAPI_ATTR vk::Bool32 VKAPI_CALL
@@ -288,6 +290,8 @@ void Device::setupDebugMessenger() {
nullptr, &this->debugMessenger) != VK_SUCCESS) {
throw std::runtime_error("failed to set up debug callback!");
}
loadDebugLabelFunctions(*instance);
}
bool Device::checkValidationLayerSupport() {