Jacek Caban : winevulkan: Don't use vulkan_private.h in loader.c.

Alexandre Julliard julliard at winehq.org
Mon Apr 19 15:38:10 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Apr 19 14:15:10 2021 +0200

winevulkan: Don't use vulkan_private.h in loader.c.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winevulkan/loader.c         |  4 ++--
 dlls/winevulkan/vulkan.c         |  4 ++--
 dlls/winevulkan/vulkan_loader.h  | 26 ++++++++++++++++++++++++++
 dlls/winevulkan/vulkan_private.h | 24 +-----------------------
 4 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c
index 769724fe20d..5f5664db3fa 100644
--- a/dlls/winevulkan/loader.c
+++ b/dlls/winevulkan/loader.c
@@ -28,7 +28,7 @@
 #include "devguid.h"
 #include "setupapi.h"
 
-#include "vulkan_private.h"
+#include "vulkan_loader.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
 
@@ -159,7 +159,7 @@ PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *
      * https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/2323
      * https://github.com/KhronosGroup/Vulkan-Docs/issues/655
      */
-    if (device->quirks & WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR
+    if (((struct wine_vk_device_base *)device)->quirks & WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR
             && ((func = wine_vk_get_instance_proc_addr(name))
              || (func = wine_vk_get_phys_dev_proc_addr(name))))
     {
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 1070ccec115..d6f501b267a 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -768,7 +768,7 @@ VkResult WINAPI unix_vkCreateDevice(VkPhysicalDevice phys_dev,
     if (!(object = calloc(1, sizeof(*object))))
         return VK_ERROR_OUT_OF_HOST_MEMORY;
 
-    object->base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
+    object->base.base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
     object->phys_dev = phys_dev;
 
     res = wine_vk_device_convert_create_info(create_info, &create_info_host);
@@ -823,7 +823,7 @@ VkResult WINAPI unix_vkCreateDevice(VkPhysicalDevice phys_dev,
         next_queue += queue_count;
     }
 
-    object->quirks = phys_dev->instance->quirks;
+    object->base.quirks = phys_dev->instance->quirks;
 
     *device = object;
     TRACE("Created device %p (native device %p).\n", object, object->device);
diff --git a/dlls/winevulkan/vulkan_loader.h b/dlls/winevulkan/vulkan_loader.h
index 61b2d60c272..d248ff6521f 100644
--- a/dlls/winevulkan/vulkan_loader.h
+++ b/dlls/winevulkan/vulkan_loader.h
@@ -28,6 +28,32 @@
 
 #include "loader_thunks.h"
 
+/* Magic value defined by Vulkan ICD / Loader spec */
+#define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
+
+#define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001
+#define WINEVULKAN_QUIRK_ADJUST_MAX_IMAGE_COUNT 0x00000002
+#define WINEVULKAN_QUIRK_IGNORE_EXPLICIT_LAYERS 0x00000004
+
+/* Base 'class' for our Vulkan dispatchable objects such as VkDevice and VkInstance.
+ * This structure MUST be the first element of a dispatchable object as the ICD
+ * loader depends on it. For now only contains loader_magic, but over time more common
+ * functionality is expected.
+ */
+struct wine_vk_base
+{
+    /* Special section in each dispatchable object for use by the ICD loader for
+     * storing dispatch tables. The start contains a magical value '0x01CDC0DE'.
+     */
+    UINT_PTR loader_magic;
+};
+
+struct wine_vk_device_base
+{
+    struct wine_vk_base base;
+    unsigned int quirks;
+};
+
 struct vulkan_func
 {
     const char *name;
diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h
index 4e9c0721dcd..ebc1b35ba44 100644
--- a/dlls/winevulkan/vulkan_private.h
+++ b/dlls/winevulkan/vulkan_private.h
@@ -32,26 +32,6 @@
 #include "vulkan_loader.h"
 #include "vulkan_thunks.h"
 
-/* Magic value defined by Vulkan ICD / Loader spec */
-#define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
-
-#define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001
-#define WINEVULKAN_QUIRK_ADJUST_MAX_IMAGE_COUNT 0x00000002
-#define WINEVULKAN_QUIRK_IGNORE_EXPLICIT_LAYERS 0x00000004
-
-/* Base 'class' for our Vulkan dispatchable objects such as VkDevice and VkInstance.
- * This structure MUST be the first element of a dispatchable object as the ICD
- * loader depends on it. For now only contains loader_magic, but over time more common
- * functionality is expected.
- */
-struct wine_vk_base
-{
-    /* Special section in each dispatchable object for use by the ICD loader for
-     * storing dispatch tables. The start contains a magical value '0x01CDC0DE'.
-     */
-    UINT_PTR loader_magic;
-};
-
 /* Some extensions have callbacks for those we need to be able to
  * get the wine wrapper for a native handle
  */
@@ -74,7 +54,7 @@ struct VkCommandBuffer_T
 
 struct VkDevice_T
 {
-    struct wine_vk_base base;
+    struct wine_vk_device_base base;
     struct vulkan_device_funcs funcs;
     struct VkPhysicalDevice_T *phys_dev; /* parent */
     VkDevice device; /* native device */
@@ -82,8 +62,6 @@ struct VkDevice_T
     struct VkQueue_T* queues;
     uint32_t queue_count;
 
-    unsigned int quirks;
-
     struct wine_vk_mapping mapping;
 };
 




More information about the wine-cvs mailing list