winevulkan: Fix surface functions if they aren't called by winevulkan.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50549
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Georg Lehmann 2021-01-26 13:32:24 +01:00 committed by Alexandre Julliard
parent 88eb322830
commit c1824d578a
8 changed files with 103 additions and 94 deletions

View file

@ -99,7 +99,7 @@ static void *macdrv_get_vk_instance_proc_addr(VkInstance instance, const char *n
static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle)
{
return vulkan_driver_get_surface_data(handle);
return (struct wine_vk_surface *)(uintptr_t)handle;
}
static void *vulkan_handle;
@ -320,7 +320,7 @@ static VkResult macdrv_vkCreateWin32SurfaceKHR(VkInstance instance,
goto err;
}
vulkan_driver_init_surface(*surface, mac_surface->surface, mac_surface);
*surface = (uintptr_t)mac_surface;
release_win_data(data);
@ -558,6 +558,15 @@ static VkResult macdrv_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
return res;
}
static VkSurfaceKHR macdrv_wine_get_native_surface(VkSurfaceKHR surface)
{
struct wine_vk_surface *mac_surface = surface_from_handle(surface);
TRACE("0x%s\n", wine_dbgstr_longlong(surface));
return mac_surface->surface;
}
static const struct vulkan_funcs vulkan_funcs =
{
macdrv_vkCreateInstance,
@ -580,6 +589,8 @@ static const struct vulkan_funcs vulkan_funcs =
macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR,
macdrv_vkGetSwapchainImagesKHR,
macdrv_vkQueuePresentKHR,
macdrv_wine_get_native_surface,
};
static void *macdrv_get_vk_device_proc_addr(const char *name)

View file

@ -132,7 +132,7 @@ CORE_EXTENSIONS = [
# Functions part of our winevulkan graphics driver interface.
# DRIVER_VERSION should be bumped on any change to driver interface
# in FUNCTION_OVERRIDES
DRIVER_VERSION = 9
DRIVER_VERSION = 10
# Table of functions for which we have a special implementation.
# These are regular device / instance functions for which we need
@ -183,14 +183,14 @@ FUNCTION_OVERRIDES = {
# VK_KHR_get_surface_capabilities2
"vkGetPhysicalDeviceSurfaceCapabilities2KHR" : {"dispatch" : True, "driver" : True, "thunk" : False, "private_thunk" : True},
"vkGetPhysicalDeviceSurfaceFormats2KHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
"vkGetPhysicalDeviceSurfaceFormats2KHR" : {"dispatch" : True, "driver" : True, "thunk" : False, "private_thunk" : True},
# VK_KHR_win32_surface
"vkCreateWin32SurfaceKHR" : {"dispatch" : True, "driver" : True, "thunk" : False},
"vkGetPhysicalDeviceWin32PresentationSupportKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
# VK_KHR_swapchain
"vkCreateSwapchainKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
"vkCreateSwapchainKHR" : {"dispatch" : True, "driver" : True, "thunk" : False, "private_thunk" : True},
"vkDestroySwapchainKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
"vkGetSwapchainImagesKHR": {"dispatch" : True, "driver" : True, "thunk" : True},
"vkQueuePresentKHR": {"dispatch" : True, "driver" : True, "thunk" : True},
@ -957,7 +957,7 @@ class VkHandle(object):
if self.name == "VkDebugReportCallbackEXT":
return "wine_debug_report_callback_from_handle({0})->debug_callback".format(name)
if self.name == "VkSurfaceKHR":
return "wine_surface_from_handle({0})->base.surface".format(name)
return "wine_surface_from_handle({0})->surface".format(name)
native_handle_name = None
@ -979,12 +979,17 @@ class VkHandle(object):
LOGGER.error("Unhandled native handle for: {0}".format(self.name))
return None
def driver_handle(self, name):
""" Provide access to the handle that should be passed to the wine driver """
if self.name == "VkSurfaceKHR":
return "wine_surface_from_handle({0})->driver_surface".format(name)
return self.native_handle(name)
def is_wrapped(self):
return self.native_handle("test") is not None
def is_unwrapped_by_driver(self):
return self.name == "VkSurfaceKHR"
class VkMember(object):
def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None,
dyn_array_len=None, optional=False, values=None):
@ -1606,13 +1611,10 @@ class VkParam(object):
else:
return "&{0}_host".format(self.name)
else:
# We need to pass the native handle to the native Vulkan calls unless
# the wine driver unwraps the handle for us.
if self.is_handle() and not self.handle.is_unwrapped_by_driver():
native_handle = self.handle.native_handle(self.name)
else:
native_handle = None
return native_handle if native_handle else self.name
# We need to pass the native handle to the native Vulkan calls and
# the wine driver's handle to calls which are wrapped by the driver.
driver_handle = self.handle.driver_handle(self.name) if self.is_handle() else None
return driver_handle if driver_handle else self.name
class VkStruct(Sequence):
@ -2560,6 +2562,10 @@ class VkGenerator(object):
# stuff in there. For simplicity substitute with "void *".
pfn = pfn.replace("PFN_vkVoidFunction", "void *")
f.write(" {0};\n".format(pfn))
f.write("\n")
f.write(" /* winevulkan specific functions */\n")
f.write(" VkSurfaceKHR (*p_wine_get_native_surface)(VkSurfaceKHR);\n")
f.write("};\n\n")
f.write("extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(HDC hdc, UINT version);\n\n")
@ -2593,32 +2599,6 @@ class VkGenerator(object):
f.write(" name -= 2;\n\n")
f.write(" return get_vulkan_driver_device_proc_addr(vulkan_funcs, name);\n}\n\n")
f.write("struct wine_surface_base\n")
f.write("{\n")
f.write(" VkSurfaceKHR surface; /* native surface */\n")
f.write(" void *driver_data;\n")
f.write("};\n\n")
f.write("static inline void vulkan_driver_init_surface(\n")
f.write(" VkSurfaceKHR surface, VkSurfaceKHR native_surface, void *data)\n")
f.write("{\n")
f.write(" struct wine_surface_base *object = (void *)(uintptr_t)surface;\n")
f.write(" object->surface = native_surface;\n")
f.write(" object->driver_data = data;\n")
f.write("};\n\n")
f.write("static inline VkSurfaceKHR vulkan_driver_get_native_surface(VkSurfaceKHR surface)\n")
f.write("{\n")
f.write(" struct wine_surface_base *object = (void *)(uintptr_t)surface;\n")
f.write(" return object->surface;\n")
f.write("};\n\n")
f.write("static inline void *vulkan_driver_get_surface_data(VkSurfaceKHR surface)\n")
f.write("{\n")
f.write(" struct wine_surface_base *object = (void *)(uintptr_t)surface;\n")
f.write(" return object->driver_data;\n")
f.write("};\n\n")
f.write("#endif /* __WINE_VULKAN_DRIVER_H */\n")
def generate_vulkan_spec(self, f):

View file

@ -1770,6 +1770,19 @@ void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType object_type,
device->funcs.p_vkGetPrivateDataEXT(device->device, object_type, object_handle, private_data_slot, data);
}
VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *create_info,
const VkAllocationCallbacks *allocator, VkSwapchainKHR *swapchain)
{
VkSwapchainCreateInfoKHR native_info;
TRACE("%p, %p, %p, %p\n", device, create_info, allocator, swapchain);
native_info = *create_info;
native_info.surface = wine_surface_from_handle(create_info->surface)->driver_surface;
return thunk_vkCreateSwapchainKHR(device, &native_info, allocator, swapchain);
}
VkResult WINAPI wine_vkCreateWin32SurfaceKHR(VkInstance instance,
const VkWin32SurfaceCreateInfoKHR *createInfo, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)
{
@ -1786,18 +1799,19 @@ VkResult WINAPI wine_vkCreateWin32SurfaceKHR(VkInstance instance,
if (!object)
return VK_ERROR_OUT_OF_HOST_MEMORY;
*surface = wine_surface_to_handle(object);
res = instance->funcs.p_vkCreateWin32SurfaceKHR(instance->instance, createInfo, NULL, surface);
res = instance->funcs.p_vkCreateWin32SurfaceKHR(instance->instance, createInfo, NULL, &object->driver_surface);
if (res != VK_SUCCESS)
{
heap_free(object);
*surface = VK_NULL_HANDLE;
return res;
}
WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(instance, object, object->base.surface);
object->surface = vk_funcs->p_wine_get_native_surface(object->driver_surface);
WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(instance, object, object->surface);
*surface = wine_surface_to_handle(object);
return VK_SUCCESS;
}
@ -1811,12 +1825,25 @@ void WINAPI wine_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
if (!object)
return;
instance->funcs.p_vkDestroySurfaceKHR(instance->instance, surface, NULL);
instance->funcs.p_vkDestroySurfaceKHR(instance->instance, object->driver_surface, NULL);
WINE_VK_REMOVE_HANDLE_MAPPING(instance, object);
heap_free(object);
}
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice phys_dev,
const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, uint32_t *formats_count, VkSurfaceFormat2KHR *formats)
{
VkPhysicalDeviceSurfaceInfo2KHR native_info;
TRACE("%p, %p, %p, %p\n", phys_dev, surface_info, formats_count, formats);
native_info = *surface_info;
native_info.surface = wine_surface_from_handle(surface_info->surface)->driver_surface;
return thunk_vkGetPhysicalDeviceSurfaceFormats2KHR(phys_dev, &native_info, formats_count, formats);
}
static inline void adjust_max_image_count(VkPhysicalDevice phys_dev, VkSurfaceCapabilitiesKHR* capabilities)
{
/* Many Windows games, for example Strange Brigade, No Man's Sky, Path of Exile
@ -1850,11 +1877,15 @@ VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice phys_dev,
const VkPhysicalDeviceSurfaceInfo2KHR *surface_info, VkSurfaceCapabilities2KHR *capabilities)
{
VkPhysicalDeviceSurfaceInfo2KHR native_info;
VkResult res;
TRACE("%p, %p, %p\n", phys_dev, surface_info, capabilities);
res = thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev, surface_info, capabilities);
native_info = *surface_info;
native_info.surface = wine_surface_from_handle(surface_info->surface)->driver_surface;
res = thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev, &native_info, capabilities);
if (res == VK_SUCCESS)
adjust_max_image_count(phys_dev, &capabilities->surfaceCapabilities);

View file

@ -215,7 +215,8 @@ static inline VkDebugReportCallbackEXT wine_debug_report_callback_to_handle(
struct wine_surface
{
struct wine_surface_base base;
VkSurfaceKHR surface; /* native surface */
VkSurfaceKHR driver_surface; /* wine driver surface */
struct wine_vk_mapping mapping;
};

View file

@ -5202,19 +5202,16 @@ VkResult WINAPI wine_vkCreateShaderModule(VkDevice device, const VkShaderModuleC
return device->funcs.p_vkCreateShaderModule(device->device, pCreateInfo, NULL, pShaderModule);
}
VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain)
VkResult thunk_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain)
{
#if defined(USE_STRUCT_CONVERSION)
VkResult result;
VkSwapchainCreateInfoKHR_host pCreateInfo_host;
TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSwapchain);
convert_VkSwapchainCreateInfoKHR_win_to_host(pCreateInfo, &pCreateInfo_host);
result = device->funcs.p_vkCreateSwapchainKHR(device->device, &pCreateInfo_host, NULL, pSwapchain);
return result;
#else
TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSwapchain);
return device->funcs.p_vkCreateSwapchainKHR(device->device, pCreateInfo, NULL, pSwapchain);
#endif
}
@ -5726,7 +5723,7 @@ VkResult WINAPI wine_vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkD
VkResult WINAPI wine_vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes)
{
TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(surface), pModes);
return device->funcs.p_vkGetDeviceGroupSurfacePresentModesKHR(device->device, surface, pModes);
return device->funcs.p_vkGetDeviceGroupSurfacePresentModesKHR(device->device, wine_surface_from_handle(surface)->driver_surface, pModes);
}
void WINAPI wine_vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize *pCommittedMemoryInBytes)
@ -6064,7 +6061,7 @@ static void WINAPI wine_vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDe
VkResult WINAPI wine_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pRectCount, VkRect2D *pRects)
{
TRACE("%p, 0x%s, %p, %p\n", physicalDevice, wine_dbgstr_longlong(surface), pRectCount, pRects);
return physicalDevice->instance->funcs.p_vkGetPhysicalDevicePresentRectanglesKHR(physicalDevice->phys_dev, surface, pRectCount, pRects);
return physicalDevice->instance->funcs.p_vkGetPhysicalDevicePresentRectanglesKHR(physicalDevice->phys_dev, wine_surface_from_handle(surface)->driver_surface, pRectCount, pRects);
}
void WINAPI wine_vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
@ -6172,22 +6169,19 @@ VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physi
VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
{
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice->phys_dev, surface, pSurfaceCapabilities);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice->phys_dev, wine_surface_from_handle(surface)->driver_surface, pSurfaceCapabilities);
}
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats)
VkResult thunk_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats)
{
#if defined(USE_STRUCT_CONVERSION)
VkResult result;
VkPhysicalDeviceSurfaceInfo2KHR_host pSurfaceInfo_host;
TRACE("%p, %p, %p, %p\n", physicalDevice, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats);
convert_VkPhysicalDeviceSurfaceInfo2KHR_win_to_host(pSurfaceInfo, &pSurfaceInfo_host);
result = physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormats2KHR(physicalDevice->phys_dev, &pSurfaceInfo_host, pSurfaceFormatCount, pSurfaceFormats);
return result;
#else
TRACE("%p, %p, %p, %p\n", physicalDevice, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormats2KHR(physicalDevice->phys_dev, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats);
#endif
}
@ -6195,19 +6189,19 @@ VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice phys
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats)
{
TRACE("%p, 0x%s, %p, %p\n", physicalDevice, wine_dbgstr_longlong(surface), pSurfaceFormatCount, pSurfaceFormats);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice->phys_dev, surface, pSurfaceFormatCount, pSurfaceFormats);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice->phys_dev, wine_surface_from_handle(surface)->driver_surface, pSurfaceFormatCount, pSurfaceFormats);
}
VkResult WINAPI wine_vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes)
{
TRACE("%p, 0x%s, %p, %p\n", physicalDevice, wine_dbgstr_longlong(surface), pPresentModeCount, pPresentModes);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice->phys_dev, surface, pPresentModeCount, pPresentModes);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice->phys_dev, wine_surface_from_handle(surface)->driver_surface, pPresentModeCount, pPresentModes);
}
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported)
{
TRACE("%p, %u, 0x%s, %p\n", physicalDevice, queueFamilyIndex, wine_dbgstr_longlong(surface), pSupported);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice->phys_dev, queueFamilyIndex, surface, pSupported);
return physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice->phys_dev, queueFamilyIndex, wine_surface_from_handle(surface)->driver_surface, pSupported);
}
static VkResult WINAPI wine_vkGetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevice physicalDevice, uint32_t *pToolCount, VkPhysicalDeviceToolPropertiesEXT *pToolProperties)
@ -7316,7 +7310,7 @@ uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle)
case VK_OBJECT_TYPE_QUEUE:
return (uint64_t) (uintptr_t) ((VkQueue) (uintptr_t) handle)->queue;
case VK_OBJECT_TYPE_SURFACE_KHR:
return (uint64_t) wine_surface_from_handle(handle)->base.surface;
return (uint64_t) wine_surface_from_handle(handle)->surface;
default:
return handle;
}

View file

@ -21,6 +21,7 @@ VkResult WINAPI wine_vkCreateCommandPool(VkDevice device, const VkCommandPoolCre
VkResult WINAPI wine_vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice);
VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain);
VkResult WINAPI wine_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
VkResult WINAPI wine_vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN;
@ -53,6 +54,7 @@ void WINAPI wine_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
void WINAPI wine_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities);
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats);
void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t *pData) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
VkResult WINAPI wine_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
@ -61,6 +63,7 @@ VkResult WINAPI wine_vkSetPrivateDataEXT(VkDevice device, VkObjectType objectTyp
void WINAPI wine_vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) DECLSPEC_HIDDEN;
/* Private thunks */
VkResult thunk_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) DECLSPEC_HIDDEN;
VkResult thunk_vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
VkResult thunk_vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
@ -69,6 +72,7 @@ void thunk_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhy
void thunk_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) DECLSPEC_HIDDEN;
VkResult thunk_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats) DECLSPEC_HIDDEN;
VkResult thunk_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN;
VkResult thunk_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN;
void thunk_vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) DECLSPEC_HIDDEN;

View file

@ -99,7 +99,7 @@ static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance, const char *n
static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle)
{
return vulkan_driver_get_surface_data(handle);
return (struct wine_vk_surface *)(uintptr_t)handle;
}
static void *vulkan_handle;
@ -324,7 +324,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
XSaveContext(gdi_display, (XID)create_info->hwnd, vulkan_hwnd_context, (char *)wine_vk_surface_grab(x11_surface));
LeaveCriticalSection(&context_section);
vulkan_driver_init_surface(*surface, x11_surface->surface, x11_surface);
*surface = (uintptr_t)x11_surface;
TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*surface));
return VK_SUCCESS;
@ -601,6 +601,15 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
return res;
}
static VkSurfaceKHR X11DRV_wine_get_native_surface(VkSurfaceKHR surface)
{
struct wine_vk_surface *x11_surface = surface_from_handle(surface);
TRACE("0x%s\n", wine_dbgstr_longlong(surface));
return x11_surface->surface;
}
static const struct vulkan_funcs vulkan_funcs =
{
X11DRV_vkCreateInstance,
@ -623,6 +632,8 @@ static const struct vulkan_funcs vulkan_funcs =
X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR,
X11DRV_vkGetSwapchainImagesKHR,
X11DRV_vkQueuePresentKHR,
X11DRV_wine_get_native_surface,
};
static void *X11DRV_get_vk_device_proc_addr(const char *name)

View file

@ -13,7 +13,7 @@
#define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */
#define WINE_VULKAN_DRIVER_VERSION 9
#define WINE_VULKAN_DRIVER_VERSION 10
struct vulkan_funcs
{
@ -41,6 +41,9 @@ struct vulkan_funcs
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t);
VkResult (*p_vkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *);
VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *);
/* winevulkan specific functions */
VkSurfaceKHR (*p_wine_get_native_surface)(VkSurfaceKHR);
};
extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(HDC hdc, UINT version);
@ -112,30 +115,4 @@ static inline void *get_vulkan_driver_instance_proc_addr(
return get_vulkan_driver_device_proc_addr(vulkan_funcs, name);
}
struct wine_surface_base
{
VkSurfaceKHR surface; /* native surface */
void *driver_data;
};
static inline void vulkan_driver_init_surface(
VkSurfaceKHR surface, VkSurfaceKHR native_surface, void *data)
{
struct wine_surface_base *object = (void *)(uintptr_t)surface;
object->surface = native_surface;
object->driver_data = data;
};
static inline VkSurfaceKHR vulkan_driver_get_native_surface(VkSurfaceKHR surface)
{
struct wine_surface_base *object = (void *)(uintptr_t)surface;
return object->surface;
};
static inline void *vulkan_driver_get_surface_data(VkSurfaceKHR surface)
{
struct wine_surface_base *object = (void *)(uintptr_t)surface;
return object->driver_data;
};
#endif /* __WINE_VULKAN_DRIVER_H */