CommandBuffer supported DebugMaker

This commit is contained in:
hyzboy 2021-11-23 11:54:54 +08:00
parent e6df11e572
commit 4b6fd42451
2 changed files with 30 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include<hgl/graph/VK.h>
#include<hgl/graph/VKPipeline.h>
#include<hgl/graph/VKDescriptorSets.h>
#include<hgl/type/Color4f.h>
VK_NAMESPACE_BEGIN
//push constant 一般只有128/256字节仅能存在矩阵。
//所以我们将每个对象的独立变换矩阵存在push constant中
@ -26,6 +27,15 @@ public:
bool Begin();
bool End(){return(vkEndCommandBuffer(cmd_buf)==VK_SUCCESS);}
#ifdef _DEBUG
void SetDebugName(const char *);
void BeginRegion(const char *,const Color4f &);
void EndRegion();
#else
void BeginRegion(const char *,const Color4f &){}
void EndRegion(){}
#endif//_DEBUG
};//class GPUCmdBuffer
class RenderCmdBuffer:public GPUCmdBuffer

View File

@ -24,4 +24,24 @@ bool GPUCmdBuffer::Begin()
return(true);
}
#ifdef _DEBUG
void GPUCmdBuffer::SetDebugName(const char *object_name)
{
if(dev_attr->debug_maker)
dev_attr->debug_maker->SetCommandBufferName(cmd_buf,object_name);
}
void GPUCmdBuffer::BeginRegion(const char *region_name,const Color4f &color)
{
if(dev_attr->debug_maker)
dev_attr->debug_maker->Begin(cmd_buf,region_name,color);
}
void GPUCmdBuffer::EndRegion()
{
if(dev_attr->debug_maker)
dev_attr->debug_maker->End(cmd_buf);
}
#endif
VK_NAMESPACE_END