Skip to content

Commit 848a2b2

Browse files
aizu-mcharles-lunarg
authored andcommitted
clamp group physicalDeviceCount to VK_MAX_DEVICE_GROUP_SIZE
1 parent b1744af commit 848a2b2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

loader/loader.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7874,6 +7874,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
78747874
for (uint32_t group = 0; group < count_this_time; ++group) {
78757875
uint32_t cur_index = group + cur_icd_group_count;
78767876
local_phys_dev_groups[cur_index].group_props = pPhysicalDeviceGroupProperties[cur_index];
7877+
// physicalDevices is a fixed VK_MAX_DEVICE_GROUP_SIZE array; don't trust a larger count from the ICD.
7878+
if (local_phys_dev_groups[cur_index].group_props.physicalDeviceCount > VK_MAX_DEVICE_GROUP_SIZE) {
7879+
local_phys_dev_groups[cur_index].group_props.physicalDeviceCount = VK_MAX_DEVICE_GROUP_SIZE;
7880+
}
78777881
local_phys_dev_groups[cur_index].this_icd_term = icd_term;
78787882
}
78797883
} else {
@@ -7904,6 +7908,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
79047908
for (uint32_t group = 0; group < count_this_time; ++group) {
79057909
uint32_t cur_index = group + cur_icd_group_count;
79067910
local_phys_dev_groups[cur_index].group_props = tmp_group_props[group];
7911+
// physicalDevices is a fixed VK_MAX_DEVICE_GROUP_SIZE array; don't trust a larger count from the ICD.
7912+
if (local_phys_dev_groups[cur_index].group_props.physicalDeviceCount > VK_MAX_DEVICE_GROUP_SIZE) {
7913+
local_phys_dev_groups[cur_index].group_props.physicalDeviceCount = VK_MAX_DEVICE_GROUP_SIZE;
7914+
}
79077915
local_phys_dev_groups[cur_index].this_icd_term = icd_term;
79087916
}
79097917
}

0 commit comments

Comments
 (0)