From 5f9e5f14e572a6c9f7ff4d54e2fd4d82632bc393 Mon Sep 17 00:00:00 2001 From: Jeremy Hayes Date: Wed, 9 Feb 2022 15:04:42 -0700 Subject: Make device selection output constistent Make vkcube print a string for device type, which is consistent with vkcubepp. --- cube/cube.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cube/cube.c b/cube/cube.c index 6bf8f4ac..e0d8a31a 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -292,6 +292,19 @@ void dumpVec4(const char *note, vec4 vector) { fflush(stdout); } +char const* to_string(VkPhysicalDeviceType const type) +{ + switch(type) + { + case VK_PHYSICAL_DEVICE_TYPE_OTHER: return "Other"; + case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: return "IntegratedGpu"; + case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: return "DiscreteGpu"; + case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: return "VirtualGpu"; + case VK_PHYSICAL_DEVICE_TYPE_CPU: return "Cpu"; + default: return "Unknown"; + } +} + typedef struct { VkImage image; VkCommandBuffer cmd; @@ -3419,8 +3432,8 @@ static void demo_init_vk(struct demo *demo) { { VkPhysicalDeviceProperties physicalDeviceProperties; vkGetPhysicalDeviceProperties(demo->gpu, &physicalDeviceProperties); - fprintf(stderr, "Selected GPU %d: %s, type: %u\n", demo->gpu_number, physicalDeviceProperties.deviceName, - physicalDeviceProperties.deviceType); + fprintf(stderr, "Selected GPU %d: %s, type: %s\n", demo->gpu_number, physicalDeviceProperties.deviceName, + to_string(physicalDeviceProperties.deviceType)); } free(physical_devices); -- cgit v1.2.3