mfplat: Read queue subscriber within the critical section.
[wine/zf.git] / dlls / winevulkan / vulkan_private.h
blob322d27079ea61b94209d5dab1b98c6c9d177d3f8
1 /* Wine Vulkan ICD private data structures
3 * Copyright 2017 Roderick Colenbrander
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #ifndef __WINE_VULKAN_PRIVATE_H
21 #define __WINE_VULKAN_PRIVATE_H
23 /* Perform vulkan struct conversion on 32-bit x86 platforms. */
24 #if defined(__i386__)
25 #define USE_STRUCT_CONVERSION
26 #endif
28 #include "wine/debug.h"
29 #include "wine/heap.h"
30 #include "wine/list.h"
31 #define VK_NO_PROTOTYPES
32 #include "wine/vulkan.h"
33 #include "wine/vulkan_driver.h"
35 #include "vulkan_thunks.h"
37 /* Magic value defined by Vulkan ICD / Loader spec */
38 #define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
40 #define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001
41 #define WINEVULKAN_QUIRK_ADJUST_MAX_IMAGE_COUNT 0x00000002
42 #define WINEVULKAN_QUIRK_IGNORE_EXPLICIT_LAYERS 0x00000004
44 struct vulkan_func
46 const char *name;
47 void *func;
50 /* Base 'class' for our Vulkan dispatchable objects such as VkDevice and VkInstance.
51 * This structure MUST be the first element of a dispatchable object as the ICD
52 * loader depends on it. For now only contains loader_magic, but over time more common
53 * functionality is expected.
55 struct wine_vk_base
57 /* Special section in each dispatchable object for use by the ICD loader for
58 * storing dispatch tables. The start contains a magical value '0x01CDC0DE'.
60 UINT_PTR loader_magic;
63 /* Some extensions have callbacks for those we need to be able to
64 * get the wine wrapper for a native handle
66 struct wine_vk_mapping
68 struct list link;
69 uint64_t native_handle;
70 uint64_t wine_wrapped_handle;
73 struct VkCommandBuffer_T
75 struct wine_vk_base base;
76 struct VkDevice_T *device; /* parent */
77 VkCommandBuffer command_buffer; /* native command buffer */
79 struct list pool_link;
80 struct wine_vk_mapping mapping;
83 struct VkDevice_T
85 struct wine_vk_base base;
86 struct vulkan_device_funcs funcs;
87 struct VkPhysicalDevice_T *phys_dev; /* parent */
88 VkDevice device; /* native device */
90 struct VkQueue_T **queues;
91 uint32_t max_queue_families;
93 unsigned int quirks;
95 struct wine_vk_mapping mapping;
98 struct wine_debug_utils_messenger;
100 struct wine_debug_report_callback
102 struct VkInstance_T *instance; /* parent */
103 VkDebugReportCallbackEXT debug_callback; /* native callback object */
105 /* application callback + data */
106 PFN_vkDebugReportCallbackEXT user_callback;
107 void *user_data;
109 struct wine_vk_mapping mapping;
112 struct VkInstance_T
114 struct wine_vk_base base;
115 struct vulkan_instance_funcs funcs;
116 VkInstance instance; /* native instance */
118 /* We cache devices as we need to wrap them as they are
119 * dispatchable objects.
121 struct VkPhysicalDevice_T **phys_devs;
122 uint32_t phys_dev_count;
124 VkBool32 enable_wrapper_list;
125 struct list wrappers;
126 SRWLOCK wrapper_lock;
128 struct wine_debug_utils_messenger *utils_messengers;
129 uint32_t utils_messenger_count;
131 struct wine_debug_report_callback default_callback;
133 unsigned int quirks;
135 struct wine_vk_mapping mapping;
138 struct VkPhysicalDevice_T
140 struct wine_vk_base base;
141 struct VkInstance_T *instance; /* parent */
142 VkPhysicalDevice phys_dev; /* native physical device */
144 VkExtensionProperties *extensions;
145 uint32_t extension_count;
147 struct wine_vk_mapping mapping;
150 struct VkQueue_T
152 struct wine_vk_base base;
153 struct VkDevice_T *device; /* parent */
154 VkQueue queue; /* native queue */
156 VkDeviceQueueCreateFlags flags;
158 struct wine_vk_mapping mapping;
161 struct wine_cmd_pool
163 VkCommandPool command_pool;
165 struct list command_buffers;
167 struct wine_vk_mapping mapping;
170 static inline struct wine_cmd_pool *wine_cmd_pool_from_handle(VkCommandPool handle)
172 return (struct wine_cmd_pool *)(uintptr_t)handle;
175 static inline VkCommandPool wine_cmd_pool_to_handle(struct wine_cmd_pool *cmd_pool)
177 return (VkCommandPool)(uintptr_t)cmd_pool;
180 struct wine_debug_utils_messenger
182 struct VkInstance_T *instance; /* parent */
183 VkDebugUtilsMessengerEXT debug_messenger; /* native messenger */
185 /* application callback + data */
186 PFN_vkDebugUtilsMessengerCallbackEXT user_callback;
187 void *user_data;
189 struct wine_vk_mapping mapping;
192 static inline struct wine_debug_utils_messenger *wine_debug_utils_messenger_from_handle(
193 VkDebugUtilsMessengerEXT handle)
195 return (struct wine_debug_utils_messenger *)(uintptr_t)handle;
198 static inline VkDebugUtilsMessengerEXT wine_debug_utils_messenger_to_handle(
199 struct wine_debug_utils_messenger *debug_messenger)
201 return (VkDebugUtilsMessengerEXT)(uintptr_t)debug_messenger;
204 static inline struct wine_debug_report_callback *wine_debug_report_callback_from_handle(
205 VkDebugReportCallbackEXT handle)
207 return (struct wine_debug_report_callback *)(uintptr_t)handle;
210 static inline VkDebugReportCallbackEXT wine_debug_report_callback_to_handle(
211 struct wine_debug_report_callback *debug_messenger)
213 return (VkDebugReportCallbackEXT)(uintptr_t)debug_messenger;
216 struct wine_surface
218 VkSurfaceKHR surface; /* native surface */
219 VkSurfaceKHR driver_surface; /* wine driver surface */
221 struct wine_vk_mapping mapping;
224 static inline struct wine_surface *wine_surface_from_handle(VkSurfaceKHR handle)
226 return (struct wine_surface *)(uintptr_t)handle;
229 static inline VkSurfaceKHR wine_surface_to_handle(struct wine_surface *surface)
231 return (VkSurfaceKHR)(uintptr_t)surface;
234 void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN;
235 void *wine_vk_get_phys_dev_proc_addr(const char *name) DECLSPEC_HIDDEN;
236 void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN;
238 BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN;
239 BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN;
241 BOOL wine_vk_is_type_wrapped(VkObjectType type) DECLSPEC_HIDDEN;
242 uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle) DECLSPEC_HIDDEN;
244 #endif /* __WINE_VULKAN_PRIVATE_H */