mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[dxvk] Add debug name support to DxvkBuffer
This commit is contained in:
parent
42e5abcf20
commit
8192f3092a
4 changed files with 27 additions and 1 deletions
|
@ -17,6 +17,13 @@ namespace dxvk {
|
|||
m_shaderStages (util::shaderStages(createInfo.stages)),
|
||||
m_sharingMode (device->getSharingMode()),
|
||||
m_info (createInfo) {
|
||||
if (device->isDebugEnabled()) {
|
||||
m_debugName = str::format(createInfo.debugName ? createInfo.debugName : "Buffer", " (", cookie(), ")");
|
||||
m_info.debugName = m_debugName.data();
|
||||
} else {
|
||||
m_info.debugName = nullptr;
|
||||
}
|
||||
|
||||
m_allocator->registerResource(this);
|
||||
|
||||
// Create and assign actual buffer resource
|
||||
|
|
|
@ -35,6 +35,10 @@ namespace dxvk {
|
|||
|
||||
/// Buffer create flags
|
||||
VkBufferCreateFlags flags = 0;
|
||||
|
||||
/// Buffer debug name. Setting this will result
|
||||
/// in dedicated buffers being created.
|
||||
const char* debugName = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -315,6 +319,7 @@ namespace dxvk {
|
|||
DxvkAllocationInfo allocationInfo = { };
|
||||
allocationInfo.resourceCookie = cookie();
|
||||
allocationInfo.properties = m_properties;
|
||||
allocationInfo.debugName = m_info.debugName;
|
||||
|
||||
VkBufferCreateInfo info = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
info.flags = m_info.flags;
|
||||
|
@ -429,6 +434,8 @@ namespace dxvk {
|
|||
std::unordered_map<DxvkBufferViewKey,
|
||||
DxvkBufferView, DxvkHash, DxvkEq> m_views;
|
||||
|
||||
std::string m_debugName;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -742,7 +742,7 @@ namespace dxvk {
|
|||
DxvkLocalAllocationCache* allocationCache) {
|
||||
Rc<DxvkResourceAllocation> allocation;
|
||||
|
||||
if (likely(!createInfo.flags)) {
|
||||
if (likely(!createInfo.flags && !allocationInfo.debugName)) {
|
||||
VkMemoryRequirements memoryRequirements = { };
|
||||
memoryRequirements.size = createInfo.size;
|
||||
memoryRequirements.alignment = GlobalBufferAlignment;
|
||||
|
@ -886,6 +886,16 @@ namespace dxvk {
|
|||
if (createInfo.usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)
|
||||
allocation->m_bufferAddress = getBufferDeviceAddress(buffer);
|
||||
|
||||
// Assign debug name to the buffer
|
||||
if (allocationInfo.debugName && m_device->isDebugEnabled()) {
|
||||
VkDebugUtilsObjectNameInfoEXT name = { VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT };
|
||||
name.objectType = VK_OBJECT_TYPE_BUFFER;
|
||||
name.objectHandle = reinterpret_cast<uint64_t>(buffer);
|
||||
name.pObjectName = allocationInfo.debugName;
|
||||
|
||||
vk->vkSetDebugUtilsObjectNameEXT(vk->device(), &name);
|
||||
}
|
||||
|
||||
return allocation;
|
||||
}
|
||||
|
||||
|
|
|
@ -979,6 +979,8 @@ namespace dxvk {
|
|||
VkMemoryPropertyFlags properties = 0u;
|
||||
/// Allocation mode flags
|
||||
DxvkAllocationModes mode = 0u;
|
||||
/// Resource debug name
|
||||
const char* debugName = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue