From 62cef16bdf6155f136202daae711a80a1deb0351 Mon Sep 17 00:00:00 2001 From: Piers Daniell Date: Thu, 31 Mar 2016 15:00:59 -0600 Subject: loader: Trampoline vkEnumeratePhysDev should use layer-returned physDev count Modify the trampoline vkEnumeratePhysicalDevices() implementation to enumerate the number of physical devices based on what the top-most layer reports and not what the terminator_EnumeratePhysicalDevices counted. This allows intermediate layers to modify the physical device count. Change-Id: Ifd5c3c8c4db53cf97b976feefe18de7cfef47e35 --- loader/trampoline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'loader') diff --git a/loader/trampoline.c b/loader/trampoline.c index dd015795..0622dcea 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -511,7 +511,8 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, } if (inst->phys_devs) loader_heap_free(inst, inst->phys_devs); - count = inst->total_gpu_count; + count = min(inst->total_gpu_count, *pPhysicalDeviceCount); + *pPhysicalDevices = count; inst->phys_devs = (struct loader_physical_device_tramp *)loader_heap_alloc( inst, count * sizeof(struct loader_physical_device_tramp), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); -- cgit v1.2.3