Roderick Colenbrander : winevulkan: Implement vkGetDeviceQueue2.

Alexandre Julliard julliard at winehq.org
Mon Jul 16 14:40:01 CDT 2018


Module: wine
Branch: master
Commit: d1d9d5495d2b25f23e03e1ea56e113039b9a5fe7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d1d9d5495d2b25f23e03e1ea56e113039b9a5fe7

Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date:   Mon Jul 16 15:18:19 2018 +0200

winevulkan: Implement vkGetDeviceQueue2.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vulkan-1/vulkan-1.spec      |  2 +-
 dlls/winevulkan/make_vulkan      |  3 ++-
 dlls/winevulkan/vulkan.c         | 35 ++++++++++++++++++++++++++++-------
 dlls/winevulkan/vulkan_private.h |  2 ++
 dlls/winevulkan/vulkan_thunks.c  |  1 +
 dlls/winevulkan/vulkan_thunks.h  |  1 +
 dlls/winevulkan/winevulkan.spec  |  2 +-
 include/wine/vulkan.h            |  2 ++
 8 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec
index 2e05979..52ee47a 100644
--- a/dlls/vulkan-1/vulkan-1.spec
+++ b/dlls/vulkan-1/vulkan-1.spec
@@ -164,7 +164,7 @@
 @ stdcall vkGetDeviceMemoryCommitment(ptr int64 ptr) winevulkan.wine_vkGetDeviceMemoryCommitment
 @ stdcall vkGetDeviceProcAddr(ptr str) winevulkan.wine_vkGetDeviceProcAddr
 @ stdcall vkGetDeviceQueue(ptr long long ptr) winevulkan.wine_vkGetDeviceQueue
-@ stub vkGetDeviceQueue2
+@ stdcall vkGetDeviceQueue2(ptr ptr ptr) winevulkan.wine_vkGetDeviceQueue2
 @ stub vkGetDisplayModePropertiesKHR
 @ stub vkGetDisplayPlaneCapabilitiesKHR
 @ stub vkGetDisplayPlaneSupportedDisplaysKHR
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 7773f34..e922203 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -161,6 +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},
     "vkQueueSubmit" : {"dispatch": True, "driver" : False, "thunk" : False},
 
     # VK_KHR_surface
@@ -402,7 +403,7 @@ class VkFunction(object):
 
         # Required is set while parsing which APIs and types are required
         # and is used by the code generation.
-        self.required = True if self.driver else False
+        self.required = True if func_info else False
 
     @staticmethod
     def from_alias(command, alias):
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 34ef457..b07025a 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -168,7 +168,7 @@ static void wine_vk_command_buffers_free(struct VkDevice_T *device, VkCommandPoo
 
 /* Helper function to create queues for a given family index. */
 static struct VkQueue_T *wine_vk_device_alloc_queues(struct VkDevice_T *device,
-        uint32_t family_index, uint32_t queue_count)
+        uint32_t family_index, uint32_t queue_count, VkDeviceQueueCreateFlags flags)
 {
     struct VkQueue_T *queues;
     unsigned int i;
@@ -182,15 +182,15 @@ static struct VkQueue_T *wine_vk_device_alloc_queues(struct VkDevice_T *device,
     for (i = 0; i < queue_count; i++)
     {
         struct VkQueue_T *queue = &queues[i];
+
+        queue->base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
         queue->device = device;
+        queue->flags = flags;
 
         /* The native device was already allocated with the required number of queues,
          * so just fetch them from there.
          */
         device->funcs.p_vkGetDeviceQueue(device->device, family_index, i, &queue->queue);
-
-        /* Set special header for ICD loader. */
-        queue->base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
     }
 
     return queues;
@@ -342,7 +342,7 @@ static void wine_vk_instance_convert_create_info(const VkInstanceCreateInfo *src
         TRACE("Application name %s, application version %#x\n",
                 debugstr_a(app_info->pApplicationName), app_info->applicationVersion);
         TRACE("Engine name %s, engine version %#x\n", debugstr_a(app_info->pEngineName),
-                 app_info->engineVersion);
+                app_info->engineVersion);
         TRACE("API version %#x\n", app_info->apiVersion);
     }
 
@@ -633,12 +633,14 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev,
 
     for (i = 0; i < create_info_host.queueCreateInfoCount; i++)
     {
+        uint32_t flags = create_info_host.pQueueCreateInfos[i].flags;
         uint32_t family_index = create_info_host.pQueueCreateInfos[i].queueFamilyIndex;
         uint32_t queue_count = create_info_host.pQueueCreateInfos[i].queueCount;
 
         TRACE("queueFamilyIndex %u, queueCount %u\n", family_index, queue_count);
 
-        object->queues[family_index] = wine_vk_device_alloc_queues(object, family_index, queue_count);
+        object->queues[family_index] = wine_vk_device_alloc_queues(object, family_index,
+                queue_count, flags);
         if (!object->queues[family_index])
         {
             ERR("Failed to allocate memory for queues\n");
@@ -928,11 +930,30 @@ PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *
 void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t family_index,
         uint32_t queue_index, VkQueue *queue)
 {
-    TRACE("%p %u %u %p\n", device, family_index, queue_index, queue);
+    TRACE("%p, %u, %u, %p\n", device, family_index, queue_index, queue);
 
     *queue = &device->queues[family_index][queue_index];
 }
 
+void WINAPI wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *info, VkQueue *queue)
+{
+    const struct wine_vk_structure_header *chain;
+    struct VkQueue_T *matching_queue;
+
+    TRACE("%p, %p, %p\n", device, info, queue);
+
+    if ((chain = info->pNext))
+        FIXME("Ignoring a linked structure of type %#x.\n", chain->sType);
+
+    matching_queue = &device->queues[info->queueFamilyIndex][info->queueIndex];
+    if (matching_queue->flags != info->flags)
+    {
+        WARN("No matching flags were specified %#x, %#x.\n", matching_queue->flags, info->flags);
+        matching_queue = VK_NULL_HANDLE;
+    }
+    *queue = matching_queue;
+}
+
 PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char *name)
 {
     void *func;
diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h
index 37af920..2e071a5 100644
--- a/dlls/winevulkan/vulkan_private.h
+++ b/dlls/winevulkan/vulkan_private.h
@@ -106,6 +106,8 @@ struct VkQueue_T
     struct wine_vk_base base;
     struct VkDevice_T *device; /* parent */
     VkQueue queue; /* native queue */
+
+    VkDeviceQueueCreateFlags flags;
 };
 
 void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN;
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c
index b88158c..9d637bf 100644
--- a/dlls/winevulkan/vulkan_thunks.c
+++ b/dlls/winevulkan/vulkan_thunks.c
@@ -2966,6 +2966,7 @@ static const struct vulkan_func vk_device_dispatch_table[] =
     {"vkGetDeviceMemoryCommitment", &wine_vkGetDeviceMemoryCommitment},
     {"vkGetDeviceProcAddr", &wine_vkGetDeviceProcAddr},
     {"vkGetDeviceQueue", &wine_vkGetDeviceQueue},
+    {"vkGetDeviceQueue2", &wine_vkGetDeviceQueue2},
     {"vkGetEventStatus", &wine_vkGetEventStatus},
     {"vkGetFenceStatus", &wine_vkGetFenceStatus},
     {"vkGetImageMemoryRequirements", &wine_vkGetImageMemoryRequirements},
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h
index 86b81ab..a03d115 100644
--- a/dlls/winevulkan/vulkan_thunks.h
+++ b/dlls/winevulkan/vulkan_thunks.h
@@ -53,6 +53,7 @@ VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *p
 void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers);
 PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName);
 void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue);
+void WINAPI wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue);
 VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
 
 typedef struct VkAcquireNextImageInfoKHR_host
diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec
index 91f7333..8aab0fe 100644
--- a/dlls/winevulkan/winevulkan.spec
+++ b/dlls/winevulkan/winevulkan.spec
@@ -166,7 +166,7 @@
 @ stdcall wine_vkGetDeviceMemoryCommitment(ptr int64 ptr)
 @ stdcall wine_vkGetDeviceProcAddr(ptr str)
 @ stdcall wine_vkGetDeviceQueue(ptr long long ptr)
-@ stub vkGetDeviceQueue2
+@ stdcall wine_vkGetDeviceQueue2(ptr ptr ptr)
 @ stub vkGetDisplayModePropertiesKHR
 @ stub vkGetDisplayPlaneCapabilitiesKHR
 @ stub vkGetDisplayPlaneSupportedDisplaysKHR
diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h
index 10c1243..965e26f 100644
--- a/include/wine/vulkan.h
+++ b/include/wine/vulkan.h
@@ -4319,6 +4319,7 @@ typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevic
 typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice, VkDeviceMemory, VkDeviceSize *);
 typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice, const char *);
 typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice, uint32_t, uint32_t, VkQueue *);
+typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue2)(VkDevice, const VkDeviceQueueInfo2 *, VkQueue *);
 typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice, VkEvent);
 typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice, VkFence);
 typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice, VkImage, VkMemoryRequirements *);
@@ -4537,6 +4538,7 @@ VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSu
 void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize *pCommittedMemoryInBytes);
 PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName);
 void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue);
+void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue);
 VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event);
 VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence);
 void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements);




More information about the wine-cvs mailing list