mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Allow simultaneous buffer access from multiple queues.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9e2ecaf7f4
commit
2126614a03
@ -1449,22 +1449,31 @@ static HRESULT d3d12_device_create_vkd3d_queues(struct d3d12_device *device,
|
||||
device->compute_queue = NULL;
|
||||
device->copy_queue = NULL;
|
||||
|
||||
if (FAILED((hr = vkd3d_queue_create(device, direct_family_index,
|
||||
device->queue_family_count = 0;
|
||||
memset(device->queue_family_indices, 0, sizeof(device->queue_family_indices));
|
||||
|
||||
if (SUCCEEDED((hr = vkd3d_queue_create(device, direct_family_index,
|
||||
&queue_info->vk_properties[VKD3D_QUEUE_FAMILY_DIRECT], &device->direct_queue))))
|
||||
device->queue_family_indices[device->queue_family_count++] = direct_family_index;
|
||||
else
|
||||
goto out_destroy_queues;
|
||||
|
||||
if (compute_family_index == direct_family_index)
|
||||
device->compute_queue = device->direct_queue;
|
||||
else if (FAILED(hr = vkd3d_queue_create(device, compute_family_index,
|
||||
else if (SUCCEEDED(hr = vkd3d_queue_create(device, compute_family_index,
|
||||
&queue_info->vk_properties[VKD3D_QUEUE_FAMILY_COMPUTE], &device->compute_queue)))
|
||||
device->queue_family_indices[device->queue_family_count++] = compute_family_index;
|
||||
else
|
||||
goto out_destroy_queues;
|
||||
|
||||
if (transfer_family_index == direct_family_index)
|
||||
device->copy_queue = device->direct_queue;
|
||||
else if (transfer_family_index == compute_family_index)
|
||||
device->copy_queue = device->compute_queue;
|
||||
else if (FAILED(hr = vkd3d_queue_create(device, transfer_family_index,
|
||||
else if (SUCCEEDED(hr = vkd3d_queue_create(device, transfer_family_index,
|
||||
&queue_info->vk_properties[VKD3D_QUEUE_FAMILY_TRANSFER], &device->copy_queue)))
|
||||
device->queue_family_indices[device->queue_family_count++] = transfer_family_index;
|
||||
else
|
||||
goto out_destroy_queues;
|
||||
|
||||
return S_OK;
|
||||
|
@ -529,10 +529,10 @@ HRESULT vkd3d_create_buffer(struct d3d12_device *device,
|
||||
if (!(desc->Flags & D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE))
|
||||
buffer_info.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
|
||||
|
||||
/* FIXME: Buffers always can be accessed from multiple queues. */
|
||||
buffer_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
buffer_info.queueFamilyIndexCount = 0;
|
||||
buffer_info.pQueueFamilyIndices = 0;
|
||||
/* Buffers always have properties of D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS. */
|
||||
buffer_info.sharingMode = VK_SHARING_MODE_CONCURRENT;
|
||||
buffer_info.queueFamilyIndexCount = device->queue_family_count;
|
||||
buffer_info.pQueueFamilyIndices = device->queue_family_indices;
|
||||
|
||||
if ((vr = VK_CALL(vkCreateBuffer(device->vk_device, &buffer_info, NULL, vk_buffer))) < 0)
|
||||
{
|
||||
|
@ -48,8 +48,9 @@
|
||||
#define VKD3D_DESCRIPTOR_MAGIC_DSV 0x00565344u
|
||||
#define VKD3D_DESCRIPTOR_MAGIC_RTV 0x00565452u
|
||||
|
||||
#define VKD3D_MAX_SHADER_STAGES 5u
|
||||
#define VKD3D_MAX_VK_SYNC_OBJECTS_PER_D3D12_FENCE 4
|
||||
#define VKD3D_MAX_QUEUE_FAMILY_COUNT 3u
|
||||
#define VKD3D_MAX_SHADER_STAGES 5u
|
||||
#define VKD3D_MAX_VK_SYNC_OBJECTS_PER_D3D12_FENCE 4u
|
||||
|
||||
struct d3d12_command_list;
|
||||
struct d3d12_device;
|
||||
@ -970,6 +971,8 @@ struct d3d12_device
|
||||
struct vkd3d_queue *direct_queue;
|
||||
struct vkd3d_queue *compute_queue;
|
||||
struct vkd3d_queue *copy_queue;
|
||||
uint32_t queue_family_indices[VKD3D_MAX_QUEUE_FAMILY_COUNT];
|
||||
unsigned int queue_family_count;
|
||||
|
||||
struct vkd3d_instance *vkd3d_instance;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user