Commit 844d4cd2 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winevulkan: Return VK_ERROR_SURFACE_LOST_KHR from surface functions.

parent 982c2ede
...@@ -635,11 +635,8 @@ static void test_win32_surface_hwnd(VkInstance vk_instance, VkPhysicalDevice vk_ ...@@ -635,11 +635,8 @@ static void test_win32_surface_hwnd(VkInstance vk_instance, VkPhysicalDevice vk_
if (IsWindow(hwnd)) if (IsWindow(hwnd))
ok(vr == VK_SUCCESS, "Got unexpected vr %d.\n", vr); ok(vr == VK_SUCCESS, "Got unexpected vr %d.\n", vr);
else else
{
todo_wine
ok(vr == VK_ERROR_SURFACE_LOST_KHR /* Nvidia */ || vr == VK_ERROR_UNKNOWN /* AMD */, ok(vr == VK_ERROR_SURFACE_LOST_KHR /* Nvidia */ || vr == VK_ERROR_UNKNOWN /* AMD */,
"Got unexpected vr %d.\n", vr); "Got unexpected vr %d.\n", vr);
}
} }
count = 0; count = 0;
......
...@@ -1746,40 +1746,36 @@ static inline void adjust_max_image_count(struct wine_phys_dev *phys_dev, VkSurf ...@@ -1746,40 +1746,36 @@ static inline void adjust_max_image_count(struct wine_phys_dev *phys_dev, VkSurf
} }
} }
VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice handle, VkSurfaceKHR surface_handle, VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice device_handle, VkSurfaceKHR surface_handle,
VkSurfaceCapabilitiesKHR *capabilities) VkSurfaceCapabilitiesKHR *capabilities)
{ {
struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); struct wine_phys_dev *physical_device = wine_phys_dev_from_handle(device_handle);
struct wine_surface *surface = wine_surface_from_handle(surface_handle); struct wine_surface *surface = wine_surface_from_handle(surface_handle);
struct wine_instance *instance = physical_device->instance;
VkResult res; VkResult res;
res = phys_dev->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev->host_physical_device, if (!NtUserIsWindow(surface->hwnd)) return VK_ERROR_SURFACE_LOST_KHR;
surface->driver_surface, capabilities); res = instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device->host_physical_device,
surface->driver_surface, capabilities);
if (res == VK_SUCCESS) if (res == VK_SUCCESS) adjust_max_image_count(physical_device, capabilities);
adjust_max_image_count(phys_dev, capabilities);
return res; return res;
} }
VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice handle, VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice device_handle, const VkPhysicalDeviceSurfaceInfo2KHR *surface_info,
const VkPhysicalDeviceSurfaceInfo2KHR *surface_info,
VkSurfaceCapabilities2KHR *capabilities) VkSurfaceCapabilities2KHR *capabilities)
{ {
struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); struct wine_phys_dev *physical_device = wine_phys_dev_from_handle(device_handle);
struct wine_surface *surface = wine_surface_from_handle(surface_info->surface); struct wine_surface *surface = wine_surface_from_handle(surface_info->surface);
VkPhysicalDeviceSurfaceInfo2KHR host_info; VkPhysicalDeviceSurfaceInfo2KHR surface_info_host = *surface_info;
struct wine_instance *instance = physical_device->instance;
VkResult res; VkResult res;
host_info.sType = surface_info->sType; surface_info_host.surface = surface->driver_surface;
host_info.pNext = surface_info->pNext;
host_info.surface = surface->driver_surface;
res = phys_dev->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev->host_physical_device,
&host_info, capabilities);
if (res == VK_SUCCESS)
adjust_max_image_count(phys_dev, &capabilities->surfaceCapabilities);
if (!NtUserIsWindow(surface->hwnd)) return VK_ERROR_SURFACE_LOST_KHR;
res = instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilities2KHR(physical_device->host_physical_device,
&surface_info_host, capabilities);
if (res == VK_SUCCESS) adjust_max_image_count(physical_device, &capabilities->surfaceCapabilities);
return res; return res;
} }
......
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