From: Mikko Rasa Date: Wed, 16 Mar 2022 16:28:27 +0000 (+0200) Subject: Set debug names for pipeline and descriptor set layouts on Vulkan X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=9ef77734bac36f2b16380ef3e131d3164fe241ce;p=libs%2Fgl.git Set debug names for pipeline and descriptor set layouts on Vulkan --- diff --git a/source/backends/vulkan/program_backend.cpp b/source/backends/vulkan/program_backend.cpp index 728bacbc..a2c40ad3 100644 --- a/source/backends/vulkan/program_backend.cpp +++ b/source/backends/vulkan/program_backend.cpp @@ -165,12 +165,18 @@ void VulkanProgram::finalize_uniforms() layout_info.pPushConstantRanges = &push_const_range; vk.CreatePipelineLayout(layout_info, layout_handle); + +#if DEBUG + if(!debug_name.empty()) + set_vulkan_object_name(); +#endif } void VulkanProgram::set_debug_name(const string &name) { #ifdef DEBUG debug_name = name; + set_vulkan_object_name(); if(SpirVModule *spirv = static_cast(this)->specialized_spirv) spirv->set_debug_name(debug_name); #else @@ -178,5 +184,30 @@ void VulkanProgram::set_debug_name(const string &name) #endif } +void VulkanProgram::set_vulkan_object_name() const +{ +#ifdef DEBUG + const VulkanFunctions &vk = device.get_functions(); + + string layout_name = debug_name+" [layout]"; + + VkDebugUtilsObjectNameInfoEXT name_info = { }; + name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + name_info.objectType = VK_OBJECT_TYPE_PIPELINE_LAYOUT; + name_info.objectHandle = reinterpret_cast(layout_handle); + name_info.pObjectName = layout_name.c_str(); + vk.SetDebugUtilsObjectName(name_info); + + name_info.objectType = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; + for(unsigned i=0; i(desc_set_layout_handles[i]); + name_info.pObjectName = layout_name.c_str(); + vk.SetDebugUtilsObjectName(name_info); + } +#endif +} + } // namespace GL } // namespace Msp diff --git a/source/backends/vulkan/program_backend.h b/source/backends/vulkan/program_backend.h index ff39aa4e..16cf7b27 100644 --- a/source/backends/vulkan/program_backend.h +++ b/source/backends/vulkan/program_backend.h @@ -39,6 +39,7 @@ protected: void finalize_uniforms(); void set_debug_name(const std::string &); + void set_vulkan_object_name() const; }; using ProgramBackend = VulkanProgram;