From cfdfb1952b103f1612d2bc94b6bbd73b0e4425cc Mon Sep 17 00:00:00 2001 From: siystar Date: Sat, 26 Aug 2023 18:31:35 +0200 Subject: [PATCH] [FIXED] zero descriptorCount passed to DescriptorPool::create --- src/vsg/vk/Context.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/vsg/vk/Context.cpp b/src/vsg/vk/Context.cpp index 692cfdabd..42c194da3 100644 --- a/src/vsg/vk/Context.cpp +++ b/src/vsg/vk/Context.cpp @@ -215,26 +215,30 @@ void Context::reserve(const ResourceRequirements& requirements) } auto required_maxSets = maxSets; - auto required_descriptorPoolSizes = descriptorPoolSizes; - if (available_maxSets < required_maxSets) required_maxSets -= available_maxSets; else required_maxSets = 0; - for (auto& [type, descriptorCount] : required_descriptorPoolSizes) + DescriptorPoolSizes required_descriptorPoolSizes; + for (const auto& [type, descriptorCount] : descriptorPoolSizes) { + uint32_t adjustedDescriptorCount = descriptorCount; for (auto itr = available_descriptorPoolSizes.begin(); itr != available_descriptorPoolSizes.end(); ++itr) { if (itr->type == type) { - if (itr->descriptorCount < descriptorCount) - descriptorCount -= itr->descriptorCount; + if (itr->descriptorCount < adjustedDescriptorCount) + adjustedDescriptorCount -= itr->descriptorCount; else - descriptorCount = 0; - break; + { + adjustedDescriptorCount = 0; + break; + } } } + if (adjustedDescriptorCount > 0) + required_descriptorPoolSizes.push_back(VkDescriptorPoolSize{type, adjustedDescriptorCount}); } if (required_maxSets > 0)