mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 03:52:01 +00:00
Simplify glfwinfo Vulkan enumerations
This commit is contained in:
parent
fa025d8f80
commit
144c98bcb3
@ -212,16 +212,9 @@ static void list_vulkan_instance_extensions(void)
|
|||||||
printf("Vulkan instance extensions:\n");
|
printf("Vulkan instance extensions:\n");
|
||||||
|
|
||||||
uint32_t ep_count;
|
uint32_t ep_count;
|
||||||
if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL) != VK_SUCCESS)
|
vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL);
|
||||||
return;
|
|
||||||
|
|
||||||
VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
|
VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
|
||||||
|
vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep);
|
||||||
if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep) != VK_SUCCESS)
|
|
||||||
{
|
|
||||||
free(ep);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < ep_count; i++)
|
for (uint32_t i = 0; i < ep_count; i++)
|
||||||
printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
|
printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
|
||||||
@ -234,16 +227,9 @@ static void list_vulkan_instance_layers(void)
|
|||||||
printf("Vulkan instance layers:\n");
|
printf("Vulkan instance layers:\n");
|
||||||
|
|
||||||
uint32_t lp_count;
|
uint32_t lp_count;
|
||||||
if (vkEnumerateInstanceLayerProperties(&lp_count, NULL) != VK_SUCCESS)
|
vkEnumerateInstanceLayerProperties(&lp_count, NULL);
|
||||||
return;
|
|
||||||
|
|
||||||
VkLayerProperties* lp = calloc(lp_count, sizeof(VkLayerProperties));
|
VkLayerProperties* lp = calloc(lp_count, sizeof(VkLayerProperties));
|
||||||
|
vkEnumerateInstanceLayerProperties(&lp_count, lp);
|
||||||
if (vkEnumerateInstanceLayerProperties(&lp_count, lp) != VK_SUCCESS)
|
|
||||||
{
|
|
||||||
free(lp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < lp_count; i++)
|
for (uint32_t i = 0; i < lp_count; i++)
|
||||||
{
|
{
|
||||||
@ -261,16 +247,9 @@ static void list_vulkan_device_extensions(VkInstance instance, VkPhysicalDevice
|
|||||||
printf("Vulkan device extensions:\n");
|
printf("Vulkan device extensions:\n");
|
||||||
|
|
||||||
uint32_t ep_count;
|
uint32_t ep_count;
|
||||||
if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, NULL) != VK_SUCCESS)
|
vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, NULL);
|
||||||
return;
|
|
||||||
|
|
||||||
VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
|
VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
|
||||||
|
vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, ep);
|
||||||
if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, ep) != VK_SUCCESS)
|
|
||||||
{
|
|
||||||
free(ep);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < ep_count; i++)
|
for (uint32_t i = 0; i < ep_count; i++)
|
||||||
printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
|
printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
|
||||||
@ -283,16 +262,9 @@ static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice devi
|
|||||||
printf("Vulkan device layers:\n");
|
printf("Vulkan device layers:\n");
|
||||||
|
|
||||||
uint32_t lp_count;
|
uint32_t lp_count;
|
||||||
if (vkEnumerateDeviceLayerProperties(device, &lp_count, NULL) != VK_SUCCESS)
|
vkEnumerateDeviceLayerProperties(device, &lp_count, NULL);
|
||||||
return;
|
|
||||||
|
|
||||||
VkLayerProperties* lp = calloc(lp_count, sizeof(VkLayerProperties));
|
VkLayerProperties* lp = calloc(lp_count, sizeof(VkLayerProperties));
|
||||||
|
vkEnumerateDeviceLayerProperties(device, &lp_count, lp);
|
||||||
if (vkEnumerateDeviceLayerProperties(device, &lp_count, lp) != VK_SUCCESS)
|
|
||||||
{
|
|
||||||
free(lp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < lp_count; i++)
|
for (uint32_t i = 0; i < lp_count; i++)
|
||||||
{
|
{
|
||||||
@ -859,22 +831,9 @@ int main(int argc, char** argv)
|
|||||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance);
|
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance);
|
||||||
|
|
||||||
uint32_t pd_count;
|
uint32_t pd_count;
|
||||||
if (vkEnumeratePhysicalDevices(instance, &pd_count, NULL) != VK_SUCCESS)
|
vkEnumeratePhysicalDevices(instance, &pd_count, NULL);
|
||||||
{
|
|
||||||
vkDestroyInstance(instance, NULL);
|
|
||||||
glfwTerminate();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPhysicalDevice* pd = calloc(pd_count, sizeof(VkPhysicalDevice));
|
VkPhysicalDevice* pd = calloc(pd_count, sizeof(VkPhysicalDevice));
|
||||||
|
vkEnumeratePhysicalDevices(instance, &pd_count, pd);
|
||||||
if (vkEnumeratePhysicalDevices(instance, &pd_count, pd) != VK_SUCCESS)
|
|
||||||
{
|
|
||||||
free(pd);
|
|
||||||
vkDestroyInstance(instance, NULL);
|
|
||||||
glfwTerminate();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < pd_count; i++)
|
for (uint32_t i = 0; i < pd_count; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user