Update tests to use correct version macro
authorCharles Giessen <charles@lunarg.com>
Wed, 26 Jan 2022 22:14:39 +0000 (15:14 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Fri, 28 Jan 2022 23:24:27 +0000 (16:24 -0700)
The VK_MAKE_API_VERSION macro and the VK_API_VERSION_1_X macros are better to
use. This commit switches the tests over to the non-deprecated versions of the
macros.

tests/framework/icd/test_icd.cpp
tests/framework/icd/test_icd.h
tests/framework/layer/layer_util.h
tests/framework/layer/test_layer.cpp
tests/framework/layer/test_layer.h
tests/framework/test_environment.h
tests/framework/test_util.h
tests/loader_wsi_tests.cpp

index 978429d..263e208 100644 (file)
@@ -150,7 +150,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceLayerProperties(uint32_t*
 
 VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceVersion(uint32_t* pApiVersion) {
     if (pApiVersion != nullptr) {
-        *pApiVersion = VK_MAKE_VERSION(1, 0, 0);
+        *pApiVersion = VK_API_VERSION_1_0;
     }
     return VK_SUCCESS;
 }
@@ -161,8 +161,8 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo*
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
 
-    if (icd.icd_api_version < VK_MAKE_VERSION(1, 1, 0)) {
-        if (pCreateInfo->pApplicationInfo->apiVersion > VK_MAKE_VERSION(1, 0, 0)) {
+    if (icd.icd_api_version < VK_API_VERSION_1_1) {
+        if (pCreateInfo->pApplicationInfo->apiVersion > VK_API_VERSION_1_0) {
             return VK_ERROR_INCOMPATIBLE_DRIVER;
         }
     }
@@ -910,7 +910,7 @@ VKAPI_ATTR void VKAPI_CALL test_vkGetPhysicalDeviceExternalFenceProperties(
 #define TO_VOID_PFN(func) reinterpret_cast<PFN_vkVoidFunction>(func)
 
 PFN_vkVoidFunction get_instance_func_ver_1_1(VkInstance instance, const char* pName) {
-    if (icd.icd_api_version >= VK_MAKE_VERSION(1, 1, 0)) {
+    if (icd.icd_api_version >= VK_API_VERSION_1_1) {
         if (string_eq(pName, "test_vkEnumerateInstanceVersion")) {
             return TO_VOID_PFN(test_vkEnumerateInstanceVersion);
         }
@@ -918,7 +918,7 @@ PFN_vkVoidFunction get_instance_func_ver_1_1(VkInstance instance, const char* pN
     return nullptr;
 }
 PFN_vkVoidFunction get_instance_func_ver_1_2(VkInstance instance, const char* pName) {
-    if (icd.icd_api_version >= VK_MAKE_VERSION(1, 2, 0)) {
+    if (icd.icd_api_version >= VK_API_VERSION_1_2) {
         return nullptr;
     }
     return nullptr;
index 831b941..dbcbb5f 100644 (file)
@@ -66,7 +66,7 @@ struct TestICD {
     BUILDER_VALUE(TestICD, bool, enable_icd_wsi, false);
     UsingICDProvidedWSI is_using_icd_wsi = UsingICDProvidedWSI::not_using;
 
-    BUILDER_VALUE(TestICD, uint32_t, icd_api_version, VK_MAKE_VERSION(1, 0, 0))
+    BUILDER_VALUE(TestICD, uint32_t, icd_api_version, VK_API_VERSION_1_0)
     BUILDER_VECTOR(TestICD, LayerDefinition, instance_layers, instance_layer)
     BUILDER_VECTOR(TestICD, Extension, instance_extensions, instance_extension)
 
index 332850d..b47add0 100644 (file)
 
 struct LayerDefinition {
     BUILDER_VALUE(LayerDefinition, std::string, layerName, {})
-    BUILDER_VALUE(LayerDefinition, uint32_t, specVersion, VK_MAKE_VERSION(1, 0, 0))
-    BUILDER_VALUE(LayerDefinition, uint32_t, implementationVersion, VK_MAKE_VERSION(1, 0, 0))
+    BUILDER_VALUE(LayerDefinition, uint32_t, specVersion, VK_API_VERSION_1_0)
+    BUILDER_VALUE(LayerDefinition, uint32_t, implementationVersion, VK_API_VERSION_1_0)
     BUILDER_VALUE(LayerDefinition, std::string, description, {})
     BUILDER_VECTOR(LayerDefinition, Extension, extensions, extension)
 
-    LayerDefinition(std::string layerName, uint32_t specVersion = VK_MAKE_VERSION(1, 0, 0),
-                    uint32_t implementationVersion = VK_MAKE_VERSION(1, 0, 0), std::string description = "",
+    LayerDefinition(std::string layerName, uint32_t specVersion = VK_API_VERSION_1_0,
+                    uint32_t implementationVersion = VK_API_VERSION_1_0, std::string description = "",
                     std::vector<Extension> extensions = {})
         : layerName(layerName),
           specVersion(specVersion),
index 5aa0def..5cf1aa1 100644 (file)
@@ -130,7 +130,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateDeviceExtensionProperties(VkPhysi
 
 VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceVersion(uint32_t* pApiVersion) {
     if (pApiVersion != nullptr) {
-        *pApiVersion = VK_MAKE_VERSION(1, 0, 0);
+        *pApiVersion = VK_API_VERSION_1_0;
     }
     return VK_SUCCESS;
 }
index 9ea2729..cb50300 100644 (file)
@@ -90,12 +90,12 @@ using FP_layer_callback = VkResult (*)(TestLayer& layer, void* data);
 
 struct TestLayer {
     fs::path manifest_file_path;
-    uint32_t manifest_version = VK_MAKE_VERSION(1, 1, 2);
+    uint32_t manifest_version = VK_MAKE_API_VERSION(0, 1, 1, 2);
 
     BUILDER_VALUE(TestLayer, bool, is_meta_layer, false)
 
     BUILDER_VALUE(TestLayer, std::string, unique_name, {})
-    BUILDER_VALUE(TestLayer, uint32_t, api_version, VK_MAKE_VERSION(1, 0, 0))
+    BUILDER_VALUE(TestLayer, uint32_t, api_version, VK_API_VERSION_1_0)
     BUILDER_VALUE(TestLayer, uint32_t, implementation_version, 2)
     BUILDER_VALUE(TestLayer, uint32_t, min_implementation_version, 0)
     BUILDER_VALUE(TestLayer, std::string, description, {})
index 9ddc10f..26257ff 100644 (file)
@@ -290,10 +290,10 @@ struct TestLayerHandle {
 };
 
 struct TestICDDetails {
-    TestICDDetails(fs::path icd_path, uint32_t api_version = VK_MAKE_VERSION(1, 0, 0)) noexcept
+    TestICDDetails(fs::path icd_path, uint32_t api_version = VK_API_VERSION_1_0) noexcept
         : icd_path(icd_path), api_version(api_version) {}
     BUILDER_VALUE(TestICDDetails, fs::path, icd_path, {});
-    BUILDER_VALUE(TestICDDetails, uint32_t, api_version, VK_MAKE_VERSION(1, 0, 0));
+    BUILDER_VALUE(TestICDDetails, uint32_t, api_version, VK_API_VERSION_1_0);
     BUILDER_VALUE(TestICDDetails, std::string, json_name, "test_icd");
     BUILDER_VALUE(TestICDDetails, bool, use_env_var_icd_filenames, false);
     BUILDER_VALUE(TestICDDetails, bool, is_fake, false);
index aeda2b7..2450895 100644 (file)
@@ -553,7 +553,7 @@ struct ManifestLayer {
         BUILDER_VALUE(LayerDescription, std::string, name, {})
         BUILDER_VALUE(LayerDescription, Type, type, Type::INSTANCE)
         BUILDER_VALUE(LayerDescription, fs::path, lib_path, {})
-        BUILDER_VALUE(LayerDescription, uint32_t, api_version, VK_MAKE_VERSION(1, 0, 0))
+        BUILDER_VALUE(LayerDescription, uint32_t, api_version, VK_API_VERSION_1_0)
         BUILDER_VALUE(LayerDescription, uint32_t, implementation_version, 0)
         BUILDER_VALUE(LayerDescription, std::string, description, {})
         BUILDER_VECTOR(LayerDescription, FunctionOverride, functions, function)
@@ -577,9 +577,9 @@ struct ManifestLayer {
 
 struct Extension {
     BUILDER_VALUE(Extension, std::string, extensionName, {})
-    BUILDER_VALUE(Extension, uint32_t, specVersion, VK_MAKE_VERSION(1, 0, 0))
+    BUILDER_VALUE(Extension, uint32_t, specVersion, VK_API_VERSION_1_0)
 
-    Extension(std::string extensionName, uint32_t specVersion = VK_MAKE_VERSION(1, 0, 0))
+    Extension(std::string extensionName, uint32_t specVersion = VK_API_VERSION_1_0)
         : extensionName(extensionName), specVersion(specVersion) {}
 
     VkExtensionProperties get() const noexcept {
@@ -720,7 +720,7 @@ struct InstanceCreateInfo {
     BUILDER_VALUE(InstanceCreateInfo, std::string, engine_name, {})
     BUILDER_VALUE(InstanceCreateInfo, uint32_t, app_version, 0)
     BUILDER_VALUE(InstanceCreateInfo, uint32_t, engine_version, 0)
-    BUILDER_VALUE(InstanceCreateInfo, uint32_t, api_version, VK_MAKE_VERSION(1, 0, 0))
+    BUILDER_VALUE(InstanceCreateInfo, uint32_t, api_version, VK_API_VERSION_1_0)
     BUILDER_VECTOR(InstanceCreateInfo, const char*, enabled_layers, layer)
     BUILDER_VECTOR(InstanceCreateInfo, const char*, enabled_extensions, extension)
     // tell the get() function to not provide `application_info`
index ce5c77d..8c9e309 100644 (file)
@@ -46,7 +46,7 @@ class WsiTests : public ::testing::Test {
 // When ICD doesn't support the extension, create instance should fail
 TEST_F(WsiTests, CreateSurfaceWin32NoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.enable_icd_wsi = false;
 
@@ -63,7 +63,7 @@ TEST_F(WsiTests, CreateSurfaceWin32NoICDSupport) {
 // When ICD doesn't support the surface creation, the loader should handle it
 TEST_F(WsiTests, CreateSurfaceWin32NoICDCreateSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME});
@@ -85,7 +85,7 @@ TEST_F(WsiTests, CreateSurfaceWin32NoICDCreateSupport) {
 // When ICD does support the surface creation, the loader should  delegat handle it to the ICD
 TEST_F(WsiTests, CreateSurfaceWin32ICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME});
@@ -135,7 +135,7 @@ TEST_F(WsiTests, CreateSurfaceWin32MixedICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceWin32PresentNoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME});
@@ -156,7 +156,7 @@ TEST_F(WsiTests, GetPhysicalDeviceWin32PresentNoICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceWin32PresentICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WIN32_SURFACE_EXTENSION_NAME});
@@ -180,7 +180,7 @@ TEST_F(WsiTests, GetPhysicalDeviceWin32PresentICDSupport) {
 // When ICD doesn't support the extension, create instance should fail
 TEST_F(WsiTests, CreateSurfaceXCBNoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.enable_icd_wsi = false;
 
@@ -197,7 +197,7 @@ TEST_F(WsiTests, CreateSurfaceXCBNoICDSupport) {
 // When ICD doesn't support the surface creation, the loader should handle it
 TEST_F(WsiTests, CreateSurfaceXCBNoICDCreateSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME});
@@ -219,7 +219,7 @@ TEST_F(WsiTests, CreateSurfaceXCBNoICDCreateSupport) {
 // When ICD does support the surface creation, the loader should  delegat handle it to the ICD
 TEST_F(WsiTests, CreateSurfaceXCBICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME});
@@ -269,7 +269,7 @@ TEST_F(WsiTests, CreateSurfaceXCBMixedICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceXcbPresentNoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME});
@@ -290,7 +290,7 @@ TEST_F(WsiTests, GetPhysicalDeviceXcbPresentNoICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceXcbPresentICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XCB_SURFACE_EXTENSION_NAME});
@@ -314,7 +314,7 @@ TEST_F(WsiTests, GetPhysicalDeviceXcbPresentICDSupport) {
 // When ICD doesn't support the extension, create instance should fail
 TEST_F(WsiTests, CreateSurfaceXLIBNoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.enable_icd_wsi = false;
 
@@ -331,7 +331,7 @@ TEST_F(WsiTests, CreateSurfaceXLIBNoICDSupport) {
 // When ICD doesn't support the surface creation, the loader should handle it
 TEST_F(WsiTests, CreateSurfaceXLIBNoICDCreateSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME});
@@ -353,7 +353,7 @@ TEST_F(WsiTests, CreateSurfaceXLIBNoICDCreateSupport) {
 // When ICD does support the surface creation, the loader should  delegat handle it to the ICD
 TEST_F(WsiTests, CreateSurfaceXLIBICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME});
@@ -403,7 +403,7 @@ TEST_F(WsiTests, CreateSurfaceXLIBMixedICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceXlibPresentNoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME});
@@ -424,7 +424,7 @@ TEST_F(WsiTests, GetPhysicalDeviceXlibPresentNoICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceXlibPresentICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_XLIB_SURFACE_EXTENSION_NAME});
@@ -448,7 +448,7 @@ TEST_F(WsiTests, GetPhysicalDeviceXlibPresentICDSupport) {
 // When ICD doesn't support the extension, create instance should fail
 TEST_F(WsiTests, CreateSurfaceWaylandNoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.enable_icd_wsi = false;
 
@@ -465,7 +465,7 @@ TEST_F(WsiTests, CreateSurfaceWaylandNoICDSupport) {
 // When ICD doesn't support the surface creation, the loader should handle it
 TEST_F(WsiTests, CreateSurfaceWaylandNoICDCreateSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME});
@@ -487,7 +487,7 @@ TEST_F(WsiTests, CreateSurfaceWaylandNoICDCreateSupport) {
 // When ICD does support the surface creation, the loader should  delegat handle it to the ICD
 TEST_F(WsiTests, CreateSurfaceWaylandICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME});
@@ -537,7 +537,7 @@ TEST_F(WsiTests, CreateSurfaceWaylandMixedICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceWaylandPresentNoICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME});
@@ -558,7 +558,7 @@ TEST_F(WsiTests, GetPhysicalDeviceWaylandPresentNoICDSupport) {
 
 TEST_F(WsiTests, GetPhysicalDeviceWaylandPresentICDSupport) {
     auto& driver = env->get_test_icd();
-    driver.set_icd_api_version(VK_MAKE_VERSION(1, 0, 0));
+    driver.set_icd_api_version(VK_API_VERSION_1_0);
     driver.set_min_icd_interface_version(5);
     driver.add_instance_extension({VK_KHR_SURFACE_EXTENSION_NAME});
     driver.add_instance_extension({VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME});