added DebugUtils/DebugMaker test
This commit is contained in:
@@ -41,7 +41,7 @@ public:
|
||||
void Insert(VkCommandBuffer cmdbuffer, const char *markerName, const Color4f &color);
|
||||
void End(VkCommandBuffer cmdBuffer);
|
||||
|
||||
#define DEBUG_MAKER_SET_FUNC(type,MNAME) void Set##type##Name(Vk##type obj,const char *name){SetObjectName((uint64_t)obj,VK_DEBUG_REPORT_OBJECT_TYPE_##MNAME##_EXT,name);}
|
||||
#define DEBUG_MAKER_SET_FUNC(type,MNAME) void Set##type(Vk##type obj,const char *name){SetObjectName((uint64_t)obj,VK_DEBUG_REPORT_OBJECT_TYPE_##MNAME##_EXT,name);}
|
||||
|
||||
DEBUG_MAKER_SET_FUNC(CommandBuffer, COMMAND_BUFFER)
|
||||
DEBUG_MAKER_SET_FUNC(Queue, QUEUE)
|
||||
|
@@ -5,18 +5,31 @@
|
||||
#include<hgl/type/Color4f.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
class VKDebugUtils
|
||||
struct DebugUtilsFunction
|
||||
{
|
||||
PFN_vkSetDebugUtilsObjectNameEXT SetName;
|
||||
PFN_vkCmdBeginDebugUtilsLabelEXT Begin;
|
||||
PFN_vkCmdEndDebugUtilsLabelEXT End;
|
||||
};//struct DebugUtilsFunction
|
||||
|
||||
class DebugUtils
|
||||
{
|
||||
VkDevice device;
|
||||
|
||||
PFN_vkSetDebugUtilsObjectNameEXT s_vkSetDebugUtilsObjectName;
|
||||
PFN_vkCmdBeginDebugUtilsLabelEXT s_vkCmdBeginDebugUtilsLabel;
|
||||
PFN_vkCmdEndDebugUtilsLabelEXT s_vkCmdEndDebugUtilsLabel;
|
||||
|
||||
public:
|
||||
|
||||
VKDebugUtils(VkDevice dev);
|
||||
~VKDebugUtils()=default;
|
||||
DebugUtilsFunction duf;
|
||||
|
||||
private:
|
||||
|
||||
friend DebugUtils *CreateDebugUtils(VkDevice);
|
||||
|
||||
DebugUtils(VkDevice dev,const DebugUtilsFunction &f)
|
||||
{
|
||||
device=dev;
|
||||
duf=f;
|
||||
}
|
||||
|
||||
public:
|
||||
~DebugUtils()=default;
|
||||
|
||||
void SetName(VkObjectType,uint64_t,const char *);
|
||||
|
||||
@@ -47,11 +60,7 @@ public:
|
||||
void SetCommandPool (VkCommandPool cp, const char *name){SetName(VK_OBJECT_TYPE_COMMAND_POOL, (uint64_t)cp, name);}
|
||||
|
||||
void Begin(VkCommandBuffer,const char *,const Color4f &color=Color4f(1,1,1,1));
|
||||
void End(VkCommandBuffer cmd_buf)
|
||||
{
|
||||
if(s_vkCmdEndDebugUtilsLabel)
|
||||
s_vkCmdEndDebugUtilsLabel(cmd_buf);
|
||||
}
|
||||
};//class VKDebugUtils
|
||||
void End(VkCommandBuffer cmd_buf){duf.End(cmd_buf);}
|
||||
};//class DebugUtils
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_DEBUG_UTILS_INCLUDE
|
||||
|
@@ -5,6 +5,7 @@
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include<hgl/graph/VKDebugMaker.h>
|
||||
#include<hgl/graph/VKDebugUtils.h>
|
||||
#endif//_DEBUG
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
@@ -37,7 +38,7 @@ struct GPUDeviceAttribute
|
||||
|
||||
VkSurfaceTransformFlagBitsKHR preTransform;
|
||||
VkCompositeAlphaFlagBitsKHR compositeAlpha =VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
|
||||
|
||||
VkDevice device =VK_NULL_HANDLE;
|
||||
VkCommandPool cmd_pool =VK_NULL_HANDLE;
|
||||
|
||||
@@ -47,6 +48,7 @@ struct GPUDeviceAttribute
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugMaker * debug_maker =nullptr;
|
||||
DebugUtils * debug_utils =nullptr;
|
||||
#endif//_DEBUG
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user