1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

winevulkan: Handle invalid window in vkGetPhysicalDevicePresentRectanglesKHR.

This commit is contained in:
Rémi Bernon 2023-12-10 10:30:49 +01:00 committed by Alexandre Julliard
parent 9a1362695b
commit b541b9661a
5 changed files with 24 additions and 7 deletions

View file

@ -656,14 +656,10 @@ static void test_win32_surface_hwnd(VkInstance vk_instance, VkPhysicalDevice vk_
if (IsWindow(hwnd))
ok(vr == VK_SUCCESS, "Got unexpected vr %d.\n", vr);
else
{
todo_wine
ok(vr == VK_SUCCESS /* Nvidia */ || vr == VK_ERROR_UNKNOWN /* AMD */, "Got unexpected vr %d.\n", vr);
}
memset(&rect, 0xcc, sizeof(rect));
vr = pvkGetPhysicalDevicePresentRectanglesKHR(vk_physical_device, surface, &count, &rect);
todo_wine_if(!IsWindow(hwnd))
ok(vr == VK_SUCCESS /* Nvidia */ || vr == VK_ERROR_UNKNOWN /* AMD */, "Got unexpected vr %d.\n", vr);
if (vr == VK_SUCCESS)
{
@ -676,7 +672,7 @@ static void test_win32_surface_hwnd(VkInstance vk_instance, VkPhysicalDevice vk_
};
ok(count == 1, "Got unexpected count %u.\n", count);
todo_wine_if(IsRectEmpty(&client_rect))
todo_wine_if(IsWindow(hwnd) && IsRectEmpty(&client_rect))
ok(EqualRect(&tmp_rect, &client_rect), "Got unexpected rect %s.\n", wine_dbgstr_rect(&tmp_rect));
}

View file

@ -259,6 +259,7 @@ MANUAL_UNIX_THUNKS = {
"vkGetPhysicalDeviceExternalSemaphorePropertiesKHR",
"vkGetPhysicalDeviceImageFormatProperties2",
"vkGetPhysicalDeviceImageFormatProperties2KHR",
"vkGetPhysicalDevicePresentRectanglesKHR",
"vkGetPhysicalDeviceSurfaceCapabilities2KHR",
"vkGetPhysicalDeviceSurfaceCapabilitiesKHR",
"vkMapMemory",

View file

@ -1920,6 +1920,25 @@ VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice device
return res;
}
VkResult wine_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice device_handle, VkSurfaceKHR surface_handle,
uint32_t *rect_count, VkRect2D *rects)
{
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_instance *instance = physical_device->instance;
if (!NtUserIsWindow(surface->hwnd))
{
if (rects && !*rect_count) return VK_INCOMPLETE;
if (rects) memset(rects, 0, sizeof(VkRect2D));
*rect_count = 1;
return VK_SUCCESS;
}
return instance->funcs.p_vkGetPhysicalDevicePresentRectanglesKHR(physical_device->host_physical_device,
surface->driver_surface, rect_count, rects);
}
VkResult wine_vkCreateDebugUtilsMessengerEXT(VkInstance handle,
const VkDebugUtilsMessengerCreateInfoEXT *create_info,
const VkAllocationCallbacks *allocator,

View file

@ -43065,7 +43065,7 @@ static NTSTATUS thunk64_vkGetPhysicalDevicePresentRectanglesKHR(void *args)
TRACE("%p, 0x%s, %p, %p\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pRectCount, params->pRects);
params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDevicePresentRectanglesKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, wine_surface_from_handle(params->surface)->driver_surface, params->pRectCount, params->pRects);
params->result = wine_vkGetPhysicalDevicePresentRectanglesKHR(params->physicalDevice, params->surface, params->pRectCount, params->pRects);
return STATUS_SUCCESS;
}
#endif /* _WIN64 */
@ -43083,7 +43083,7 @@ static NTSTATUS thunk32_vkGetPhysicalDevicePresentRectanglesKHR(void *args)
TRACE("%#x, 0x%s, %#x, %#x\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pRectCount, params->pRects);
params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDevicePresentRectanglesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, wine_surface_from_handle(params->surface)->driver_surface, (uint32_t *)UlongToPtr(params->pRectCount), (VkRect2D *)UlongToPtr(params->pRects));
params->result = wine_vkGetPhysicalDevicePresentRectanglesKHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), params->surface, (uint32_t *)UlongToPtr(params->pRectCount), (VkRect2D *)UlongToPtr(params->pRects));
return STATUS_SUCCESS;
}

View file

@ -58,6 +58,7 @@ void wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physic
void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties);
VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties);
VkResult wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties);
VkResult wine_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pRectCount, VkRect2D *pRects);
VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities);
VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
VkResult wine_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData);