vk: Set debug names for image views

- Crucial for debugging hangs and crashes as well as VVL output
This commit is contained in:
kd-11 2026-01-25 01:33:03 +03:00 committed by Ani
parent 2e4a187145
commit 11087a973c
2 changed files with 29 additions and 0 deletions

View File

@ -207,6 +207,11 @@ namespace vk
return m_format_class;
}
std::string image::debug_name() const
{
return m_debug_name;
}
void image::push_layout(const command_buffer& cmd, VkImageLayout layout)
{
ensure(current_queue_family == VK_QUEUE_FAMILY_IGNORED || current_queue_family == cmd.get_queue_family());
@ -407,6 +412,14 @@ namespace vk
// Restore requested mapping
info.components = mapping;
#endif
if (m_resource)
{
if (const auto name = m_resource->debug_name(); !name.empty())
{
set_debug_name(fmt::format("%p (%p) %s", value, m_resource->value, name));
}
}
}
viewable_image* viewable_image::clone()
@ -490,4 +503,18 @@ namespace vk
views.clear();
}
}
void image_view::set_debug_name(std::string_view name)
{
if (g_render_device->get_debug_utils_support())
{
VkDebugUtilsObjectNameInfoEXT name_info{};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_IMAGE_VIEW;
name_info.objectHandle = reinterpret_cast<u64>(value);
name_info.pObjectName = name.data();
_vkSetDebugUtilsObjectNameEXT(m_device, &name_info);
}
}
}

View File

@ -84,6 +84,7 @@ namespace vk
VkSharingMode sharing_mode() const;
VkImageAspectFlags aspect() const;
rsx::format_class format_class() const;
std::string debug_name() const;
// Pipeline management
void push_layout(const command_buffer& cmd, VkImageLayout layout);
@ -128,6 +129,7 @@ namespace vk
vk::image* m_resource = nullptr;
void create_impl();
void set_debug_name(std::string_view name);
};
class viewable_image : public image