From c7a53338733fad040814fb5d6d9180921e7a107b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 11 Apr 2021 21:26:27 +0200 Subject: [PATCH] Add window surface creation to glfwinfo The glfwinfo tool now attempts Vulkan surface creation via glfwCreateWindowSurface and reports the results. (cherry picked from commit 0beadfdc667622d59b173ccce8674dc1ff12bb90) --- tests/glfwinfo.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index f681e0a5..e3163698 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -753,6 +753,17 @@ int main(int argc, char** argv) if (list_extensions) list_context_extensions(client, major, minor); + glfwDestroyWindow(window); + + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + + window = glfwCreateWindow(200, 200, "Version", NULL, NULL); + if (!window) + { + glfwTerminate(); + exit(EXIT_FAILURE); + } + printf("Vulkan loader: %s\n", glfwVulkanSupported() ? "available" : "missing"); @@ -851,6 +862,19 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); } + if (re) + { + VkSurfaceKHR surface = VK_NULL_HANDLE; + + if (glfwCreateWindowSurface(instance, window, NULL, &surface) == VK_SUCCESS) + { + printf("Vulkan window surface created successfully\n"); + vkDestroySurfaceKHR(instance, surface, NULL); + } + else + printf("Failed to create Vulkan window surface\n"); + } + free((void*) re); gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance); @@ -937,6 +961,8 @@ int main(int argc, char** argv) vkDestroyInstance(instance, NULL); } + glfwDestroyWindow(window); + glfwTerminate(); exit(EXIT_SUCCESS); }