1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

vk: Add support for tagging objects to ease debugging

- Makes use of VK_EXT_debug_utils
This commit is contained in:
kd-11 2021-04-28 00:11:36 +03:00 committed by kd-11
parent 8b0e1d6c03
commit 1d9dd8d29d
7 changed files with 41 additions and 0 deletions

View File

@ -120,6 +120,7 @@ namespace rsx
usage_flags,
0, RSX_FORMAT_CLASS_COLOR);
rtt->set_debug_name(fmt::format("RTV @0x%x", address));
rtt->change_layout(cmd, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
rtt->set_format(format);
@ -180,6 +181,7 @@ namespace rsx
usage_flags,
0, rsx::classify_format(format));
ds->set_debug_name(fmt::format("DSV @0x%x", address));
ds->change_layout(cmd, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
ds->set_format(format);

View File

@ -927,6 +927,8 @@ namespace vk
rsx::texture_create_flags::default_component_order);
auto image = section->get_raw_texture();
image->set_debug_name(fmt::format("Raw Texture @0x%x", rsx_range.start));
vk::enter_uninterruptible();
bool input_swizzled = swizzled;

View File

@ -58,6 +58,7 @@ namespace vk
conditional_render_support = device_extensions.is_supported(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME);
external_memory_host_support = device_extensions.is_supported(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME);
unrestricted_depth_range_support = device_extensions.is_supported(VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME);
debug_utils_support = instance_extensions.is_supported(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
surface_capabilities_2_support = instance_extensions.is_supported(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
}
@ -437,6 +438,11 @@ namespace vk
_vkCmdEndConditionalRenderingEXT = reinterpret_cast<PFN_vkCmdEndConditionalRenderingEXT>(vkGetDeviceProcAddr(dev, "vkCmdEndConditionalRenderingEXT"));
}
if (pgpu->debug_utils_support)
{
_vkSetDebugUtilsObjectNameEXT = reinterpret_cast<PFN_vkSetDebugUtilsObjectNameEXT>(vkGetDeviceProcAddr(dev, "vkSetDebugUtilsObjectNameEXT"));
}
memory_map = vk::get_memory_mapping(pdev);
m_formats_support = vk::get_optimal_tiling_supported_formats(pdev);
m_pipeline_binding_table = vk::get_pipeline_binding_table(pdev);
@ -597,6 +603,11 @@ namespace vk
return pgpu->surface_capabilities_2_support;
}
bool render_device::get_debug_utils_support() const
{
return g_cfg.video.renderdoc_compatiblity && pgpu->debug_utils_support;
}
mem_allocator_base* render_device::get_allocator() const
{
return m_allocator.get();

View File

@ -52,6 +52,7 @@ namespace vk
bool external_memory_host_support = false;
bool unrestricted_depth_range_support = false;
bool surface_capabilities_2_support = false;
bool debug_utils_support = false;
friend class render_device;
private:
@ -101,6 +102,7 @@ namespace vk
// Exported device endpoints
PFN_vkCmdBeginConditionalRenderingEXT _vkCmdBeginConditionalRenderingEXT = nullptr;
PFN_vkCmdEndConditionalRenderingEXT _vkCmdEndConditionalRenderingEXT = nullptr;
PFN_vkSetDebugUtilsObjectNameEXT _vkSetDebugUtilsObjectNameEXT = nullptr;
public:
render_device() = default;
@ -126,6 +128,7 @@ namespace vk
bool get_unrestricted_depth_range_support() const;
bool get_external_memory_host_support() const;
bool get_surface_capabilities_2_support() const;
bool get_debug_utils_support() const;
VkQueue get_present_queue() const;
VkQueue get_graphics_queue() const;

View File

@ -215,6 +215,20 @@ namespace vk
current_queue_family = new_queue_family;
}
void image::set_debug_name(const std::string& 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;
name_info.objectHandle = reinterpret_cast<u64>(value);
name_info.pObjectName = name.c_str();
g_render_device->_vkSetDebugUtilsObjectNameEXT(m_device, &name_info);
}
}
image_view::image_view(VkDevice dev, VkImage image, VkImageViewType view_type, VkFormat format, VkComponentMapping mapping, VkImageSubresourceRange range)
: m_device(dev)
{

View File

@ -81,6 +81,9 @@ namespace vk
void change_layout(const command_buffer& cmd, VkImageLayout new_layout);
void change_layout(const command_buffer& cmd, VkImageLayout new_layout, u32 new_queue_family);
// Debug utils
void set_debug_name(const std::string& name);
private:
VkDevice m_device;
};

View File

@ -159,6 +159,12 @@ namespace vk
{
extensions.push_back(VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME);
}
if (g_cfg.video.renderdoc_compatiblity && support.is_supported(VK_EXT_DEBUG_UTILS_EXTENSION_NAME))
{
extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
}
#ifdef _WIN32
extensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
#elif defined(__APPLE__)