vkd3d: Write Vulkan descriptors in a worker thread.

Raises framerate by 5-10% in games which write thousands of descriptors
per frame, e.g. Horizon Zero Dawn.

The worker thread is a generic device worker which can also be used for
other purposes if the need arises.
This commit is contained in:
Conor McCarthy
2023-07-30 13:34:09 +10:00
committed by Alexandre Julliard
parent 70962ae7d8
commit 37e76618ca
Notes: Alexandre Julliard 2023-12-14 23:31:17 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/292
4 changed files with 133 additions and 0 deletions

View File

@@ -3995,6 +3995,9 @@ static ULONG STDMETHODCALLTYPE d3d12_descriptor_heap_Release(ID3D12DescriptorHea
{
struct d3d12_desc *descriptors = (struct d3d12_desc *)heap->descriptors;
if (heap->use_vk_heaps)
d3d12_device_remove_descriptor_heap(device, heap);
for (i = 0; i < heap->desc.NumDescriptors; ++i)
{
d3d12_desc_destroy(&descriptors[i], device);
@@ -4318,6 +4321,12 @@ HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device,
dst[i].next = 0;
}
object->dirty_list_head = UINT_MAX;
if (object->use_vk_heaps && FAILED(hr = d3d12_device_add_descriptor_heap(device, object)))
{
vkd3d_free(object);
return hr;
}
}
else
{