ULRE/inc/hgl/graph/VKDebugUtils.h

114 lines
4.7 KiB
C
Raw Normal View History

2022-09-26 12:14:52 +08:00
#ifndef HGL_GRAPH_VULKAN_DEBUG_UTILS_INCLUDE
#define HGL_GRAPH_VULKAN_DEBUG_UTILS_INCLUDE
#include<hgl/graph/VK.h>
#include<hgl/color/Color4f.h>
2025-01-25 01:39:32 +08:00
#include<hgl/graph/VKTexture.h>
2022-09-26 12:14:52 +08:00
VK_NAMESPACE_BEGIN
2022-09-26 16:11:42 +08:00
struct DebugUtilsFunction
{
PFN_vkSetDebugUtilsObjectNameEXT SetName;
PFN_vkSetDebugUtilsObjectTagEXT SetTag;
PFN_vkQueueBeginDebugUtilsLabelEXT QueueBegin;
PFN_vkQueueEndDebugUtilsLabelEXT QueueEnd;
PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsert;
PFN_vkCmdBeginDebugUtilsLabelEXT CmdBegin;
PFN_vkCmdEndDebugUtilsLabelEXT CmdEnd;
PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsert;
2022-09-26 16:11:42 +08:00
};//struct DebugUtilsFunction
class DebugUtils
2022-09-26 12:14:52 +08:00
{
VkDevice device;
2022-09-26 16:11:42 +08:00
DebugUtilsFunction duf;
private:
2022-09-26 12:14:52 +08:00
2022-09-26 16:11:42 +08:00
friend DebugUtils *CreateDebugUtils(VkDevice);
2022-09-26 12:14:52 +08:00
2022-09-26 16:11:42 +08:00
DebugUtils(VkDevice dev,const DebugUtilsFunction &f)
{
device=dev;
duf=f;
}
public:
~DebugUtils()=default;
2022-09-26 12:14:52 +08:00
void SetName(VkObjectType,uint64_t,const char *);
#define DU_FUNC(n,N) void Set##n(Vk##n obj,const char *name){SetName(VK_OBJECT_TYPE_##N,(uint64_t)obj,name);}
DU_FUNC(Instance ,INSTANCE )
DU_FUNC(PhysicalDevice ,PHYSICAL_DEVICE )
DU_FUNC(Device ,DEVICE )
DU_FUNC(Queue ,QUEUE )
DU_FUNC(Semaphore ,SEMAPHORE )
DU_FUNC(CommandBuffer ,COMMAND_BUFFER )
DU_FUNC(Fence ,FENCE )
DU_FUNC(DeviceMemory ,DEVICE_MEMORY )
DU_FUNC(Buffer ,BUFFER )
DU_FUNC(Image ,IMAGE )
DU_FUNC(Event ,EVENT )
DU_FUNC(QueryPool ,QUERY_POOL )
DU_FUNC(BufferView ,BUFFER_VIEW )
DU_FUNC(ImageView ,IMAGE_VIEW )
DU_FUNC(ShaderModule ,SHADER_MODULE )
DU_FUNC(PipelineCache ,PIPELINE_CACHE )
DU_FUNC(PipelineLayout ,PIPELINE_LAYOUT )
DU_FUNC(RenderPass ,RENDER_PASS )
DU_FUNC(Pipeline ,PIPELINE )
DU_FUNC(DescriptorSetLayout ,DESCRIPTOR_SET_LAYOUT )
DU_FUNC(Sampler ,SAMPLER )
DU_FUNC(DescriptorPool ,DESCRIPTOR_POOL )
DU_FUNC(DescriptorSet ,DESCRIPTOR_SET )
DU_FUNC(Framebuffer ,FRAMEBUFFER )
DU_FUNC(CommandPool ,COMMAND_POOL )
DU_FUNC(SamplerYcbcrConversion, SAMPLER_YCBCR_CONVERSION)
DU_FUNC(DescriptorUpdateTemplate, DESCRIPTOR_UPDATE_TEMPLATE)
DU_FUNC(PrivateDataSlot, PRIVATE_DATA_SLOT)
DU_FUNC(SurfaceKHR, SURFACE_KHR)
DU_FUNC(SwapchainKHR, SWAPCHAIN_KHR)
DU_FUNC(DisplayKHR, DISPLAY_KHR)
DU_FUNC(DisplayModeKHR, DISPLAY_MODE_KHR)
DU_FUNC(DebugReportCallbackEXT, DEBUG_REPORT_CALLBACK_EXT)
#ifdef VK_ENABLE_BETA_EXTENSIONS
DU_FUNC(VideoSessionKHR, VIDEO_SESSION_KHR)
DU_FUNC(VideoSessionParametersKHR, VIDEO_SESSION_PARAMETERS_KH)
#endif//VK_ENABLE_BETA_EXTENSIONS
DU_FUNC(CuModuleNVX, CU_MODULE_NVX)
DU_FUNC(CuFunctionNVX, CU_FUNCTION_NVX)
DU_FUNC(DebugUtilsMessengerEXT, DEBUG_UTILS_MESSENGER_EXT)
DU_FUNC(AccelerationStructureKHR, ACCELERATION_STRUCTURE_KHR)
DU_FUNC(ValidationCacheEXT, VALIDATION_CACHE_EXT)
DU_FUNC(AccelerationStructureNV, ACCELERATION_STRUCTURE_NV)
DU_FUNC(PerformanceConfigurationINTEL, PERFORMANCE_CONFIGURATION_INTEL)
DU_FUNC(DeferredOperationKHR, DEFERRED_OPERATION_KHR)
DU_FUNC(IndirectCommandsLayoutNV, INDIRECT_COMMANDS_LAYOUT_NV)
// DU_FUNC(BufferCollectionFuchsia, BUFFER_COLLECTION_FUCHSIA)
2022-09-27 19:41:28 +08:00
#undef DU_FUNC
2025-01-25 01:39:32 +08:00
void SetTexture(Texture *tex,const AnsiString &info)
{
SetImage( tex->GetImage(), info+"_Image" );
SetImageView( tex->GetVulkanImageView(), info+"_ImageView" );
SetDeviceMemory(tex->GetDeviceMemory(), info+"_Memory" );
}
void QueueBegin (VkQueue,const char *,const Color4f &color=Color4f(1,1,1,1));
void QueueEnd (VkQueue q){duf.QueueEnd(q);}
void QueueInsert (VkQueue q,const char *,const Color4f &color=Color4f(1,1,1,1));
void CmdBegin (VkCommandBuffer,const char *,const Color4f &color=Color4f(1,1,1,1));
void CmdEnd (VkCommandBuffer cmd_buf){duf.CmdEnd(cmd_buf);}
void CmdInsert (VkCommandBuffer cmd_buf,const char *,const Color4f &color=Color4f(1,1,1,1));
2022-09-26 16:11:42 +08:00
};//class DebugUtils
2022-09-26 12:14:52 +08:00
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_DEBUG_UTILS_INCLUDE