From 51cdddb96141587a99e17237370194adc14290fe Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 30 Jan 2024 15:12:56 +0100 Subject: [PATCH] vkd3d: Introduce a debug helper for GPU descriptor handles. --- libs/vkd3d/command.c | 16 ++++++++-------- libs/vkd3d/utils.c | 5 +++++ libs/vkd3d/vkd3d_private.h | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index f9940b3d..609300d3 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -4499,8 +4499,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetComputeRootDescriptorTable(I { struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList5(iface); - TRACE("iface %p, root_parameter_index %u, base_descriptor %#"PRIx64".\n", - iface, root_parameter_index, base_descriptor.ptr); + TRACE("iface %p, root_parameter_index %u, base_descriptor %s.\n", + iface, root_parameter_index, debug_gpu_handle(base_descriptor)); d3d12_command_list_set_descriptor_table(list, VKD3D_PIPELINE_BIND_POINT_COMPUTE, root_parameter_index, base_descriptor); @@ -4511,8 +4511,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetGraphicsRootDescriptorTable( { struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList5(iface); - TRACE("iface %p, root_parameter_index %u, base_descriptor %#"PRIx64".\n", - iface, root_parameter_index, base_descriptor.ptr); + TRACE("iface %p, root_parameter_index %u, base_descriptor %s.\n", + iface, root_parameter_index, debug_gpu_handle(base_descriptor)); d3d12_command_list_set_descriptor_table(list, VKD3D_PIPELINE_BIND_POINT_GRAPHICS, root_parameter_index, base_descriptor); @@ -5432,8 +5432,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID struct d3d12_resource *resource_impl; VkClearColorValue colour; - TRACE("iface %p, gpu_handle %#"PRIx64", cpu_handle %s, resource %p, values %p, rect_count %u, rects %p.\n", - iface, gpu_handle.ptr, debug_cpu_handle(cpu_handle), resource, values, rect_count, rects); + TRACE("iface %p, gpu_handle %s, cpu_handle %s, resource %p, values %p, rect_count %u, rects %p.\n", + iface, debug_gpu_handle(gpu_handle), debug_cpu_handle(cpu_handle), resource, values, rect_count, rects); resource_impl = unsafe_impl_from_ID3D12Resource(resource); if (!(descriptor = d3d12_desc_from_cpu_handle(cpu_handle)->s.u.view)) @@ -5496,8 +5496,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewFloat(I VkClearColorValue colour; struct vkd3d_view *view; - TRACE("iface %p, gpu_handle %#"PRIx64", cpu_handle %s, resource %p, values %p, rect_count %u, rects %p.\n", - iface, gpu_handle.ptr, debug_cpu_handle(cpu_handle), resource, values, rect_count, rects); + TRACE("iface %p, gpu_handle %s, cpu_handle %s, resource %p, values %p, rect_count %u, rects %p.\n", + iface, debug_gpu_handle(gpu_handle), debug_cpu_handle(cpu_handle), resource, values, rect_count, rects); resource_impl = unsafe_impl_from_ID3D12Resource(resource); if (!(view = d3d12_desc_from_cpu_handle(cpu_handle)->s.u.view)) diff --git a/libs/vkd3d/utils.c b/libs/vkd3d/utils.c index 28913a83..ac79ae5d 100644 --- a/libs/vkd3d/utils.c +++ b/libs/vkd3d/utils.c @@ -678,6 +678,11 @@ const char *debug_d3d12_shader_component_mapping(unsigned int mapping) debug_d3d12_shader_component(D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(3, mapping))); } +const char *debug_gpu_handle(D3D12_GPU_DESCRIPTOR_HANDLE handle) +{ + return vkd3d_dbg_sprintf("{%#"PRIx64"}", handle.ptr); +} + const char *debug_vk_extent_3d(VkExtent3D extent) { return vkd3d_dbg_sprintf("(%u, %u, %u)", diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index bb78ba77..5955e616 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -1963,6 +1963,7 @@ HRESULT return_interface(void *iface, REFIID iface_iid, REFIID requested_iid, vo const char *debug_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE handle); const char *debug_d3d12_box(const D3D12_BOX *box); const char *debug_d3d12_shader_component_mapping(unsigned int mapping); +const char *debug_gpu_handle(D3D12_GPU_DESCRIPTOR_HANDLE handle); const char *debug_vk_extent_3d(VkExtent3D extent); const char *debug_vk_memory_heap_flags(VkMemoryHeapFlags flags); const char *debug_vk_memory_property_flags(VkMemoryPropertyFlags flags);