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

Józef Kucia jkucia at codeweavers.com
Mon Aug 20 03:05:12 CDT 2018


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/winevulkan/make_vulkan     |  2 +-
 dlls/winevulkan/vulkan.c        | 21 ++++++++++++++++++---
 dlls/winevulkan/vulkan_thunks.h |  2 ++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 73bba7894f79..3be6a8de3bf1 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -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
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index e588d53f3cab..a1e970daff85 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -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,10 +189,24 @@ 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."
          */
-        device->funcs.p_vkGetDeviceQueue(device->device, family_index, i, &queue->queue);
+        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;
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h
index a03d1150c969..94e56bb97300 100644
--- a/dlls/winevulkan/vulkan_thunks.h
+++ b/dlls/winevulkan/vulkan_thunks.h
@@ -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) \
-- 
2.16.4




More information about the wine-devel mailing list