vulkan-1/tests: Consider vkGetPhysicalDevicePresentRectanglesKHR absence in test_null_hwnd().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2021-05-07 14:31:01 +03:00 committed by Alexandre Julliard
parent b44fb883b0
commit 4ac1c48e9d
1 changed files with 30 additions and 15 deletions

View File

@ -441,11 +441,13 @@ static const char *test_null_hwnd_extensions[] =
{
"VK_KHR_surface",
"VK_KHR_win32_surface",
"VK_KHR_device_group_creation",
};
static void test_null_hwnd(VkInstance vk_instance, VkPhysicalDevice vk_physical_device)
{
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR pvkGetPhysicalDeviceSurfacePresentModesKHR;
PFN_vkGetPhysicalDevicePresentRectanglesKHR pvkGetPhysicalDevicePresentRectanglesKHR;
VkDeviceGroupPresentModeFlagsKHR present_mode_flags;
VkWin32SurfaceCreateInfoKHR surface_create_info;
VkSurfaceCapabilitiesKHR surf_caps;
@ -461,6 +463,9 @@ static void test_null_hwnd(VkInstance vk_instance, VkPhysicalDevice vk_physical_
pvkGetPhysicalDeviceSurfacePresentModesKHR = (void *)vkGetInstanceProcAddr(vk_instance,
"vkGetPhysicalDeviceSurfacePresentModesKHR");
pvkGetPhysicalDevicePresentRectanglesKHR = (void *)vkGetInstanceProcAddr(vk_instance,
"vkGetPhysicalDevicePresentRectanglesKHR");
surface_create_info.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
surface_create_info.pNext = NULL;
surface_create_info.flags = 0;
@ -499,25 +504,35 @@ static void test_null_hwnd(VkInstance vk_instance, VkPhysicalDevice vk_physical_
ok(vr == VK_SUCCESS, "Got unexpected vr %d.\n", vr);
heap_free(modes);
count = 0;
vr = vkGetPhysicalDevicePresentRectanglesKHR(vk_physical_device, surface, &count, NULL);
ok(vr == VK_SUCCESS, "Got unexpected vr %d.\n", vr);
ok(count == 1, "Got unexpected count %u.\n", count);
memset(&rect, 0xcc, sizeof(rect));
vr = vkGetPhysicalDevicePresentRectanglesKHR(vk_physical_device, surface, &count, &rect);
if (vr == VK_SUCCESS) /* Fails on AMD, succeeds on Nvidia. */
if (pvkGetPhysicalDevicePresentRectanglesKHR)
{
count = 0;
vr = pvkGetPhysicalDevicePresentRectanglesKHR(vk_physical_device, surface, &count, NULL);
ok(vr == VK_SUCCESS, "Got unexpected vr %d.\n", vr);
ok(count == 1, "Got unexpected count %u.\n", count);
ok(!rect.offset.x && !rect.offset.y && !rect.extent.width && !rect.extent.height,
"Got unexpected rect %d, %d, %u, %u.\n",
rect.offset.x, rect.offset.y, rect.extent.width, rect.extent.height);
}
memset(&rect, 0xcc, sizeof(rect));
vr = pvkGetPhysicalDevicePresentRectanglesKHR(vk_physical_device, surface, &count, &rect);
if (vr == VK_SUCCESS) /* Fails on AMD, succeeds on Nvidia. */
{
ok(count == 1, "Got unexpected count %u.\n", count);
ok(!rect.offset.x && !rect.offset.y && !rect.extent.width && !rect.extent.height,
"Got unexpected rect %d, %d, %u, %u.\n",
rect.offset.x, rect.offset.y, rect.extent.width, rect.extent.height);
}
if ((vr = create_device(vk_physical_device, 0, NULL, NULL, &vk_device)) < 0)
if ((vr = create_device(vk_physical_device, 0, NULL, NULL, &vk_device)) < 0)
{
skip("Failed to create device, vr %d.\n", vr);
vkDestroySurfaceKHR(vk_instance, surface, NULL);
return;
}
}
else
{
skip("Failed to create device, vr %d.\n", vr);
vkDestroySurfaceKHR(vk_instance, surface, NULL);
return;
/* The function should be available in practice with VK_KHR_device_group_creation, but spec lists
* it as a part of VK_KHR_device_group device extension which we don't check, so consider the
* absence of the function. */
win_skip("pvkGetPhysicalDevicePresentRectanglesKHR is no available.\n");
}
if (0)