layers:Handle consecutive descriptor updates
Fixes #1165
According to spec descriptor updates should roll over to the next
binding number. If bindings were out of order, this was broken in
validation.
This fix corrects validation and state update for out-of-order
descriptor bindings by checking consecutive updates based on correct
binding count for consecutive bindings and by performing updates
on a per-binding basis, making sure to roll update over to the
correct next binding.
Also update the error message, related negative test, and database
file.
diff --git a/layers/descriptor_sets.h b/layers/descriptor_sets.h
index 2fdb1c4..b455b35 100644
--- a/layers/descriptor_sets.h
+++ b/layers/descriptor_sets.h
@@ -96,6 +96,8 @@
VkDescriptorSetLayout GetDescriptorSetLayout() const { return layout_; };
uint32_t GetTotalDescriptorCount() const { return descriptor_count_; };
uint32_t GetDynamicDescriptorCount() const { return dynamic_descriptor_count_; };
+ // For a given binding, return the number of descriptors in that binding and all successive bindings
+ uint32_t GetConsecutiveDescriptorCountFromBinding(uint32_t) const;
uint32_t GetBindingCount() const { return binding_count_; };
// Fill passed-in set with bindings
void FillBindingSet(std::unordered_set<uint32_t> *) const;
@@ -138,7 +140,7 @@
private:
VkDescriptorSetLayout layout_;
- std::unordered_map<uint32_t, uint32_t> binding_to_index_map_;
+ std::map<uint32_t, uint32_t> binding_to_index_map_;
std::unordered_map<uint32_t, uint32_t> binding_to_global_start_index_map_;
std::unordered_map<uint32_t, uint32_t> binding_to_global_end_index_map_;
// For a given binding map to associated index in the dynamic offset array