Skip to content

Commit 0854560

Browse files
jozefkuciajulliard
authored andcommitted
vkd3d: Set Vulkan object names for NULL CBV resources.
Signed-off-by: Józef Kucia <[email protected]> Signed-off-by: Henri Verbeet <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]>
1 parent f91422e commit 0854560

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

libs/vkd3d/resource.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2895,6 +2895,7 @@ HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources,
28952895
{
28962896
D3D12_HEAP_PROPERTIES heap_properties;
28972897
D3D12_RESOURCE_DESC buffer_desc;
2898+
VkResult vr;
28982899
HRESULT hr;
28992900

29002901
memset(null_resources, 0, sizeof(*null_resources));
@@ -2918,10 +2919,18 @@ HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources,
29182919
&buffer_desc, &null_resources->vk_uniform_buffer)))
29192920
goto fail;
29202921

2922+
if ((vr = vkd3d_set_vk_object_name_utf8(device, (uint64_t)null_resources->vk_uniform_buffer,
2923+
VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, "NULL CBV buffer")) < 0)
2924+
WARN("Failed to set object name, vr %d.\n", vr);
2925+
29212926
if (FAILED(hr = vkd3d_allocate_buffer_memory(device, null_resources->vk_uniform_buffer,
29222927
&heap_properties, D3D12_HEAP_FLAG_NONE, &null_resources->vk_uniform_buffer_memory)))
29232928
goto fail;
29242929

2930+
if ((vr = vkd3d_set_vk_object_name_utf8(device, (uint64_t)null_resources->vk_uniform_buffer_memory,
2931+
VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, "NULL CBV memory")) < 0)
2932+
WARN("Failed to set object name, vr %d.\n", vr);
2933+
29252934
return S_OK;
29262935

29272936
fail:

libs/vkd3d/utils.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,26 @@ HRESULT vkd3d_set_private_data_interface(struct vkd3d_private_store *store,
643643
return hr;
644644
}
645645

646-
HRESULT vkd3d_set_vk_object_name(struct d3d12_device *device, uint64_t vk_object,
647-
VkDebugReportObjectTypeEXT vk_object_type, const WCHAR *name)
646+
VkResult vkd3d_set_vk_object_name_utf8(struct d3d12_device *device, uint64_t vk_object,
647+
VkDebugReportObjectTypeEXT vk_object_type, const char *name)
648648
{
649649
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
650650
VkDebugMarkerObjectNameInfoEXT info;
651+
652+
if (!device->vk_info.EXT_debug_marker)
653+
return VK_SUCCESS;
654+
655+
info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
656+
info.pNext = NULL;
657+
info.objectType = vk_object_type;
658+
info.object = vk_object;
659+
info.pObjectName = name;
660+
return VK_CALL(vkDebugMarkerSetObjectNameEXT(device->vk_device, &info));
661+
}
662+
663+
HRESULT vkd3d_set_vk_object_name(struct d3d12_device *device, uint64_t vk_object,
664+
VkDebugReportObjectTypeEXT vk_object_type, const WCHAR *name)
665+
{
651666
char *name_utf8;
652667
VkResult vr;
653668

@@ -660,12 +675,7 @@ HRESULT vkd3d_set_vk_object_name(struct d3d12_device *device, uint64_t vk_object
660675
if (!(name_utf8 = vkd3d_strdup_w_utf8(name, device->wchar_size)))
661676
return E_OUTOFMEMORY;
662677

663-
info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
664-
info.pNext = NULL;
665-
info.objectType = vk_object_type;
666-
info.object = vk_object;
667-
info.pObjectName = name_utf8;
668-
vr = VK_CALL(vkDebugMarkerSetObjectNameEXT(device->vk_device, &info));
678+
vr = vkd3d_set_vk_object_name_utf8(device, vk_object, vk_object_type, name_utf8);
669679

670680
vkd3d_free(name_utf8);
671681

libs/vkd3d/vkd3d_private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,8 @@ static inline void vkd3d_set_thread_name(const char *name)
10431043
#endif
10441044
}
10451045

1046+
VkResult vkd3d_set_vk_object_name_utf8(struct d3d12_device *device, uint64_t vk_object,
1047+
VkDebugReportObjectTypeEXT vk_object_type, const char *name) DECLSPEC_HIDDEN;
10461048
HRESULT vkd3d_set_vk_object_name(struct d3d12_device *device, uint64_t vk_object,
10471049
VkDebugReportObjectTypeEXT vk_object_type, const WCHAR *name) DECLSPEC_HIDDEN;
10481050

0 commit comments

Comments
 (0)