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. */
25 #define USE_STRUCT_CONVERSION
27 #define VK_NO_PROTOTYPES
31 #include "wine/list.h"
33 #include "vulkan_loader.h"
34 #include "vulkan_thunks.h"
36 /* Some extensions have callbacks for those we need to be able to
37 * get the wine wrapper for a native handle
39 struct wine_vk_mapping
42 uint64_t native_handle
;
43 uint64_t wine_wrapped_handle
;
46 struct VkCommandBuffer_T
48 struct wine_vk_base base
;
49 struct VkDevice_T
*device
; /* parent */
50 VkCommandBuffer command_buffer
; /* native command buffer */
52 struct list pool_link
;
53 struct wine_vk_mapping mapping
;
58 struct wine_vk_device_base base
;
59 struct vulkan_device_funcs funcs
;
60 struct VkPhysicalDevice_T
*phys_dev
; /* parent */
61 VkDevice device
; /* native device */
63 struct VkQueue_T
* queues
;
66 struct wine_vk_mapping mapping
;
69 struct wine_debug_utils_messenger
;
71 struct wine_debug_report_callback
73 struct VkInstance_T
*instance
; /* parent */
74 VkDebugReportCallbackEXT debug_callback
; /* native callback object */
76 /* application callback + data */
77 PFN_vkDebugReportCallbackEXT user_callback
;
80 struct wine_vk_mapping mapping
;
85 struct wine_vk_base base
;
86 struct vulkan_instance_funcs funcs
;
87 VkInstance instance
; /* native instance */
89 /* We cache devices as we need to wrap them as they are
90 * dispatchable objects.
92 struct VkPhysicalDevice_T
**phys_devs
;
93 uint32_t phys_dev_count
;
95 VkBool32 enable_wrapper_list
;
97 pthread_rwlock_t wrapper_lock
;
99 struct wine_debug_utils_messenger
*utils_messengers
;
100 uint32_t utils_messenger_count
;
102 struct wine_debug_report_callback default_callback
;
106 struct wine_vk_mapping mapping
;
109 struct VkPhysicalDevice_T
111 struct wine_vk_base base
;
112 struct VkInstance_T
*instance
; /* parent */
113 VkPhysicalDevice phys_dev
; /* native physical device */
115 VkExtensionProperties
*extensions
;
116 uint32_t extension_count
;
118 struct wine_vk_mapping mapping
;
123 struct wine_vk_base base
;
124 struct VkDevice_T
*device
; /* parent */
125 VkQueue queue
; /* native queue */
127 uint32_t family_index
;
128 uint32_t queue_index
;
129 VkDeviceQueueCreateFlags flags
;
131 struct wine_vk_mapping mapping
;
136 VkCommandPool command_pool
;
138 struct list command_buffers
;
140 struct wine_vk_mapping mapping
;
143 static inline struct wine_cmd_pool
*wine_cmd_pool_from_handle(VkCommandPool handle
)
145 return (struct wine_cmd_pool
*)(uintptr_t)handle
;
148 static inline VkCommandPool
wine_cmd_pool_to_handle(struct wine_cmd_pool
*cmd_pool
)
150 return (VkCommandPool
)(uintptr_t)cmd_pool
;
153 struct wine_debug_utils_messenger
155 struct VkInstance_T
*instance
; /* parent */
156 VkDebugUtilsMessengerEXT debug_messenger
; /* native messenger */
158 /* application callback + data */
159 PFN_vkDebugUtilsMessengerCallbackEXT user_callback
;
162 struct wine_vk_mapping mapping
;
165 static inline struct wine_debug_utils_messenger
*wine_debug_utils_messenger_from_handle(
166 VkDebugUtilsMessengerEXT handle
)
168 return (struct wine_debug_utils_messenger
*)(uintptr_t)handle
;
171 static inline VkDebugUtilsMessengerEXT
wine_debug_utils_messenger_to_handle(
172 struct wine_debug_utils_messenger
*debug_messenger
)
174 return (VkDebugUtilsMessengerEXT
)(uintptr_t)debug_messenger
;
177 static inline struct wine_debug_report_callback
*wine_debug_report_callback_from_handle(
178 VkDebugReportCallbackEXT handle
)
180 return (struct wine_debug_report_callback
*)(uintptr_t)handle
;
183 static inline VkDebugReportCallbackEXT
wine_debug_report_callback_to_handle(
184 struct wine_debug_report_callback
*debug_messenger
)
186 return (VkDebugReportCallbackEXT
)(uintptr_t)debug_messenger
;
191 VkSurfaceKHR surface
; /* native surface */
192 VkSurfaceKHR driver_surface
; /* wine driver surface */
194 struct wine_vk_mapping mapping
;
197 static inline struct wine_surface
*wine_surface_from_handle(VkSurfaceKHR handle
)
199 return (struct wine_surface
*)(uintptr_t)handle
;
202 static inline VkSurfaceKHR
wine_surface_to_handle(struct wine_surface
*surface
)
204 return (VkSurfaceKHR
)(uintptr_t)surface
;
207 BOOL
wine_vk_device_extension_supported(const char *name
) DECLSPEC_HIDDEN
;
208 BOOL
wine_vk_instance_extension_supported(const char *name
) DECLSPEC_HIDDEN
;
210 BOOL
wine_vk_is_type_wrapped(VkObjectType type
) DECLSPEC_HIDDEN
;
211 uint64_t wine_vk_unwrap_handle(VkObjectType type
, uint64_t handle
) DECLSPEC_HIDDEN
;
213 extern const struct unix_funcs loader_funcs
;
215 BOOL WINAPI
wine_vk_is_available_instance_function(VkInstance instance
, const char *name
) DECLSPEC_HIDDEN
;
216 BOOL WINAPI
wine_vk_is_available_device_function(VkDevice device
, const char *name
) DECLSPEC_HIDDEN
;
218 #endif /* __WINE_VULKAN_PRIVATE_H */