[PATCH] vulkan-1/tests: Consider vkGetPhysicalDevicePresentRectanglesKHR absense in test_null_hwnd().

Paul Gofman pgofman at codeweavers.com
Fri May 7 06:31:01 CDT 2021


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
 dlls/vulkan-1/tests/vulkan.c | 45 ++++++++++++++++++++++++------------
 1 file changed, 30 insertions(+), 15 deletions(-)

diff --git a/dlls/vulkan-1/tests/vulkan.c b/dlls/vulkan-1/tests/vulkan.c
index e516d0d61c8..1d23c4112cf 100644
--- a/dlls/vulkan-1/tests/vulkan.c
+++ b/dlls/vulkan-1/tests/vulkan.c
@@ -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)
-- 
2.31.1




More information about the wine-devel mailing list