Commit 50584bcc authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winevulkan: Pass win32u surface wrappers for each vkQueuePresent swapchain.

parent d054ccc8
...@@ -52,6 +52,7 @@ struct surface ...@@ -52,6 +52,7 @@ struct surface
{ {
VkSurfaceKHR host_surface; VkSurfaceKHR host_surface;
VkSurfaceKHR driver_surface; VkSurfaceKHR driver_surface;
HWND hwnd;
}; };
static inline struct surface *surface_from_handle( VkSurfaceKHR handle ) static inline struct surface *surface_from_handle( VkSurfaceKHR handle )
...@@ -80,6 +81,7 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin ...@@ -80,6 +81,7 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin
return res; return res;
} }
surface->hwnd = info->hwnd;
surface->host_surface = driver_funcs->p_wine_get_host_surface( surface->driver_surface ); surface->host_surface = driver_funcs->p_wine_get_host_surface( surface->driver_surface );
*handle = surface_to_handle( surface ); *handle = surface_to_handle( surface );
return VK_SUCCESS; return VK_SUCCESS;
...@@ -96,20 +98,21 @@ static void win32u_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR handle ...@@ -96,20 +98,21 @@ static void win32u_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR handle
free( surface ); free( surface );
} }
static VkResult win32u_vkQueuePresentKHR( VkQueue queue, const VkPresentInfoKHR *present_info, HWND *surfaces ) static VkResult win32u_vkQueuePresentKHR( VkQueue queue, const VkPresentInfoKHR *present_info, VkSurfaceKHR *surfaces )
{ {
VkPresentInfoKHR host_present_info = *present_info;
VkResult res; VkResult res;
UINT i; UINT i;
TRACE( "queue %p, present_info %p\n", queue, present_info ); TRACE( "queue %p, present_info %p\n", queue, present_info );
res = p_vkQueuePresentKHR( queue, &host_present_info ); res = p_vkQueuePresentKHR( queue, present_info );
for (i = 0; i < present_info->swapchainCount; i++) for (i = 0; i < present_info->swapchainCount; i++)
{ {
VkResult swapchain_res = present_info->pResults ? present_info->pResults[i] : res; VkResult swapchain_res = present_info->pResults ? present_info->pResults[i] : res;
driver_funcs->p_vulkan_surface_presented( surfaces[i], swapchain_res ); struct surface *surface = surface_from_handle( surfaces[i] );
driver_funcs->p_vulkan_surface_presented( surface->hwnd, swapchain_res );
} }
return res; return res;
......
...@@ -1740,7 +1740,7 @@ void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR swapchain ...@@ -1740,7 +1740,7 @@ void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR swapchain
VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *present_info) VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *present_info)
{ {
VkSwapchainKHR swapchains_buffer[16], *swapchains = swapchains_buffer; VkSwapchainKHR swapchains_buffer[16], *swapchains = swapchains_buffer;
HWND surfaces_buffer[ARRAY_SIZE(swapchains_buffer)], *surfaces = surfaces_buffer; VkSurfaceKHR surfaces_buffer[ARRAY_SIZE(swapchains_buffer)], *surfaces = surfaces_buffer;
struct wine_queue *queue = wine_queue_from_handle(queue_handle); struct wine_queue *queue = wine_queue_from_handle(queue_handle);
VkPresentInfoKHR present_info_host = *present_info; VkPresentInfoKHR present_info_host = *present_info;
VkResult res; VkResult res;
...@@ -1759,7 +1759,7 @@ VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pr ...@@ -1759,7 +1759,7 @@ VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pr
struct wine_swapchain *swapchain = wine_swapchain_from_handle(present_info->pSwapchains[i]); struct wine_swapchain *swapchain = wine_swapchain_from_handle(present_info->pSwapchains[i]);
struct wine_surface *surface = swapchain->surface; struct wine_surface *surface = swapchain->surface;
swapchains[i] = swapchain->host_swapchain; swapchains[i] = swapchain->host_swapchain;
surfaces[i] = surface->hwnd; surfaces[i] = surface->driver_surface;
} }
present_info_host.pSwapchains = swapchains; present_info_host.pSwapchains = swapchains;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define __WINE_VULKAN_DRIVER_H #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ /* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */
#define WINE_VULKAN_DRIVER_VERSION 28 #define WINE_VULKAN_DRIVER_VERSION 29
struct vulkan_funcs struct vulkan_funcs
{ {
...@@ -34,7 +34,7 @@ struct vulkan_funcs ...@@ -34,7 +34,7 @@ struct vulkan_funcs
void * (*p_vkGetDeviceProcAddr)(VkDevice, const char *); void * (*p_vkGetDeviceProcAddr)(VkDevice, const char *);
void * (*p_vkGetInstanceProcAddr)(VkInstance, const char *); void * (*p_vkGetInstanceProcAddr)(VkInstance, const char *);
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t);
VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *, HWND *surfaces); VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *, VkSurfaceKHR *surfaces);
/* winevulkan specific functions */ /* winevulkan specific functions */
const char *(*p_get_host_surface_extension)(void); const char *(*p_get_host_surface_extension)(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment