changes
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user