From 7a8d75b7ace117640745028cf8febcb7bbac7b9b Mon Sep 17 00:00:00 2001 From: Nicolas Caramelli Date: Fri, 11 Oct 2024 11:26:46 +0200 Subject: [PATCH] Add support to test the vulkan example on CPU --- examples/vulkan/Vulkan.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/vulkan/Vulkan.cpp b/examples/vulkan/Vulkan.cpp index 1b0d40e21..9a42cc5e4 100644 --- a/examples/vulkan/Vulkan.cpp +++ b/examples/vulkan/Vulkan.cpp @@ -563,6 +563,8 @@ public: return; } + VkPhysicalDeviceType deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER; + // Look for a GPU that supports swapchains for (VkPhysicalDevice dev : devices) { @@ -607,7 +609,14 @@ public: } if (deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) { - gpu = dev; + gpu = dev; + deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; + } + else if ((deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU) && + (deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)) + { + gpu = dev; + deviceType = VK_PHYSICAL_DEVICE_TYPE_CPU; } }