From 05a5bd620d5a451a8208dcfb703db07d4a2bfcd8 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 26 Jul 2024 15:37:51 +0200 Subject: [PATCH] vkd3d: Directly call the function to update descriptors. For better code clarity. --- libs/vkd3d/command.c | 17 ++++++++++++----- libs/vkd3d/vkd3d_private.h | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index dcc76908..86a10887 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -3078,7 +3078,7 @@ done: vkd3d_free(vk_descriptor_writes); } -static void d3d12_command_list_update_descriptors(struct d3d12_command_list *list, +static void d3d12_command_list_update_virtual_descriptors(struct d3d12_command_list *list, enum vkd3d_pipeline_bind_point bind_point) { struct vkd3d_pipeline_bindings *bindings = &list->pipeline_bindings[bind_point]; @@ -3296,6 +3296,15 @@ static void d3d12_command_list_update_heap_descriptors(struct d3d12_command_list d3d12_command_list_bind_descriptor_heap(list, bind_point, sampler_heap); } +static void d3d12_command_list_update_descriptors(struct d3d12_command_list *list, + enum vkd3d_pipeline_bind_point bind_point) +{ + if (list->device->use_vk_heaps) + d3d12_command_list_update_heap_descriptors(list, bind_point); + else + d3d12_command_list_update_virtual_descriptors(list, bind_point); +} + static bool d3d12_command_list_update_compute_state(struct d3d12_command_list *list) { d3d12_command_list_end_current_render_pass(list); @@ -3303,7 +3312,7 @@ static bool d3d12_command_list_update_compute_state(struct d3d12_command_list *l if (!d3d12_command_list_update_compute_pipeline(list)) return false; - list->update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_COMPUTE); + d3d12_command_list_update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_COMPUTE); return true; } @@ -3320,7 +3329,7 @@ static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list if (!d3d12_command_list_update_current_framebuffer(list)) return false; - list->update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_GRAPHICS); + d3d12_command_list_update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_GRAPHICS); if (list->current_render_pass != VK_NULL_HANDLE) return true; @@ -6189,8 +6198,6 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d list->allocator = allocator; - list->update_descriptors = device->use_vk_heaps ? d3d12_command_list_update_heap_descriptors - : d3d12_command_list_update_descriptors; list->descriptor_heap_count = 0; if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list))) diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index f5e68d0b..3ba9a30a 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -1271,7 +1271,6 @@ struct d3d12_command_list VkBuffer so_counter_buffers[D3D12_SO_BUFFER_SLOT_COUNT]; VkDeviceSize so_counter_buffer_offsets[D3D12_SO_BUFFER_SLOT_COUNT]; - void (*update_descriptors)(struct d3d12_command_list *list, enum vkd3d_pipeline_bind_point bind_point); struct d3d12_descriptor_heap *descriptor_heaps[64]; unsigned int descriptor_heap_count;