tests: Allow test ICD to handle NULL pApplicationInfo
authorDaniel Rakos <daniel.rakos@rastergrid.com>
Thu, 16 May 2024 08:07:27 +0000 (10:07 +0200)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Thu, 16 May 2024 17:13:15 +0000 (11:13 -0600)
tests/framework/icd/test_icd.cpp

index e52c16173fc146212a8319264bc4f70a8ebe4f54..b4d92d2faba3105a72bf7fde134c4b1a5b7ab1ed 100644 (file)
@@ -184,12 +184,16 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkEnumerateInstanceVersion(uint32_t* pApiVer
 VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo,
                                                      [[maybe_unused]] const VkAllocationCallbacks* pAllocator,
                                                      VkInstance* pInstance) {
-    if (pCreateInfo == nullptr || pCreateInfo->pApplicationInfo == nullptr) {
+    if (pCreateInfo == nullptr) {
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
 
+    uint32_t default_api_version = VK_API_VERSION_1_0;
+    uint32_t api_version =
+        (pCreateInfo->pApplicationInfo == nullptr) ? default_api_version : pCreateInfo->pApplicationInfo->apiVersion;
+
     if (icd.icd_api_version < VK_API_VERSION_1_1) {
-        if (pCreateInfo->pApplicationInfo->apiVersion > VK_API_VERSION_1_0) {
+        if (api_version > VK_API_VERSION_1_0) {
             return VK_ERROR_INCOMPATIBLE_DRIVER;
         }
     }