[dxvk] Add debug name support to DxvkImage

This commit is contained in:
Philip Rebohle 2024-11-06 12:30:26 +01:00
parent 8192f3092a
commit 2ef44e6d74
3 changed files with 23 additions and 0 deletions

View file

@ -14,6 +14,13 @@ namespace dxvk {
m_properties (memFlags),
m_shaderStages (util::shaderStages(createInfo.stages)),
m_info (createInfo) {
if (device->isDebugEnabled()) {
m_debugName = str::format(createInfo.debugName ? createInfo.debugName : "Image", " (", cookie(), ")");
m_info.debugName = m_debugName.data();
} else {
m_info.debugName = nullptr;
}
m_allocator->registerResource(this);
copyFormatList(createInfo.viewFormatCount, createInfo.viewFormats);
@ -184,6 +191,7 @@ namespace dxvk {
allocationInfo.resourceCookie = cookie();
allocationInfo.properties = m_properties;
allocationInfo.mode = mode;
allocationInfo.debugName = m_info.debugName;
return m_allocator->createImageResource(imageInfo,
allocationInfo, sharedMemoryInfo);

View file

@ -66,6 +66,9 @@ namespace dxvk {
// Shared handle info
DxvkSharedHandleInfo sharing = { };
/// Debug name
const char* debugName = nullptr;
};
@ -626,6 +629,8 @@ namespace dxvk {
std::unordered_map<DxvkImageViewKey,
DxvkImageView, DxvkHash, DxvkEq> m_views;
std::string m_debugName;
VkImageCreateInfo getImageCreateInfo(
const DxvkImageUsageInfo& usageInfo) const;

View file

@ -1038,6 +1038,16 @@ namespace dxvk {
}
}
// Assign debug name to the image
if (allocationInfo.debugName && m_device->isDebugEnabled()) {
VkDebugUtilsObjectNameInfoEXT name = { VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT };
name.objectType = VK_OBJECT_TYPE_IMAGE;
name.objectHandle = reinterpret_cast<uint64_t>(image);
name.pObjectName = allocationInfo.debugName;
vk->vkSetDebugUtilsObjectNameEXT(vk->device(), &name);
}
return allocation;
}