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
|
|
|
|
|
2018-04-03 11:13:10 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "wine/heap.h"
|
2018-08-30 12:22:32 +02:00
|
|
|
#include "wine/list.h"
|
2018-04-03 11:13:10 +02:00
|
|
|
#define VK_NO_PROTOTYPES
|
|
|
|
#include "wine/vulkan.h"
|
|
|
|
#include "wine/vulkan_driver.h"
|
|
|
|
|
2018-03-01 16:37:04 +01:00
|
|
|
#include "vulkan_thunks.h"
|
|
|
|
|
2018-03-01 16:37:03 +01:00
|
|
|
/* Magic value defined by Vulkan ICD / Loader spec */
|
|
|
|
#define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
|
|
|
|
|
2018-03-29 14:53:58 +02:00
|
|
|
#define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001
|
2020-07-31 11:13:11 +02:00
|
|
|
#define WINEVULKAN_QUIRK_ADJUST_MAX_IMAGE_COUNT 0x00000002
|
2020-09-08 21:46:27 +02:00
|
|
|
#define WINEVULKAN_QUIRK_IGNORE_EXPLICIT_LAYERS 0x00000004
|
2018-03-29 14:53:58 +02:00
|
|
|
|
2018-03-01 16:37:04 +01:00
|
|
|
struct vulkan_func
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
void *func;
|
|
|
|
};
|
|
|
|
|
2018-03-01 16:37:03 +01:00
|
|
|
/* 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;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
struct wine_vk_base base;
|
|
|
|
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
|
|
|
|
|
|
|
struct VkQueue_T **queues;
|
2018-04-09 10:25:57 +02:00
|
|
|
uint32_t max_queue_families;
|
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-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;
|
|
|
|
SRWLOCK wrapper_lock;
|
|
|
|
|
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
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-03-29 14:53:53 +02:00
|
|
|
void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN;
|
|
|
|
void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-03-01 16:37:03 +01:00
|
|
|
#endif /* __WINE_VULKAN_PRIVATE_H */
|