vkd3d: Directly call the function to update descriptors.

For better code clarity.
This commit is contained in:
Giovanni Mascellani 2024-07-26 15:37:51 +02:00 committed by Henri Verbeet
parent e550901efa
commit 05a5bd620d
Notes: Henri Verbeet 2024-09-10 21:58:12 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1051
2 changed files with 12 additions and 6 deletions

View File

@ -3078,7 +3078,7 @@ done:
vkd3d_free(vk_descriptor_writes); 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) enum vkd3d_pipeline_bind_point bind_point)
{ {
struct vkd3d_pipeline_bindings *bindings = &list->pipeline_bindings[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); 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) static bool d3d12_command_list_update_compute_state(struct d3d12_command_list *list)
{ {
d3d12_command_list_end_current_render_pass(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)) if (!d3d12_command_list_update_compute_pipeline(list))
return false; return false;
list->update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_COMPUTE); d3d12_command_list_update_descriptors(list, VKD3D_PIPELINE_BIND_POINT_COMPUTE);
return true; 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)) if (!d3d12_command_list_update_current_framebuffer(list))
return false; 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) if (list->current_render_pass != VK_NULL_HANDLE)
return true; return true;
@ -6189,8 +6198,6 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d
list->allocator = allocator; 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; list->descriptor_heap_count = 0;
if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list))) if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list)))

View File

@ -1271,7 +1271,6 @@ struct d3d12_command_list
VkBuffer so_counter_buffers[D3D12_SO_BUFFER_SLOT_COUNT]; VkBuffer so_counter_buffers[D3D12_SO_BUFFER_SLOT_COUNT];
VkDeviceSize so_counter_buffer_offsets[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]; struct d3d12_descriptor_heap *descriptor_heaps[64];
unsigned int descriptor_heap_count; unsigned int descriptor_heap_count;