mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Add window surface creation to glfwinfo
The glfwinfo tool now attempts Vulkan surface creation via
glfwCreateWindowSurface and reports the results.
(cherry picked from commit 0beadfdc66
)
This commit is contained in:
parent
05e28537a3
commit
c7a5333873
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user