]> O.S.I.I.S - jp/vkhelpers.git/commitdiff
use first phy if only one present
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 3 Apr 2018 02:13:40 +0000 (04:13 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 3 Apr 2018 02:13:40 +0000 (04:13 +0200)
src/vkhelpers.c

index 1e1104a8a505c62b15eba8616522ca2745a88829..257a0ee5766b973dc34d8cafc8898253a16fbb92 100644 (file)
@@ -5,11 +5,12 @@ VkPhysicalDevice vkh_find_phy (VkInstance inst, VkPhysicalDeviceType phyType) {
     uint32_t gpu_count = 0;
 
     VK_CHECK_RESULT(vkEnumeratePhysicalDevices (inst, &gpu_count, NULL));
-
     VkPhysicalDevice phys[gpu_count];
-
     VK_CHECK_RESULT(vkEnumeratePhysicalDevices (inst, &gpu_count, &phys));
 
+    if (gpu_count == 1)
+        return phys[0];
+
     for (int i=0; i<gpu_count; i++){
         VkPhysicalDeviceProperties phy;
         vkGetPhysicalDeviceProperties (phys[i], &phy);