aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlawomir Cygan <slawomir.cygan@intel.com>2016-10-05 18:38:02 +0200
committerMark Young <marky@lunarg.com>2016-10-05 10:52:35 -0600
commita06e15bee6e74732312772f65679cb0fea152e3a (patch)
treefa22b0cc9cdc98bd7c9527616bde3a65bf80d678
parent541119b2a55aeea06b550d12d8e067c21ad5c6e0 (diff)
downloadusermoji-a06e15bee6e74732312772f65679cb0fea152e3a.tar.xz
loader: gh1014- Fix physical device dispatch table
Instead of initializing dispatch tabled for up to *pPhysicalDeviceCount devices, initialize always all dispatch tables. This fixes corruption _after_ VulkanCTS dEQP-VK.api.info.instance.physical_devices test. Change-Id: I29ff42456bed9acb6d2c4016fe7f1940b7f4bd3b
-rw-r--r--loader/loader.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/loader/loader.c b/loader/loader.c
index f2ebb58e..a950ea1d 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -4449,30 +4449,31 @@ terminator_EnumeratePhysicalDevices(VkInstance instance,
inst->phys_devs_term = NULL;
}
- if (copy_count > 0) {
+ if (inst->total_gpu_count > 0) {
inst->phys_devs_term = loader_instance_heap_alloc(
- inst, sizeof(struct loader_physical_device) * copy_count,
+ inst, sizeof(struct loader_physical_device) * inst->total_gpu_count,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!inst->phys_devs_term) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
- for (i = 0; idx < copy_count && i < inst->total_icd_count; i++) {
- for (j = 0; j < phys_devs[i].count && idx < copy_count; j++) {
+ for (i = 0; idx < inst->total_gpu_count && i < inst->total_icd_count; i++) {
+ for (j = 0; j < phys_devs[i].count && idx < inst->total_gpu_count; j++) {
loader_set_dispatch((void *)&inst->phys_devs_term[idx],
inst->disp);
inst->phys_devs_term[idx].this_icd = phys_devs[i].this_icd;
inst->phys_devs_term[idx].icd_index = i;
inst->phys_devs_term[idx].phys_dev = phys_devs[i].phys_devs[j];
- pPhysicalDevices[idx] =
- (VkPhysicalDevice)&inst->phys_devs_term[idx];
+ if (idx < copy_count) {
+ pPhysicalDevices[idx] =
+ (VkPhysicalDevice)&inst->phys_devs_term[idx];
+ }
idx++;
}
}
if (copy_count < inst->total_gpu_count) {
- inst->total_gpu_count = copy_count;
res = VK_INCOMPLETE;
}
}