2018-03-01 16:37:03 +01:00
|
|
|
/* Wine Vulkan ICD private data structures
|
|
|
|
*
|
|
|
|
* Copyright 2017 Roderick Colenbrander
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_VULKAN_PRIVATE_H
|
|
|
|
#define __WINE_VULKAN_PRIVATE_H
|
|
|
|
|
2018-03-29 14:53:53 +02:00
|
|
|
/* Perform vulkan struct conversion on 32-bit x86 platforms. */
|
|
|
|
#if defined(__i386__)
|
|
|
|
#define USE_STRUCT_CONVERSION
|
|
|
|
#endif
|
2021-04-29 14:38:46 +02:00
|
|
|
#define VK_NO_PROTOTYPES
|
2018-03-29 14:53:53 +02:00
|
|
|
|
2021-04-13 00:53:31 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2018-08-30 12:22:32 +02:00
|
|
|
#include "wine/list.h"
|
2018-04-03 11:13:10 +02:00
|
|
|
|
2021-04-19 14:14:59 +02:00
|
|
|
#include "vulkan_loader.h"
|
2018-03-01 16:37:04 +01:00
|
|
|
#include "vulkan_thunks.h"
|
|
|
|
|
2020-10-13 19:28:36 +02:00
|
|
|
/* Some extensions have callbacks for those we need to be able to
|
|
|
|
* get the wine wrapper for a native handle
|
|
|
|
*/
|
|
|
|
struct wine_vk_mapping
|
|
|
|
{
|
|
|
|
struct list link;
|
|
|
|
uint64_t native_handle;
|
|
|
|
uint64_t wine_wrapped_handle;
|
|
|
|
};
|
|
|
|
|
2018-03-14 13:11:54 +01:00
|
|
|
struct VkCommandBuffer_T
|
|
|
|
{
|
|
|
|
struct wine_vk_base base;
|
2018-04-09 10:25:56 +02:00
|
|
|
struct VkDevice_T *device; /* parent */
|
2018-03-14 13:11:54 +01:00
|
|
|
VkCommandBuffer command_buffer; /* native command buffer */
|
2018-08-30 12:22:32 +02:00
|
|
|
|
|
|
|
struct list pool_link;
|
2020-10-13 19:28:36 +02:00
|
|
|
struct wine_vk_mapping mapping;
|
2018-03-14 13:11:54 +01:00
|
|
|
};
|
|
|
|
|
2018-03-09 17:48:48 +01:00
|
|
|
struct VkDevice_T
|
|
|
|
{
|
2021-04-19 14:15:10 +02:00
|
|
|
struct wine_vk_device_base base;
|
2018-03-09 17:48:48 +01:00
|
|
|
struct vulkan_device_funcs funcs;
|
2020-10-13 19:28:36 +02:00
|
|
|
struct VkPhysicalDevice_T *phys_dev; /* parent */
|
2018-04-09 10:25:57 +02:00
|
|
|
VkDevice device; /* native device */
|
2018-03-14 13:11:52 +01:00
|
|
|
|
2021-04-14 00:31:25 +02:00
|
|
|
struct VkQueue_T* queues;
|
|
|
|
uint32_t queue_count;
|
2018-03-29 14:53:58 +02:00
|
|
|
|
2020-10-13 19:28:36 +02:00
|
|
|
struct wine_vk_mapping mapping;
|
2018-03-09 17:48:48 +01:00
|
|
|
};
|
|
|
|
|
2020-10-13 19:28:37 +02:00
|
|
|
struct wine_debug_utils_messenger;
|
|
|
|
|
2020-10-27 21:18:54 +01:00
|
|
|
struct wine_debug_report_callback
|
|
|
|
{
|
|
|
|
struct VkInstance_T *instance; /* parent */
|
|
|
|
VkDebugReportCallbackEXT debug_callback; /* native callback object */
|
|
|
|
|
|
|
|
/* application callback + data */
|
|
|
|
PFN_vkDebugReportCallbackEXT user_callback;
|
|
|
|
void *user_data;
|
|
|
|
|
|
|
|
struct wine_vk_mapping mapping;
|
|
|
|
};
|
|
|
|
|
2018-03-01 16:37:03 +01:00
|
|
|
struct VkInstance_T
|
|
|
|
{
|
|
|
|
struct wine_vk_base base;
|
2018-03-02 07:13:35 +01:00
|
|
|
struct vulkan_instance_funcs funcs;
|
2018-04-09 10:25:57 +02:00
|
|
|
VkInstance instance; /* native instance */
|
2018-03-06 17:28:48 +01:00
|
|
|
|
|
|
|
/* We cache devices as we need to wrap them as they are
|
|
|
|
* dispatchable objects.
|
|
|
|
*/
|
|
|
|
struct VkPhysicalDevice_T **phys_devs;
|
2018-07-12 11:39:43 +02:00
|
|
|
uint32_t phys_dev_count;
|
2018-03-29 14:53:58 +02:00
|
|
|
|
2020-10-13 19:28:36 +02:00
|
|
|
VkBool32 enable_wrapper_list;
|
|
|
|
struct list wrappers;
|
2021-04-13 00:53:31 +02:00
|
|
|
pthread_rwlock_t wrapper_lock;
|
2020-10-13 19:28:36 +02:00
|
|
|
|
2020-10-13 19:28:37 +02:00
|
|
|
struct wine_debug_utils_messenger *utils_messengers;
|
|
|
|
uint32_t utils_messenger_count;
|
|
|
|
|
2020-10-27 21:18:54 +01:00
|
|
|
struct wine_debug_report_callback default_callback;
|
|
|
|
|
2018-03-29 14:53:58 +02:00
|
|
|
unsigned int quirks;
|
2020-10-13 19:28:36 +02:00
|
|
|
|
|
|
|
struct wine_vk_mapping mapping;
|
2018-03-01 16:37:03 +01:00
|
|
|
};
|
|
|
|
|
2018-03-06 17:28:48 +01:00
|
|
|
struct VkPhysicalDevice_T
|
|
|
|
{
|
|
|
|
struct wine_vk_base base;
|
|
|
|
struct VkInstance_T *instance; /* parent */
|
2018-04-09 10:25:57 +02:00
|
|
|
VkPhysicalDevice phys_dev; /* native physical device */
|
2018-03-14 13:11:50 +01:00
|
|
|
|
2018-03-29 14:53:51 +02:00
|
|
|
VkExtensionProperties *extensions;
|
2018-04-09 10:25:57 +02:00
|
|
|
uint32_t extension_count;
|
2020-10-13 19:28:36 +02:00
|
|
|
|
|
|
|
struct wine_vk_mapping mapping;
|
2018-03-06 17:28:48 +01:00
|
|
|
};
|
|
|
|
|
2018-03-14 13:11:52 +01:00
|
|
|
struct VkQueue_T
|
|
|
|
{
|
|
|
|
struct wine_vk_base base;
|
2018-04-09 10:25:56 +02:00
|
|
|
struct VkDevice_T *device; /* parent */
|
2018-03-14 13:11:52 +01:00
|
|
|
VkQueue queue; /* native queue */
|
2018-07-16 15:18:19 +02:00
|
|
|
|
2021-04-14 00:31:25 +02:00
|
|
|
uint32_t family_index;
|
|
|
|
uint32_t queue_index;
|
2018-07-16 15:18:19 +02:00
|
|
|
VkDeviceQueueCreateFlags flags;
|
2020-10-13 19:28:36 +02:00
|
|
|
|
|
|
|
struct wine_vk_mapping mapping;
|
2018-03-14 13:11:52 +01:00
|
|
|
};
|
|
|
|
|
2018-08-30 12:22:31 +02:00
|
|
|
struct wine_cmd_pool
|
|
|
|
{
|
|
|
|
VkCommandPool command_pool;
|
2018-08-30 12:22:32 +02:00
|
|
|
|
|
|
|
struct list command_buffers;
|
2020-10-13 19:28:36 +02:00
|
|
|
|
|
|
|
struct wine_vk_mapping mapping;
|
2018-08-30 12:22:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct wine_cmd_pool *wine_cmd_pool_from_handle(VkCommandPool handle)
|
|
|
|
{
|
|
|
|
return (struct wine_cmd_pool *)(uintptr_t)handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VkCommandPool wine_cmd_pool_to_handle(struct wine_cmd_pool *cmd_pool)
|
|
|
|
{
|
|
|
|
return (VkCommandPool)(uintptr_t)cmd_pool;
|
|
|
|
}
|
|
|
|
|
2020-10-13 19:28:37 +02:00
|
|
|
struct wine_debug_utils_messenger
|
|
|
|
{
|
|
|
|
struct VkInstance_T *instance; /* parent */
|
|
|
|
VkDebugUtilsMessengerEXT debug_messenger; /* native messenger */
|
|
|
|
|
|
|
|
/* application callback + data */
|
|
|
|
PFN_vkDebugUtilsMessengerCallbackEXT user_callback;
|
|
|
|
void *user_data;
|
|
|
|
|
|
|
|
struct wine_vk_mapping mapping;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct wine_debug_utils_messenger *wine_debug_utils_messenger_from_handle(
|
|
|
|
VkDebugUtilsMessengerEXT handle)
|
|
|
|
{
|
|
|
|
return (struct wine_debug_utils_messenger *)(uintptr_t)handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VkDebugUtilsMessengerEXT wine_debug_utils_messenger_to_handle(
|
|
|
|
struct wine_debug_utils_messenger *debug_messenger)
|
|
|
|
{
|
|
|
|
return (VkDebugUtilsMessengerEXT)(uintptr_t)debug_messenger;
|
|
|
|
}
|
|
|
|
|
2020-10-27 21:18:54 +01:00
|
|
|
static inline struct wine_debug_report_callback *wine_debug_report_callback_from_handle(
|
|
|
|
VkDebugReportCallbackEXT handle)
|
|
|
|
{
|
|
|
|
return (struct wine_debug_report_callback *)(uintptr_t)handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VkDebugReportCallbackEXT wine_debug_report_callback_to_handle(
|
|
|
|
struct wine_debug_report_callback *debug_messenger)
|
|
|
|
{
|
|
|
|
return (VkDebugReportCallbackEXT)(uintptr_t)debug_messenger;
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:31:56 +01:00
|
|
|
struct wine_surface
|
|
|
|
{
|
2021-01-26 13:32:24 +01:00
|
|
|
VkSurfaceKHR surface; /* native surface */
|
|
|
|
VkSurfaceKHR driver_surface; /* wine driver surface */
|
2021-01-22 18:31:56 +01:00
|
|
|
|
|
|
|
struct wine_vk_mapping mapping;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct wine_surface *wine_surface_from_handle(VkSurfaceKHR handle)
|
|
|
|
{
|
|
|
|
return (struct wine_surface *)(uintptr_t)handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VkSurfaceKHR wine_surface_to_handle(struct wine_surface *surface)
|
|
|
|
{
|
|
|
|
return (VkSurfaceKHR)(uintptr_t)surface;
|
|
|
|
}
|
|
|
|
|
2018-03-29 14:53:53 +02:00
|
|
|
BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN;
|
|
|
|
BOOL wine_vk_instance_extension_supported(const char *name) DECLSPEC_HIDDEN;
|
|
|
|
|
2020-10-13 19:28:35 +02:00
|
|
|
BOOL wine_vk_is_type_wrapped(VkObjectType type) DECLSPEC_HIDDEN;
|
|
|
|
uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle) DECLSPEC_HIDDEN;
|
|
|
|
|
2021-12-09 03:14:01 +01:00
|
|
|
NTSTATUS init_vulkan(void *args) DECLSPEC_HIDDEN;
|
|
|
|
|
2021-04-16 15:48:36 +02:00
|
|
|
extern const struct unix_funcs loader_funcs;
|
2021-04-14 17:58:45 +02:00
|
|
|
|
2021-08-20 13:24:49 +02:00
|
|
|
BOOL WINAPI wine_vk_is_available_instance_function(VkInstance instance, const char *name) DECLSPEC_HIDDEN;
|
2021-08-20 13:24:50 +02:00
|
|
|
BOOL WINAPI wine_vk_is_available_device_function(VkDevice device, const char *name) DECLSPEC_HIDDEN;
|
2021-08-20 13:24:49 +02:00
|
|
|
|
2018-03-01 16:37:03 +01:00
|
|
|
#endif /* __WINE_VULKAN_PRIVATE_H */
|