From adcf4a1234b9f077ec8fdce4f56dc004b7fc3f30 Mon Sep 17 00:00:00 2001 From: Norbert Nopper Date: Wed, 13 Apr 2016 01:08:36 +0200 Subject: layers: Fix vkCreateDescriptorPool max allocation sizes for each type VkDescriptorPoolSize array can contain more than one of same VkDescriptorType --- layers/core_validation.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/layers/core_validation.h b/layers/core_validation.h index 8fbf5303..e87c3bab 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -690,7 +690,7 @@ typedef struct _DESCRIPTOR_POOL_NODE { _DESCRIPTOR_POOL_NODE(const VkDescriptorPool pool, const VkDescriptorPoolCreateInfo *pCreateInfo) : pool(pool), maxSets(pCreateInfo->maxSets), availableSets(pCreateInfo->maxSets), createInfo(*pCreateInfo), pSets(NULL), - maxDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE), availableDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE) { + maxDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE, 0), availableDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE, 0) { if (createInfo.poolSizeCount) { // Shadow type struct from ptr into local struct size_t poolSizeCountSize = createInfo.poolSizeCount * sizeof(VkDescriptorPoolSize); createInfo.pPoolSizes = new VkDescriptorPoolSize[poolSizeCountSize]; @@ -699,7 +699,8 @@ typedef struct _DESCRIPTOR_POOL_NODE { uint32_t i = 0; for (i = 0; i < createInfo.poolSizeCount; ++i) { uint32_t typeIndex = static_cast(createInfo.pPoolSizes[i].type); - maxDescriptorTypeCount[typeIndex] = createInfo.pPoolSizes[i].descriptorCount; + // Same descriptor types can appear several times + maxDescriptorTypeCount[typeIndex] += createInfo.pPoolSizes[i].descriptorCount; availableDescriptorTypeCount[typeIndex] = maxDescriptorTypeCount[typeIndex]; } } else { -- cgit v1.2.3