loader: fix wrongly returned error code
authorCharles Giessen <charles@lunarg.com>
Wed, 1 Jul 2020 21:34:23 +0000 (15:34 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Mon, 6 Jul 2020 17:07:50 +0000 (11:07 -0600)
vkEnumerateInstanceExtensionProperties was returning INITIALIZATION_FAILED
when a single malformed manifest file was found. This was due to the way
loader_scan_icd only returns an error if no valid ICD's were found.

Change-Id: I84b39774b766d20d607c990bddc921b1c2a4297a

loader/loader.c

index c0403cad6e58237e91cbbe3bd3107214752c326c..239117418e3b5d85dd53636417aa32fa40855a01 100644 (file)
@@ -4472,6 +4472,7 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t
                 res = temp_res;
             }
             if (temp_res == VK_ERROR_OUT_OF_HOST_MEMORY) {
+                res = VK_ERROR_OUT_OF_HOST_MEMORY;
                 break;
             } else {
                 continue;
@@ -7509,7 +7510,8 @@ terminator_EnumerateInstanceExtensionProperties(const VkEnumerateInstanceExtensi
         // Scan/discover all ICD libraries
         memset(&icd_tramp_list, 0, sizeof(icd_tramp_list));
         res = loader_icd_scan(NULL, &icd_tramp_list);
-        if (VK_SUCCESS != res) {
+        // EnumerateInstanceExtensionProperties can't return anything other than OOM or VK_ERROR_LAYER_NOT_PRESENT
+        if ((VK_SUCCESS != res && icd_tramp_list.count > 0) || res == VK_ERROR_OUT_OF_HOST_MEMORY) {
             goto out;
         }
         // Get extensions from all ICD's, merge so no duplicates