In cases where there is only one or a small number of direct queues, mapping copy to compute may prevent a fence deadlock caused by sending a wait and signal to the same Vk queue.
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/device.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index ce570ffe..6d2f30ea 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1767,8 +1767,18 @@ static HRESULT vkd3d_select_queues(const struct vkd3d_instance *vkd3d_instance, } if (info->family_index[VKD3D_QUEUE_FAMILY_TRANSFER] == ~0u) { - info->family_index[VKD3D_QUEUE_FAMILY_TRANSFER] = info->family_index[VKD3D_QUEUE_FAMILY_DIRECT]; - info->vk_properties[VKD3D_QUEUE_FAMILY_TRANSFER] = info->vk_properties[VKD3D_QUEUE_FAMILY_DIRECT]; + if ((info->vk_properties[VKD3D_QUEUE_FAMILY_COMPUTE].queueFlags & VK_QUEUE_TRANSFER_BIT) + && info->vk_properties[VKD3D_QUEUE_FAMILY_COMPUTE].queueCount + >= info->vk_properties[VKD3D_QUEUE_FAMILY_DIRECT].queueCount) + { + info->family_index[VKD3D_QUEUE_FAMILY_TRANSFER] = info->family_index[VKD3D_QUEUE_FAMILY_COMPUTE]; + info->vk_properties[VKD3D_QUEUE_FAMILY_TRANSFER] = info->vk_properties[VKD3D_QUEUE_FAMILY_COMPUTE]; + } + else + { + info->family_index[VKD3D_QUEUE_FAMILY_TRANSFER] = info->family_index[VKD3D_QUEUE_FAMILY_DIRECT]; + info->vk_properties[VKD3D_QUEUE_FAMILY_TRANSFER] = info->vk_properties[VKD3D_QUEUE_FAMILY_DIRECT]; + } }
/* Compact the array. */