Add utility functions to wrap up use of VK_EXT_debug_marker
* vkDebug::DebugMarkerRegion adds automatically scoped region markers * vkDebug::insertDebugMarker() inserts a label in a command buffer * vkDebug::SetObjectName() names any vulkan object with a friendly name
This commit is contained in:
parent
8753041974
commit
6362d7c216
2 changed files with 182 additions and 0 deletions
|
|
@ -44,4 +44,52 @@ namespace vkDebug
|
|||
VkDebugReportCallbackEXT callBack);
|
||||
// Clear debug callback
|
||||
void freeDebugCallback(VkInstance instance);
|
||||
|
||||
// Set up the debug marker function pointers
|
||||
void setupDebugMarkers(VkDevice device);
|
||||
|
||||
// insert a debug label into the command buffer, with or
|
||||
// without a color
|
||||
void insertDebugMarker(
|
||||
VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName,
|
||||
float color[4]);
|
||||
void insertDebugMarker(
|
||||
VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName);
|
||||
|
||||
// helper class for pushing and popping a debug region
|
||||
// around some section of code.
|
||||
struct DebugMarkerRegion
|
||||
{
|
||||
DebugMarkerRegion(VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName,
|
||||
float color[4]);
|
||||
DebugMarkerRegion(VkCommandBuffer cmdbuffer,
|
||||
const char* pMarkerName);
|
||||
~DebugMarkerRegion();
|
||||
|
||||
VkCommandBuffer cmd;
|
||||
};
|
||||
|
||||
// associate a friendly name with an object
|
||||
void SetObjectName(
|
||||
VkDevice device,
|
||||
VkDebugReportObjectTypeEXT objectType,
|
||||
uint64_t object,
|
||||
const char* pObjectName);
|
||||
|
||||
// specialised in vulkandebug.cpp for each object type
|
||||
template<typename VulkanType>
|
||||
VkDebugReportObjectTypeEXT GetObjectTypeEnum(VulkanType object);
|
||||
|
||||
// templated helper function for SetObjectName
|
||||
template<typename VulkanType>
|
||||
void SetObjectName(
|
||||
VkDevice device,
|
||||
VulkanType object,
|
||||
const char* pObjectName)
|
||||
{
|
||||
SetObjectName(device, GetObjectTypeEnum(object), (uint64_t)object, pObjectName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue