In the descriptor header is a bug: an unordered map does not guarantee its order or that index_n + 1 = index_{n + 1} when iterating. For Vulkan the bindings must be in order so you should use something like ordered_map. Also in vulkan its perfectly valid to not specify a binding in a set layout which would not be possible here.
LveDescriptorSetLayout::LveDescriptorSetLayout(
LveDevice &lveDevice, std::unordered_map<uint32_t, VkDescriptorSetLayoutBinding> bindings)
: lveDevice{lveDevice}, bindings{bindings} {
std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings{};
for (auto kv : bindings) {
setLayoutBindings.push_back(kv.second);
}
VkDescriptorSetLayoutCreateInfo descriptorSetLayoutInfo{};
descriptorSetLayoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
descriptorSetLayoutInfo.bindingCount = static_cast<uint32_t>(setLayoutBindings.size());
descriptorSetLayoutInfo.pBindings = setLayoutBindings.data();
if (vkCreateDescriptorSetLayout(
lveDevice.device(),
&descriptorSetLayoutInfo,
nullptr,
&descriptorSetLayout) != VK_SUCCESS) {
throw std::runtime_error("failed to create descriptor set layout!");
}
In the descriptor header is a bug: an unordered map does not guarantee its order or that index_n + 1 = index_{n + 1} when iterating. For Vulkan the bindings must be in order so you should use something like ordered_map. Also in vulkan its perfectly valid to not specify a binding in a set layout which would not be possible here.