Merge branch 'devel_27_Default3DMaterial' of http://www.hyzgame.com:3000/hyzboy/ULRE into devel_27_Default3DMaterial

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-10-13 09:55:20 +08:00
commit b72a924853
20 changed files with 122 additions and 278 deletions

@ -1 +1 @@
Subproject commit a2f5b2d3c65bf8136e3bd53b05164c4f72de23ac
Subproject commit dd6ffdebeceea0dfc03ee58314bedfae2fc17899

View File

@ -202,7 +202,7 @@ public:
cmd_buf=hgl_zero_new<RenderCmdBuffer *>(swap_chain_count);
for(int32_t i=0;i<swap_chain_count;i++)
cmd_buf[i]=device->CreateRenderCommandBuffer();
cmd_buf[i]=device->CreateRenderCommandBuffer(device->GetPhysicalDevice()->GetDeviceName()+AnsiString(":RenderCmdBuffer_")+AnsiString::numberOf(i));
}
}
@ -298,12 +298,10 @@ public:
return(nullptr);
#ifdef _DEBUG
GPUDeviceAttribute *da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
if(da->debug_maker)
da->debug_maker->SetPipeline(*p,"[debug maker] Pipeline:"+p->GetName());
if(da->debug_utils)
da->debug_utils->SetPipeline(*p,"[debug utils] Pipeline:"+p->GetName());
if(du)
du->SetPipeline(*p,"Pipeline:"+p->GetName());
#endif//_DEBUG
return p;

View File

@ -36,6 +36,7 @@ public:
VkBuffer GetBuffer ()const{return buf.buffer;}
DeviceMemory * GetMemory ()const{return buf.memory;}
VkDeviceMemory GetVkMemory ()const{return buf.memory->operator VkDeviceMemory();}
const VkDescriptorBufferInfo * GetBufferInfo ()const{return &buf.info;}
void * Map () {return buf.memory->Map();}

View File

@ -1,86 +0,0 @@
#ifndef HGL_GRAPH_VULKAN_DEBUG_MAKER_INCLUDE
#define HGL_GRAPH_VULKAN_DEBUG_MAKER_INCLUDE
#include<hgl/graph/VK.h>
#include<hgl/color/Color4f.h>
VK_NAMESPACE_BEGIN
struct DebugMakerFunction
{
PFN_vkDebugMarkerSetObjectTagEXT SetObjectTag;
PFN_vkDebugMarkerSetObjectNameEXT SetObjectName;
PFN_vkCmdDebugMarkerBeginEXT Begin;
PFN_vkCmdDebugMarkerEndEXT End;
PFN_vkCmdDebugMarkerInsertEXT Insert;
};//struct DebugMakerFunction
class DebugMaker
{
VkDevice device;
DebugMakerFunction dmf;
protected:
void SetObjectName(uint64_t object, VkDebugReportObjectTypeEXT objectType, const char *name);
void SetObjectTag(uint64_t object, VkDebugReportObjectTypeEXT objectType, uint64_t name, size_t tagSize, const void* tag);
private:
friend DebugMaker *CreateDebugMaker(VkDevice device);
DebugMaker(VkDevice dev,const DebugMakerFunction &f)
{
device=dev;
dmf=f;
}
public:
void Begin(VkCommandBuffer cmdbuffer, const char * pMarkerName, const Color4f &color);
void Insert(VkCommandBuffer cmdbuffer, const char *markerName, const Color4f &color);
void End(VkCommandBuffer cmdBuffer);
#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(Instance, INSTANCE)
DEBUG_MAKER_SET_FUNC(PhysicalDevice, PHYSICAL_DEVICE)
DEBUG_MAKER_SET_FUNC(Device, DEVICE)
DEBUG_MAKER_SET_FUNC(Queue, QUEUE)
DEBUG_MAKER_SET_FUNC(Semaphore, SEMAPHORE)
DEBUG_MAKER_SET_FUNC(CommandBuffer, COMMAND_BUFFER)
DEBUG_MAKER_SET_FUNC(Fence, FENCE)
DEBUG_MAKER_SET_FUNC(DeviceMemory, DEVICE_MEMORY)
DEBUG_MAKER_SET_FUNC(Buffer, BUFFER)
DEBUG_MAKER_SET_FUNC(Image, IMAGE)
DEBUG_MAKER_SET_FUNC(Event, EVENT)
DEBUG_MAKER_SET_FUNC(QueryPool, QUERY_POOL)
DEBUG_MAKER_SET_FUNC(BufferView, BUFFER_VIEW)
DEBUG_MAKER_SET_FUNC(ShaderModule, SHADER_MODULE)
DEBUG_MAKER_SET_FUNC(PipelineCache, PIPELINE_CACHE)
DEBUG_MAKER_SET_FUNC(PipelineLayout, PIPELINE_LAYOUT)
DEBUG_MAKER_SET_FUNC(RenderPass, RENDER_PASS)
DEBUG_MAKER_SET_FUNC(Pipeline, PIPELINE)
DEBUG_MAKER_SET_FUNC(DescriptorSetLayout, DESCRIPTOR_SET_LAYOUT)
DEBUG_MAKER_SET_FUNC(Sampler, SAMPLER)
DEBUG_MAKER_SET_FUNC(DescriptorPool, DESCRIPTOR_POOL)
DEBUG_MAKER_SET_FUNC(DescriptorSet, DESCRIPTOR_SET)
DEBUG_MAKER_SET_FUNC(Framebuffer, FRAMEBUFFER)
DEBUG_MAKER_SET_FUNC(CommandPool, COMMAND_POOL)
DEBUG_MAKER_SET_FUNC(SurfaceKHR, SURFACE_KHR)
DEBUG_MAKER_SET_FUNC(SwapchainKHR, SWAPCHAIN_KHR)
DEBUG_MAKER_SET_FUNC(DebugReportCallbackEXT, DEBUG_REPORT_CALLBACK_EXT)
DEBUG_MAKER_SET_FUNC(DisplayKHR, DISPLAY_KHR)
DEBUG_MAKER_SET_FUNC(DisplayModeKHR, DISPLAY_MODE_KHR)
DEBUG_MAKER_SET_FUNC(ValidationCacheEXT, VALIDATION_CACHE_EXT)
DEBUG_MAKER_SET_FUNC(SamplerYcbcrConversion, SAMPLER_YCBCR_CONVERSION)
DEBUG_MAKER_SET_FUNC(DescriptorUpdateTemplate, DESCRIPTOR_UPDATE_TEMPLATE)
DEBUG_MAKER_SET_FUNC(CuModuleNVX, CU_MODULE_NVX)
DEBUG_MAKER_SET_FUNC(CuFunctionNVX, CU_FUNCTION_NVX)
DEBUG_MAKER_SET_FUNC(AccelerationStructureKHR, ACCELERATION_STRUCTURE_KHR)
DEBUG_MAKER_SET_FUNC(AccelerationStructureNV, ACCELERATION_STRUCTURE_NV)
#undef DEBUG_MAKER_SET_FUNC
};//class DebugMaker
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_DEBUG_MAKER_INCLUDE

View File

@ -47,7 +47,7 @@ private:
private:
VkCommandBuffer CreateCommandBuffer();
VkCommandBuffer CreateCommandBuffer(const AnsiString &);
bool CreateSwapchainFBO(Swapchain *);
@ -85,6 +85,8 @@ public:
void WaitIdle ()const {vkDeviceWaitIdle(attr->device);}
DebugUtils * GetDebugUtils (){return attr->debug_utils;}
public:
bool Resize (const VkExtent2D &);
@ -212,8 +214,8 @@ public: //shader & material
public: //Command Buffer 相关
RenderCmdBuffer * CreateRenderCommandBuffer();
TextureCmdBuffer *CreateTextureCommandBuffer();
RenderCmdBuffer * CreateRenderCommandBuffer(const AnsiString &);
TextureCmdBuffer *CreateTextureCommandBuffer(const AnsiString &);
public:

View File

@ -4,7 +4,6 @@
#include<hgl/graph/VKTexture.h>
#ifdef _DEBUG
#include<hgl/graph/VKDebugMaker.h>
#include<hgl/graph/VKDebugUtils.h>
#endif//_DEBUG
@ -48,7 +47,6 @@ struct GPUDeviceAttribute
VkPipelineCache pipeline_cache =VK_NULL_HANDLE;
#ifdef _DEBUG
DebugMaker * debug_maker =nullptr;
DebugUtils * debug_utils =nullptr;
#endif//_DEBUG

View File

@ -22,7 +22,7 @@ public:
TextureData * GetData () {return data;}
VkDeviceMemory GetDeviceMemory () {return data?data->memory->operator VkDeviceMemory():VK_NULL_HANDLE;}
VkDeviceMemory GetDeviceMemory () {return data?(data->memory?data->memory->operator VkDeviceMemory():VK_NULL_HANDLE):VK_NULL_HANDLE;}
VkImage GetImage () {return data?data->image:VK_NULL_HANDLE;}
VkImageLayout GetImageLayout () {return data?data->image_layout:VK_IMAGE_LAYOUT_UNDEFINED;}
VkImageView GetVulkanImageView () {return data?data->image_view->GetImageView():VK_NULL_HANDLE;}

View File

@ -106,10 +106,8 @@ SET(VK_INST_SOURCE ${SG_INCLUDE_PATH}/VKInstance.h
Vulkan/VKInstance.cpp)
SET(VK_DEBUG_SOURCE ${SG_INCLUDE_PATH}/VKDebugOut.h
${SG_INCLUDE_PATH}/VKDebugMaker.h
${SG_INCLUDE_PATH}/VKDebugUtils.h
Vulkan/Debug/VKDebugOut.cpp
Vulkan/Debug/VKDebugMaker.cpp
Vulkan/Debug/VKDebugUtils.cpp)
SET(VK_MEMORY_SOURCE ${SG_INCLUDE_PATH}/VKMemory.h

View File

@ -66,26 +66,21 @@ void RenderAssignBuffer::Alloc(const uint nc,const uint mc)
vbo_assigns=device->CreateVBO(ASSIGN_VBO_FMT,node_count);
#ifdef _DEBUG
GPUDeviceAttribute *da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
if(da->debug_maker)
if(du)
{
da->debug_maker->SetBuffer(ubo_l2w->GetBuffer(),"[debug maker] UBO:LocalToWorld");
du->SetBuffer(ubo_l2w->GetBuffer(),"UBO:Buffer:LocalToWorld");
du->SetDeviceMemory(ubo_l2w->GetVkMemory(),"UBO:Memory:LocalToWorld");
if(ubo_mi)
da->debug_maker->SetBuffer(ubo_mi->GetBuffer(),"[debug maker] UBO:MaterialInstance");
da->debug_maker->SetBuffer(vbo_assigns->GetBuffer(),"[debug maker] VBO:Assign");
{
du->SetBuffer(ubo_mi->GetBuffer(),"UBO:Buffer:MaterialInstance");
du->SetDeviceMemory(ubo_mi->GetVkMemory(),"UBO:Memory:MaterialInstance");
}
if(da->debug_utils)
{
da->debug_utils->SetBuffer(ubo_l2w->GetBuffer(),"[debug utils] UBO:LocalToWorld");
if(ubo_mi)
da->debug_utils->SetBuffer(ubo_mi->GetBuffer(),"[debug utils] UBO:MaterialInstance");
da->debug_utils->SetBuffer(vbo_assigns->GetBuffer(),"[debug utils] VBO:Assign");
du->SetBuffer(vbo_assigns->GetBuffer(),"VBO:Buffer:Assign");
du->SetDeviceMemory(vbo_assigns->GetVkMemory(),"VBO:Memory:Assign");
}
#endif//_DEBUG
}

View File

@ -1,86 +0,0 @@
#include<hgl/graph/VKDebugMaker.h>
VK_NAMESPACE_BEGIN
void DebugMaker::SetObjectName(uint64_t object, VkDebugReportObjectTypeEXT objectType, const char *name)
{
// Check for valid function pointer (may not be present if not running in a debugging application)
if(!dmf.SetObjectName)return;
VkDebugMarkerObjectNameInfoEXT nameInfo = {};
nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
nameInfo.objectType = objectType;
nameInfo.object = object;
nameInfo.pObjectName = name;
dmf.SetObjectName(device, &nameInfo);
}
void DebugMaker::SetObjectTag(uint64_t object, VkDebugReportObjectTypeEXT objectType, uint64_t name, size_t tagSize, const void* tag)
{
// Check for valid function pointer (may not be present if not running in a debugging application)
if(!dmf.SetObjectTag)return;
VkDebugMarkerObjectTagInfoEXT tagInfo = {};
tagInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT;
tagInfo.objectType = objectType;
tagInfo.object = object;
tagInfo.tagName = name;
tagInfo.tagSize = tagSize;
tagInfo.pTag = tag;
dmf.SetObjectTag(device, &tagInfo);
}
void DebugMaker::Begin(VkCommandBuffer cmdbuffer, const char * pMarkerName, const Color4f &color)
{
//Check for valid function pointer (may not be present if not running in a debugging application)
if(!dmf.Begin)return;
VkDebugMarkerMarkerInfoEXT markerInfo = {};
markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
memcpy(markerInfo.color, &color, sizeof(float) * 4);
markerInfo.pMarkerName = pMarkerName;
dmf.Begin(cmdbuffer, &markerInfo);
}
void DebugMaker::Insert(VkCommandBuffer cmdbuffer, const char *markerName, const Color4f &color)
{
// Check for valid function pointer (may not be present if not running in a debugging application)
if(!dmf.Insert)return;
VkDebugMarkerMarkerInfoEXT markerInfo = {};
markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT;
memcpy(markerInfo.color, &color, sizeof(float) * 4);
markerInfo.pMarkerName = markerName;
dmf.Insert(cmdbuffer, &markerInfo);
}
void DebugMaker::End(VkCommandBuffer cmdBuffer)
{
// Check for valid function (may not be present if not running in a debugging application)
if(!dmf.End)return;
dmf.End(cmdBuffer);
}
DebugMaker *CreateDebugMaker(VkDevice device)
{
DebugMakerFunction dmf;
dmf.SetObjectTag = reinterpret_cast<PFN_vkDebugMarkerSetObjectTagEXT >(vkGetDeviceProcAddr(device, "vkDebugMarkerSetObjectTagEXT"));
dmf.SetObjectName = reinterpret_cast<PFN_vkDebugMarkerSetObjectNameEXT>(vkGetDeviceProcAddr(device, "vkDebugMarkerSetObjectNameEXT"));
dmf.Begin = reinterpret_cast<PFN_vkCmdDebugMarkerBeginEXT >(vkGetDeviceProcAddr(device, "vkCmdDebugMarkerBeginEXT"));
dmf.End = reinterpret_cast<PFN_vkCmdDebugMarkerEndEXT >(vkGetDeviceProcAddr(device, "vkCmdDebugMarkerEndEXT"));
dmf.Insert = reinterpret_cast<PFN_vkCmdDebugMarkerInsertEXT >(vkGetDeviceProcAddr(device, "vkCmdDebugMarkerInsertEXT"));
if(!dmf.SetObjectTag )return(nullptr);
if(!dmf.SetObjectName )return(nullptr);
if(!dmf.Begin )return(nullptr);
if(!dmf.End )return(nullptr);
if(!dmf.Insert )return(nullptr);
return(new DebugMaker(device,dmf));
}
VK_NAMESPACE_END

View File

@ -28,27 +28,18 @@ bool GPUCmdBuffer::Begin()
#ifdef _DEBUG
void GPUCmdBuffer::SetDebugName(const UTF8String &object_name)
{
if(dev_attr->debug_maker)
dev_attr->debug_maker->SetCommandBuffer(cmd_buf,"[debug_maker]"+object_name);
if(dev_attr->debug_utils)
dev_attr->debug_utils->SetCommandBuffer(cmd_buf,"[debug_utils]"+object_name);
dev_attr->debug_utils->SetCommandBuffer(cmd_buf,object_name);
}
void GPUCmdBuffer::BeginRegion(const UTF8String &region_name,const Color4f &color)
{
if(dev_attr->debug_maker)
dev_attr->debug_maker->Begin(cmd_buf,"[debug_maker]"+region_name,color);
if(dev_attr->debug_utils)
dev_attr->debug_utils->CmdBegin(cmd_buf,"[debug_utils]"+region_name,color);
dev_attr->debug_utils->CmdBegin(cmd_buf,region_name,color);
}
void GPUCmdBuffer::EndRegion()
{
if(dev_attr->debug_maker)
dev_attr->debug_maker->End(cmd_buf);
if(dev_attr->debug_utils)
dev_attr->debug_utils->CmdEnd(cmd_buf);
}

View File

@ -23,7 +23,7 @@ GPUDevice::GPUDevice(GPUDeviceAttribute *da)
sc_rt=nullptr;
Resize(attr->surface_caps.currentExtent);
texture_cmd_buf=CreateTextureCommandBuffer();
texture_cmd_buf=CreateTextureCommandBuffer(attr->physical_device->GetDeviceName()+AnsiString(":TexCmdBuffer"));
texture_queue=CreateQueue();
}
@ -50,7 +50,7 @@ bool GPUDevice::Resize(const VkExtent2D &extent)
return(sc_rt);
}
VkCommandBuffer GPUDevice::CreateCommandBuffer()
VkCommandBuffer GPUDevice::CreateCommandBuffer(const AnsiString &name)
{
if(!attr->cmd_pool)
return(VK_NULL_HANDLE);
@ -68,21 +68,26 @@ VkCommandBuffer GPUDevice::CreateCommandBuffer()
if(res!=VK_SUCCESS)
return(VK_NULL_HANDLE);
#ifdef _DEBUG
if(attr->debug_utils)
attr->debug_utils->SetCommandBuffer(cmd_buf,name);
#endif//_DEBUG
return cmd_buf;
}
RenderCmdBuffer *GPUDevice::CreateRenderCommandBuffer()
RenderCmdBuffer *GPUDevice::CreateRenderCommandBuffer(const AnsiString &name)
{
VkCommandBuffer cb=CreateCommandBuffer();
VkCommandBuffer cb=CreateCommandBuffer(name);
if(cb==VK_NULL_HANDLE)return(nullptr);
return(new RenderCmdBuffer(attr,cb));
}
TextureCmdBuffer *GPUDevice::CreateTextureCommandBuffer()
TextureCmdBuffer *GPUDevice::CreateTextureCommandBuffer(const AnsiString &name)
{
VkCommandBuffer cb=CreateCommandBuffer();
VkCommandBuffer cb=CreateCommandBuffer(name);
if(cb==VK_NULL_HANDLE)return(nullptr);

View File

@ -21,8 +21,6 @@ GPUDeviceAttribute::GPUDeviceAttribute(VulkanInstance *inst,const GPUPhysicalDev
GPUDeviceAttribute::~GPUDeviceAttribute()
{
#ifdef _DEBUG
if(debug_maker)
delete debug_maker;
if(debug_utils)
delete debug_utils;
#endif//_DEBUG

View File

@ -7,7 +7,6 @@
#include<hgl/graph/VKTexture.h>
#include<hgl/graph/VKDeviceCreater.h>
#include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKDebugMaker.h>
#include<iostream>
#include<iomanip>
@ -18,7 +17,6 @@ VkPipelineCache CreatePipelineCache(VkDevice device,const VkPhysicalDeviceProper
void SetShaderCompilerVersion(const GPUPhysicalDevice *);
#ifdef _DEBUG
DebugMaker *CreateDebugMaker(VkDevice);
DebugUtils *CreateDebugUtils(VkDevice);
void LogSurfaceFormat(const VkSurfaceFormatKHR *surface_format_list,const uint32_t format_count,const uint32_t select)
@ -293,11 +291,6 @@ GPUDevice *VulkanDeviceCreater::CreateRenderDevice()
if(!device_attr->device)
return(nullptr);
#ifdef _DEBUG
device_attr->debug_maker=CreateDebugMaker(device_attr->device);
device_attr->debug_utils=CreateDebugUtils(device_attr->device);
#endif//_DEBUG
ChooseSurfaceFormat();
device_attr->surface_format=surface_format;
@ -321,6 +314,20 @@ GPUDevice *VulkanDeviceCreater::CreateRenderDevice()
auto_delete.Discard(); //discard autodelete
#ifdef _DEBUG
device_attr->debug_utils=CreateDebugUtils(device_attr->device);
if(device_attr->debug_utils)
{
device_attr->debug_utils->SetPhysicalDevice(*physical_device,"Physical Device:"+AnsiString(physical_device->GetDeviceName()));
device_attr->debug_utils->SetDevice(device_attr->device,"Device:"+AnsiString(physical_device->GetDeviceName()));
device_attr->debug_utils->SetSurfaceKHR(surface,"Surface");
device_attr->debug_utils->SetCommandPool(device_attr->cmd_pool,"Main Command Pool");
device_attr->debug_utils->SetDescriptorPool(device_attr->desc_pool,"Main Descriptor Pool");
device_attr->debug_utils->SetPipelineCache(device_attr->pipeline_cache,"Main Pipeline Cache");
}
#endif//_DEBUG
return(new GPUDevice(device_attr));
}

View File

@ -11,6 +11,11 @@ void GPUDevice::InitRenderPassManage()
SwapchainRenderbufferInfo rbi(attr->surface_format.format,attr->physical_device->GetDepthFormat());
device_render_pass=render_pass_manage->AcquireRenderPass(&rbi);
#ifdef _DEBUG
if(attr->debug_utils)
attr->debug_utils->SetRenderPass(device_render_pass->GetVkRenderPass(),"MainDeviceRenderPass");
#endif//_DEBUG
}
void GPUDevice::ClearRenderPassManage()

View File

@ -65,14 +65,21 @@ namespace
result=vkCreateSwapchainKHR(dev_attr->device,&swapchain_ci,nullptr,&swap_chain);
if(result==VK_SUCCESS)
return(swap_chain);
if(result!=VK_SUCCESS)
{
//LOG_ERROR(OS_TEXT("vkCreateSwapchainKHR failed, result = ")+OSString(result));
os_err<<"vkCreateSwapchainKHR failed, result="<<result<<std::endl;
return(VK_NULL_HANDLE);
}
#ifdef _DEBUG
if(dev_attr->debug_utils)
dev_attr->debug_utils->SetSwapchainKHR(swap_chain,"SwapChain");
#endif//_DEBUG
return(swap_chain);
}
}//namespace
bool GPUDevice::CreateSwapchainFBO(Swapchain *swapchain)
@ -90,6 +97,15 @@ bool GPUDevice::CreateSwapchainFBO(Swapchain *swapchain)
if(!swapchain->sc_depth)
return(false);
#ifdef _DEBUG
if(attr->debug_utils)
{
attr->debug_utils->SetImage(swapchain->sc_depth->GetImage(),"SwapchainDepthImage");
attr->debug_utils->SetImageView(swapchain->sc_depth->GetVulkanImageView(),"SwapchainDepthImageView");
attr->debug_utils->SetDeviceMemory(swapchain->sc_depth->GetDeviceMemory(),"SwapchainDepthMemory");
}
#endif//_DEBUG
swapchain->sc_color =hgl_zero_new<Texture2D *>(swapchain->color_count);
swapchain->sc_fbo =hgl_zero_new<Framebuffer *>(swapchain->color_count);
@ -103,6 +119,17 @@ bool GPUDevice::CreateSwapchainFBO(Swapchain *swapchain)
swapchain->sc_fbo[i]=CreateFBO( device_render_pass,
swapchain->sc_color[i]->GetImageView(),
swapchain->sc_depth->GetImageView());
#ifdef _DEBUG
if(attr->debug_utils)
{
attr->debug_utils->SetImage(swapchain->sc_color[i]->GetImage(),"SwapchainColorImage_"+AnsiString::numberOf(i));
attr->debug_utils->SetImageView(swapchain->sc_color[i]->GetVulkanImageView(),"SwapchainColorImageView_"+AnsiString::numberOf(i));
attr->debug_utils->SetDeviceMemory(swapchain->sc_color[i]->GetDeviceMemory(),"SwapchainColorMemory_"+AnsiString::numberOf(i));
attr->debug_utils->SetFramebuffer(swapchain->sc_fbo[i]->GetFramebuffer(),"SwapchainFBO_"+AnsiString::numberOf(i));
}
#endif//_DEBUG
}
return(true);

View File

@ -40,12 +40,13 @@ bool Primitive::Set(const AnsiString &name,VBO *vbo,VkDeviceSize offset)
buffer_list.Add(name,bd);
#ifdef _DEBUG
auto *da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
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);
if(du)
{
du->SetBuffer(vbo->GetBuffer(),prim_name+":VBO:Buffer:"+name);
du->SetDeviceMemory(vbo->GetVkMemory(),prim_name+":VBO:Memory:"+name);
}
#endif//_DEBUG
return(true);
@ -84,12 +85,13 @@ bool Primitive::Set(IndexBuffer *ib,VkDeviceSize offset)
index_buffer_data.offset=offset;
#ifdef _DEBUG
auto *da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
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");
if(du)
{
du->SetBuffer(ib->GetBuffer(),prim_name+":IBO:Buffer");
du->SetDeviceMemory(ib->GetVkMemory(),prim_name+":IBO:Memory");
}
#endif//_DEBUG
return(true);
}

View File

@ -150,13 +150,14 @@ Texture2D *RenderResource::LoadTexture2D(const OSString &filename,bool auto_mipm
Add(tex);
#ifdef _DEBUG
GPUDeviceAttribute *da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
if(du)
{
const UTF8String name=ToUTF8String(filename);
if(da->debug_maker)
da->debug_maker->SetImage(tex->GetImage(),"[debug maker] Tex2D:"+name);
if(da->debug_utils)
da->debug_utils->SetImage(tex->GetImage(),"[debug utils] Tex2D:"+name);
du->SetImage(tex->GetImage(),"Tex2D:"+name);
}
#endif//_DEBUG
}
@ -171,12 +172,14 @@ Texture2DArray *RenderResource::CreateTexture2DArray(const AnsiString &name,cons
Add(ta);
#ifdef _DEBUG
GPUDeviceAttribute *da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
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);
if(du)
{
du->SetImage(ta->GetImage(),"Tex2DArrayImage:"+name);
du->SetImageView(ta->GetVulkanImageView(),"Tex2DArrayImageView:"+name);
du->SetDeviceMemory(ta->GetDeviceMemory(),"Tex2DArrayMemory:"+name);
}
#endif//_DEBUG
return ta;

View File

@ -65,13 +65,10 @@ const ShaderModule *RenderResource::CreateShaderModule(const AnsiString &sm_name
#ifdef _DEBUG
{
auto da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
if(da->debug_maker)
da->debug_maker->SetShaderModule(*sm,"[debug maker] Shader:"+sm_name+AnsiString(":")+GetShaderStageName(sci->GetShaderStage()));
if(da->debug_utils)
da->debug_utils->SetShaderModule(*sm,"[debug utils] Shader:"+sm_name+AnsiString(":")+GetShaderStageName(sci->GetShaderStage()));
if(du)
du->SetShaderModule(*sm,"Shader:"+sm_name+AnsiString(":")+GetShaderStageName(sci->GetShaderStage()));
}
#endif//_DEBUG
@ -140,12 +137,10 @@ Material *RenderResource::CreateMaterial(const mtl::MaterialCreateInfo *mci)
mtl->pipeline_layout_data=device->CreatePipelineLayoutData(mtl->desc_manager);
#ifdef _DEBUG
GPUDeviceAttribute *da=device->GetDeviceAttribute();
DebugUtils *du=device->GetDebugUtils();
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());
if(du)
du->SetPipelineLayout(mtl->GetPipelineLayout(),"PipelineLayout:"+mtl->GetName());
#endif//_DEBUG
if(mtl->desc_manager)
@ -157,22 +152,13 @@ Material *RenderResource::CreateMaterial(const mtl::MaterialCreateInfo *mci)
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)
if(du)
{
da->debug_maker->SetDescriptorSet(mtl->mp_array[dst]->GetVkDescriptorSet(),"[debug maker] DescSet:"+debug_name);
du->SetDescriptorSet(mtl->mp_array[dst]->GetVkDescriptorSet(),"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);
du->SetDescriptorSetLayout(mtl->pipeline_layout_data->layouts[dst],"DescSetLayout:"+debug_name);
}
#endif//_DEBUG
}