From: Charles Giessen Date: Thu, 10 Feb 2022 18:34:50 +0000 (-0700) Subject: Dont return an error for 0 physical device extensions X-Git-Tag: upstream/v1.3.207~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66ee58e87a986facb702d8597f1ebe6f81014195;p=platform%2Fupstream%2FVulkan-Loader.git Dont return an error for 0 physical device extensions Previously the logic of loader_add_device_extensions could return an error from enumerating device extensions. This was because the code would return immediately if either an error was returned from the driver or the count was zero. Now the logic will return an error only if the driver returned an error. Zero device extensions won't be treated as an error and will simply return VK_SUCCESS. --- diff --git a/loader/loader.c b/loader/loader.c index 0bb5fc6e..8e55193f 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -582,11 +582,17 @@ VkResult loader_add_device_extensions(const struct loader_instance *inst, VkExtensionProperties *ext_props = NULL; res = fpEnumerateDeviceExtensionProperties(physical_device, NULL, &count, NULL); - if (res == VK_SUCCESS && count > 0) { + if (res != VK_SUCCESS) { + loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, + "loader_add_device_extensions: Error getting physical device extension info count from library %s", lib_name); + return res; + } + if (count > 0) { ext_props = loader_stack_alloc(count * sizeof(VkExtensionProperties)); if (!ext_props) { loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_add_device_extensions: Failed to allocate space for device extension properties."); + "loader_add_device_extensions: Failed to allocate space for device extension properties from library %s.", + lib_name); return VK_ERROR_OUT_OF_HOST_MEMORY; } res = fpEnumerateDeviceExtensionProperties(physical_device, NULL, &count, ext_props); @@ -599,10 +605,6 @@ VkResult loader_add_device_extensions(const struct loader_instance *inst, return res; } } - } else { - loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0, - "loader_add_device_extensions: Error getting physical device extension info count from library %s", lib_name); - return res; } return VK_SUCCESS;