misc: Change vkEnumerateGpus to vkEnumeratePhysicalDevices

Conflicts:
	loader/loader.h
diff --git a/tests/image_tests.cpp b/tests/image_tests.cpp
index d2b2e69..326a8c8 100644
--- a/tests/image_tests.cpp
+++ b/tests/image_tests.cpp
@@ -63,6 +63,8 @@
 #include "vktestbinding.h"
 #include "test_common.h"
 
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
 class VkImageTest : public ::testing::Test {
 public:
     void CreateImage(uint32_t w, uint32_t h);
@@ -76,7 +78,7 @@
 protected:
     vk_testing::Device *m_device;
     VkApplicationInfo app_info;
-    VkPhysicalGpu objs[VK_MAX_PHYSICAL_GPUS];
+    VkPhysicalGpu objs[16];
     uint32_t gpu_count;
     VkInstance inst;
     VkImage m_image;
@@ -102,8 +104,10 @@
         inst_info.ppEnabledExtensionNames = NULL;
         err = vkCreateInstance(&inst_info, &this->inst);
         ASSERT_VK_SUCCESS(err);
-        err = vkEnumerateGpus(this->inst, VK_MAX_PHYSICAL_GPUS,
-                               &this->gpu_count, objs);
+        err = vkEnumeratePhysicalDevices(this->inst, &this->gpu_count, NULL);
+        ASSERT_VK_SUCCESS(err);
+        ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs";
+        err = vkEnumeratePhysicalDevices(this->inst, &this->gpu_count, objs);
         ASSERT_VK_SUCCESS(err);
         ASSERT_GE(this->gpu_count, 1) << "No GPU available";
 
diff --git a/tests/init.cpp b/tests/init.cpp
index 554b9c8..de02b34 100644
--- a/tests/init.cpp
+++ b/tests/init.cpp
@@ -65,6 +65,8 @@
 #include "test_common.h"
 #include "icd-spv.h"
 
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
 class XglTest : public ::testing::Test {
 public:
     void CreateImageTest();
@@ -78,7 +80,7 @@
 protected:
     VkApplicationInfo app_info;
     VkInstance inst;
-    VkPhysicalGpu objs[VK_MAX_PHYSICAL_GPUS];
+    VkPhysicalGpu objs[16];
     uint32_t gpu_count;
 
     uint32_t m_device_id;
@@ -107,8 +109,10 @@
         inst_info.ppEnabledExtensionNames = NULL;
         err = vkCreateInstance(&inst_info, &inst);
         ASSERT_VK_SUCCESS(err);
-        err = vkEnumerateGpus(inst, VK_MAX_PHYSICAL_GPUS, &this->gpu_count,
-                               objs);
+        err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, NULL);
+        ASSERT_VK_SUCCESS(err);
+        ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs";
+        err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, objs);
         ASSERT_VK_SUCCESS(err);
         ASSERT_GE(this->gpu_count, 1) << "No GPU available";
 
@@ -136,7 +140,7 @@
 TEST(Initialization, vkEnumerateGpus) {
     VkApplicationInfo app_info = {};
     VkInstance inst;
-    VkPhysicalGpu objs[VK_MAX_PHYSICAL_GPUS];
+    VkPhysicalGpu objs[16];
     uint32_t gpu_count;
     VkResult err;
     vk_testing::PhysicalGpu *gpu;
@@ -160,7 +164,10 @@
 
     err = vkCreateInstance(&inst_info, &inst);
     ASSERT_VK_SUCCESS(err);
-    err = vkEnumerateGpus(inst, VK_MAX_PHYSICAL_GPUS, &gpu_count, objs);
+    err = vkEnumeratePhysicalDevices(inst, &gpu_count, NULL);
+    ASSERT_VK_SUCCESS(err);
+    ASSERT_LE(gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs";
+    err = vkEnumeratePhysicalDevices(inst, &gpu_count, objs);
     ASSERT_VK_SUCCESS(err);
     ASSERT_GE(gpu_count, 1) << "No GPU available";
 
diff --git a/tests/test_environment.cpp b/tests/test_environment.cpp
index 6d34cf7..03beb12 100644
--- a/tests/test_environment.cpp
+++ b/tests/test_environment.cpp
@@ -60,7 +60,10 @@
     inst_info.ppEnabledExtensionNames = NULL;
     err = vkCreateInstance(&inst_info, &inst);
     ASSERT_EQ(VK_SUCCESS, err);
-    err = vkEnumerateGpus(inst, ARRAY_SIZE(gpus), &count, gpus);
+    err = vkEnumeratePhysicalDevices(inst, &count, NULL);
+    ASSERT_EQ(VK_SUCCESS, err);
+    ASSERT_LE(count, ARRAY_SIZE(gpus));
+    err = vkEnumeratePhysicalDevices(inst, &count, gpus);
     ASSERT_EQ(VK_SUCCESS, err);
     ASSERT_GT(count, default_dev_);
 
@@ -92,7 +95,10 @@
 
     err = vkCreateInstance(&instInfo, &inst);
     ASSERT_EQ(VK_SUCCESS, err);
-    err = vkEnumerateGpus(inst, ARRAY_SIZE(gpus), &count, gpus);
+    err = vkEnumeratePhysicalDevices(inst, &count, NULL);
+    ASSERT_EQ(VK_SUCCESS, err);
+    ASSERT_LE(count, ARRAY_SIZE(gpus));
+    err = vkEnumeratePhysicalDevices(inst, &count, gpus);
     ASSERT_EQ(VK_SUCCESS, err);
     ASSERT_GT(count, default_dev_);
 
diff --git a/tests/test_environment.h b/tests/test_environment.h
index b2ab934..2081992 100644
--- a/tests/test_environment.h
+++ b/tests/test_environment.h
@@ -18,7 +18,7 @@
 
     const std::vector<Device *> &devices() { return devs_; }
     Device &default_device() { return *(devs_[default_dev_]); }
-    VkPhysicalGpu gpus[VK_MAX_PHYSICAL_GPUS];
+    VkPhysicalGpu gpus[16];
 
 private:
     VkApplicationInfo app_;
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index 42ed4fe..6c1de3b 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -27,6 +27,8 @@
 
 #include "vkrenderframework.h"
 
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
 VkRenderFramework::VkRenderFramework() :
     m_cmdBuffer( VK_NULL_HANDLE ),
     m_renderPass(VK_NULL_HANDLE),
@@ -68,8 +70,10 @@
     instInfo.ppEnabledExtensionNames = NULL;
     err = vkCreateInstance(&instInfo, &this->inst);
     ASSERT_VK_SUCCESS(err);
-    err = vkEnumerateGpus(inst, VK_MAX_PHYSICAL_GPUS, &this->gpu_count,
-                           objs);
+    err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, NULL);
+    ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many gpus";
+    ASSERT_VK_SUCCESS(err);
+    err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, objs);
     ASSERT_VK_SUCCESS(err);
     ASSERT_GE(this->gpu_count, 1) << "No GPU available";
 
diff --git a/tests/vkrenderframework.h b/tests/vkrenderframework.h
index 0c2777b..55a4769 100644
--- a/tests/vkrenderframework.h
+++ b/tests/vkrenderframework.h
@@ -100,7 +100,7 @@
 protected:
     VkApplicationInfo                    app_info;
     VkInstance                            inst;
-    VkPhysicalGpu                        objs[VK_MAX_PHYSICAL_GPUS];
+    VkPhysicalGpu                        objs[16];
     uint32_t                                gpu_count;
     VkDeviceObj                           *m_device;
     VkCmdBuffer                            m_cmdBuffer;