From: Mark Young Date: Tue, 24 Jan 2017 22:54:29 +0000 (-0700) Subject: loader: Fix EnumPhysDev bug X-Git-Tag: upstream/1.1.92~1705 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=755999c01090f47037443fbf8326356cb8ebc06c;p=platform%2Fupstream%2FVulkan-Tools.git loader: Fix EnumPhysDev bug Fix a bug found by Piers with regards to vkEnumeratePhysicalDevices. Basically, if the application called the function without first calling it with NULL pPhysicalDevices, the count would be wrong. Change-Id: If3a4ba60b17c64df2133d31d3692ee6da21c6a01 --- diff --git a/loader/trampoline.c b/loader/trampoline.c index 4d14f58..207a747 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -549,7 +549,7 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, goto out; } - if (pPhysicalDevices == NULL) { + if (NULL == pPhysicalDevices || 0 == inst->total_gpu_count) { // Call down. At the lower levels, this will setup the terminator // structures in the loader. res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, @@ -559,7 +559,9 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, "vkEnumeratePhysicalDevices: Failed in dispatch call" " used to determine number of available GPUs"); } + } + if (NULL == pPhysicalDevices) { // Goto out, even on success since we don't need to fill in the rest. goto out; }