winevulkan: Properly retrieve queues that were created with non-zero flags.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-08-20 10:05:12 +02:00 committed by Alexandre Julliard
parent b9427efe3e
commit 6d80924ae4
3 changed files with 21 additions and 4 deletions

View File

@ -161,7 +161,7 @@ FUNCTION_OVERRIDES = {
"vkFreeCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False},
"vkGetDeviceProcAddr" : {"dispatch" : False, "driver" : True, "thunk" : False},
"vkGetDeviceQueue" : {"dispatch": True, "driver" : False, "thunk" : False},
"vkGetDeviceQueue2" : {"dispatch": False, "driver" : False, "thunk" : False},
"vkGetDeviceQueue2" : {"dispatch": True, "driver" : False, "thunk" : False},
"vkQueueSubmit" : {"dispatch": True, "driver" : False, "thunk" : False},
# VK_KHR_surface

View File

@ -171,6 +171,7 @@ static void wine_vk_command_buffers_free(struct VkDevice_T *device, VkCommandPoo
static struct VkQueue_T *wine_vk_device_alloc_queues(struct VkDevice_T *device,
uint32_t family_index, uint32_t queue_count, VkDeviceQueueCreateFlags flags)
{
VkDeviceQueueInfo2 queue_info;
struct VkQueue_T *queues;
unsigned int i;
@ -188,11 +189,25 @@ static struct VkQueue_T *wine_vk_device_alloc_queues(struct VkDevice_T *device,
queue->device = device;
queue->flags = flags;
/* The native device was already allocated with the required number of queues,
* so just fetch them from there.
/* The Vulkan spec says:
*
* "vkGetDeviceQueue must only be used to get queues that were created
* with the flags parameter of VkDeviceQueueCreateInfo set to zero."
*/
if (flags && device->funcs.p_vkGetDeviceQueue2)
{
queue_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2;
queue_info.pNext = NULL;
queue_info.flags = flags;
queue_info.queueFamilyIndex = family_index;
queue_info.queueIndex = i;
device->funcs.p_vkGetDeviceQueue2(device->device, &queue_info, &queue->queue);
}
else
{
device->funcs.p_vkGetDeviceQueue(device->device, family_index, i, &queue->queue);
}
}
return queues;
}

View File

@ -889,6 +889,7 @@ struct vulkan_device_funcs
VkResult (*p_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKHR, VkDeviceGroupPresentModeFlagsKHR *);
void (*p_vkGetDeviceMemoryCommitment)(VkDevice, VkDeviceMemory, VkDeviceSize *);
void (*p_vkGetDeviceQueue)(VkDevice, uint32_t, uint32_t, VkQueue *);
void (*p_vkGetDeviceQueue2)(VkDevice, const VkDeviceQueueInfo2 *, VkQueue *);
VkResult (*p_vkGetEventStatus)(VkDevice, VkEvent);
VkResult (*p_vkGetFenceStatus)(VkDevice, VkFence);
#if defined(USE_STRUCT_CONVERSION)
@ -1178,6 +1179,7 @@ struct vulkan_instance_funcs
USE_VK_FUNC(vkGetDeviceGroupSurfacePresentModesKHR) \
USE_VK_FUNC(vkGetDeviceMemoryCommitment) \
USE_VK_FUNC(vkGetDeviceQueue) \
USE_VK_FUNC(vkGetDeviceQueue2) \
USE_VK_FUNC(vkGetEventStatus) \
USE_VK_FUNC(vkGetFenceStatus) \
USE_VK_FUNC(vkGetImageMemoryRequirements) \