mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Add window surface creation to glfwinfo
The glfwinfo tool now attempts Vulkan surface creation via glfwCreateWindowSurface and reports the results.
This commit is contained in:
parent
4c90e21e8f
commit
0beadfdc66
@ -850,6 +850,17 @@ int main(int argc, char** argv)
|
|||||||
if (list_extensions)
|
if (list_extensions)
|
||||||
list_context_extensions(client, major, minor);
|
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",
|
printf("Vulkan loader: %s\n",
|
||||||
glfwVulkanSupported() ? "available" : "missing");
|
glfwVulkanSupported() ? "available" : "missing");
|
||||||
|
|
||||||
@ -873,15 +884,14 @@ int main(int argc, char** argv)
|
|||||||
uint32_t re_count;
|
uint32_t re_count;
|
||||||
const char** re = glfwGetRequiredInstanceExtensions(&re_count);
|
const char** re = glfwGetRequiredInstanceExtensions(&re_count);
|
||||||
|
|
||||||
printf("Vulkan required instance extensions:");
|
|
||||||
if (re)
|
if (re)
|
||||||
{
|
{
|
||||||
|
printf("Vulkan window surface required instance extensions:\n");
|
||||||
for (uint32_t i = 0; i < re_count; i++)
|
for (uint32_t i = 0; i < re_count; i++)
|
||||||
printf(" %s", re[i]);
|
printf(" %s\n", re[i]);
|
||||||
putchar('\n');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf(" missing\n");
|
printf("Vulkan window surface extensions missing\n");
|
||||||
|
|
||||||
if (list_extensions)
|
if (list_extensions)
|
||||||
list_vulkan_instance_extensions();
|
list_vulkan_instance_extensions();
|
||||||
@ -915,6 +925,19 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance);
|
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance);
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t pd_count;
|
uint32_t pd_count;
|
||||||
vkEnumeratePhysicalDevices(instance, &pd_count, NULL);
|
vkEnumeratePhysicalDevices(instance, &pd_count, NULL);
|
||||||
VkPhysicalDevice* pd = calloc(pd_count, sizeof(VkPhysicalDevice));
|
VkPhysicalDevice* pd = calloc(pd_count, sizeof(VkPhysicalDevice));
|
||||||
@ -943,6 +966,8 @@ int main(int argc, char** argv)
|
|||||||
vkDestroyInstance(instance, NULL);
|
vkDestroyInstance(instance, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glfwDestroyWindow(window);
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user