added debug name.
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
#include<hgl/graph/VKShaderModule.h>
|
||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
#include<hgl/graph/VKDeviceAttribute.h>
|
||||
#endif//_DEBUG
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
//bool Renderable::Set(const int stage_input_binding,VIL *vil,VkDeviceSize offset)
|
||||
//{
|
||||
@@ -33,6 +38,16 @@ bool Primitive::Set(const AnsiString &name,VBO *vbo,VkDeviceSize offset)
|
||||
bd.offset=offset;
|
||||
|
||||
buffer_list.Add(name,bd);
|
||||
|
||||
#ifdef _DEBUG
|
||||
auto *da=device->GetDeviceAttribute();
|
||||
|
||||
if(da->debug_maker)
|
||||
da->debug_maker->SetBuffer(vbo->GetBuffer(),"[debug maker] "+prim_name+":VBO:"+name);
|
||||
if(da->debug_utils)
|
||||
da->debug_utils->SetBuffer(vbo->GetBuffer(),"[debug utils] "+prim_name+":VBO:"+name);
|
||||
#endif//_DEBUG
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -60,4 +75,22 @@ VkBuffer Primitive::GetBuffer(const AnsiString &name,VkDeviceSize *offset)
|
||||
|
||||
return(VK_NULL_HANDLE);
|
||||
}
|
||||
|
||||
bool Primitive::Set(IndexBuffer *ib,VkDeviceSize offset)
|
||||
{
|
||||
if(!ib)return(false);
|
||||
|
||||
index_buffer_data.buffer=ib;
|
||||
index_buffer_data.offset=offset;
|
||||
|
||||
#ifdef _DEBUG
|
||||
auto *da=device->GetDeviceAttribute();
|
||||
|
||||
if(da->debug_maker)
|
||||
da->debug_maker->SetBuffer(ib->GetBuffer(),"[debug maker] "+prim_name+":IBO");
|
||||
if(da->debug_utils)
|
||||
da->debug_utils->SetBuffer(ib->GetBuffer(),"[debug utils] "+prim_name+":IBO");
|
||||
#endif//_DEBUG
|
||||
return(true);
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
|
@@ -23,7 +23,7 @@ RenderPass::~RenderPass()
|
||||
vkDestroyRenderPass(device,render_pass,nullptr);
|
||||
}
|
||||
|
||||
Pipeline *RenderPass::CreatePipeline(PipelineData *pd,const ShaderStageCreateInfoList &ssci_list,VkPipelineLayout pl,const VIL *vil)
|
||||
Pipeline *RenderPass::CreatePipeline(const AnsiString &name,PipelineData *pd,const ShaderStageCreateInfoList &ssci_list,VkPipelineLayout pl,const VIL *vil)
|
||||
{
|
||||
//以后要做一个缓冲,以Material为基准创建一个pipeline,其它MaterialInstance的pipeline全部以它为基础,这样可以提升性能。
|
||||
|
||||
@@ -53,7 +53,7 @@ Pipeline *RenderPass::CreatePipeline(PipelineData *pd,const ShaderStageCreateInf
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
return(new Pipeline(device,graphicsPipeline,pd));
|
||||
return(new Pipeline(name,device,graphicsPipeline,pd));
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ Pipeline *RenderPass::CreatePipeline(Material *mtl,const VIL *vil,const Pipeline
|
||||
|
||||
pd->SetPrim(prim,prim_restart);
|
||||
|
||||
Pipeline *p=CreatePipeline(pd,mtl->GetStageList(),mtl->GetPipelineLayout(),vil);
|
||||
Pipeline *p=CreatePipeline(mtl->GetName(),pd,mtl->GetStageList(),mtl->GetPipelineLayout(),vil);
|
||||
|
||||
if(p)
|
||||
pipeline_list.Add(p);
|
||||
|
@@ -88,11 +88,11 @@ MaterialInstance *RenderResource::CreateMaterialInstance(const mtl::MaterialCrea
|
||||
return CreateMaterialInstance(mtl,vil_cfg);
|
||||
}
|
||||
|
||||
Primitive *RenderResource::CreatePrimitive(const uint32_t vertex_count)
|
||||
Primitive *RenderResource::CreatePrimitive(const AnsiString &name,const uint32_t vertex_count)
|
||||
{
|
||||
if(!vertex_count)return(nullptr);
|
||||
|
||||
Primitive *ro=new Primitive(vertex_count);
|
||||
Primitive *ro=new Primitive(device,name,vertex_count);
|
||||
|
||||
if(ro)
|
||||
Add(ro);
|
||||
@@ -154,22 +154,31 @@ Texture2D *RenderResource::LoadTexture2D(const OSString &filename,bool auto_mipm
|
||||
const UTF8String name=ToUTF8String(filename);
|
||||
|
||||
if(da->debug_maker)
|
||||
da->debug_maker->SetImage(tex->GetImage(),"[debug maker] "+name);
|
||||
da->debug_maker->SetImage(tex->GetImage(),"[debug maker] Tex2D:"+name);
|
||||
if(da->debug_utils)
|
||||
da->debug_utils->SetImage(tex->GetImage(),"[debug utils] "+name);
|
||||
da->debug_utils->SetImage(tex->GetImage(),"[debug utils] Tex2D:"+name);
|
||||
#endif//_DEBUG
|
||||
}
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
Texture2DArray *RenderResource::CreateTexture2DArray(const uint32_t width,const uint32_t height,const uint32_t layer,const VkFormat &fmt,bool auto_mipmaps)
|
||||
Texture2DArray *RenderResource::CreateTexture2DArray(const AnsiString &name,const uint32_t width,const uint32_t height,const uint32_t layer,const VkFormat &fmt,bool auto_mipmaps)
|
||||
{
|
||||
Texture2DArray *ta=device->CreateTexture2DArray(width,height,layer,fmt,auto_mipmaps);
|
||||
|
||||
if(ta)
|
||||
Add(ta);
|
||||
|
||||
#ifdef _DEBUG
|
||||
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||
|
||||
if(da->debug_maker)
|
||||
da->debug_maker->SetImage(ta->GetImage(),"[debug maker] Tex2DArray:"+name);
|
||||
if(da->debug_utils)
|
||||
da->debug_utils->SetImage(ta->GetImage(),"[debug utils] Tex2DArray:"+name);
|
||||
#endif//_DEBUG
|
||||
|
||||
return ta;
|
||||
}
|
||||
|
||||
|
@@ -12,8 +12,11 @@
|
||||
#include<hgl/shadergen/ShaderDescriptorInfo.h>
|
||||
#include<hgl/type/ActiveMemoryBlockManager.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
#ifdef _DEBUG
|
||||
#include"VKPipelineLayoutData.h"
|
||||
#endif//_DEBUG
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
namespace
|
||||
{
|
||||
void CreateShaderStageList(List<VkPipelineShaderStageCreateInfo> &shader_stage_list,ShaderModuleMap *shader_maps)
|
||||
@@ -65,10 +68,10 @@ const ShaderModule *RenderResource::CreateShaderModule(const AnsiString &sm_name
|
||||
auto da=device->GetDeviceAttribute();
|
||||
|
||||
if(da->debug_maker)
|
||||
da->debug_maker->SetShaderModule(*sm,sm_name);
|
||||
da->debug_maker->SetShaderModule(*sm,"[debug maker] Shader:"+sm_name+AnsiString(":")+GetShaderStageName(sci->GetShaderStage()));
|
||||
|
||||
if(da->debug_utils)
|
||||
da->debug_utils->SetShaderModule(*sm,sm_name);
|
||||
da->debug_utils->SetShaderModule(*sm,"[debug utils] Shader:"+sm_name+AnsiString(":")+GetShaderStageName(sci->GetShaderStage()));
|
||||
}
|
||||
#endif//_DEBUG
|
||||
|
||||
@@ -136,12 +139,43 @@ Material *RenderResource::CreateMaterial(const mtl::MaterialCreateInfo *mci)
|
||||
|
||||
mtl->pipeline_layout_data=device->CreatePipelineLayoutData(mtl->desc_manager);
|
||||
|
||||
#ifdef _DEBUG
|
||||
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||
|
||||
if(da->debug_maker)
|
||||
da->debug_maker->SetPipelineLayout(mtl->GetPipelineLayout(),"[debug maker] PipelineLayout:"+mtl->GetName());
|
||||
if(da->debug_utils)
|
||||
da->debug_utils->SetPipelineLayout(mtl->GetPipelineLayout(),"[debug utils] PipelineLayout:"+mtl->GetName());
|
||||
#endif//_DEBUG
|
||||
|
||||
if(mtl->desc_manager)
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,dst)
|
||||
{
|
||||
if(mtl->desc_manager->hasSet((DescriptorSetType)dst))
|
||||
{
|
||||
mtl->mp_array[dst]=device->CreateMP(mtl->desc_manager,mtl->pipeline_layout_data,(DescriptorSetType)dst);
|
||||
|
||||
#ifdef _DEBUG
|
||||
GPUDeviceAttribute *da=device->GetDeviceAttribute();
|
||||
|
||||
AnsiString debug_name=mtl->GetName()+AnsiString(":")+GetDescriptorSetTypeName((DescriptorSetType)dst);
|
||||
|
||||
if(da->debug_maker)
|
||||
{
|
||||
da->debug_maker->SetDescriptorSet(mtl->mp_array[dst]->GetVkDescriptorSet(),"[debug maker] DescSet:"+debug_name);
|
||||
|
||||
da->debug_maker->SetDescriptorSetLayout(mtl->pipeline_layout_data->layouts[dst],"[debug maker] DescSetLayout:"+debug_name);
|
||||
}
|
||||
|
||||
if(da->debug_utils)
|
||||
{
|
||||
da->debug_utils->SetDescriptorSet(mtl->mp_array[dst]->GetVkDescriptorSet(),"[debug utils] DescSet:"+debug_name);
|
||||
|
||||
da->debug_utils->SetDescriptorSetLayout(mtl->pipeline_layout_data->layouts[dst],"[debug utils] DescSetLayout:"+debug_name);
|
||||
}
|
||||
#endif//_DEBUG
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user