aboutsummaryrefslogtreecommitdiff
path: root/layers/descriptor_sets.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-08-22 10:10:43 -0600
committerTobin Ehlis <tobine@google.com>2016-08-24 06:59:39 -0600
commitbe111b45e6801baaedf86fa90570f362f1cf89d0 (patch)
tree1cec66bb1c44446f8a5934ffae16b7da608d2694 /layers/descriptor_sets.cpp
parent7f1a5b24f68483d11153694ccf739cbb7b507f3c (diff)
downloadusermoji-be111b45e6801baaedf86fa90570f362f1cf89d0.tar.xz
layers: Update descriptor binding to use an ordered map
When dealing with dynamic offsets, the binding numbers, and array indices within a binding, are all sequential. This is according to the spec "Descriptor Set Binding" section which states, "...entries are ordered by the binding numbers in the descriptor set layouts; and within a binding array, elements are in order." This means when processing the binding numbers to validate the dynamic offsets at draw time, we should do so in order to make sure that the sequential dynamic offset index correctly correlates with the dynamic offset being processed.
Diffstat (limited to 'layers/descriptor_sets.cpp')
-rw-r--r--layers/descriptor_sets.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp
index c47cb50f..c7b39f7c 100644
--- a/layers/descriptor_sets.cpp
+++ b/layers/descriptor_sets.cpp
@@ -343,7 +343,7 @@ bool cvdescriptorset::DescriptorSet::IsCompatible(const DescriptorSetLayout *lay
// This includes validating that all descriptors in the given bindings are updated,
// that any update buffers are valid, and that any dynamic offsets are within the bounds of their buffers.
// Return true if state is acceptable, or false and write an error message into error string
-bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::unordered_map<uint32_t, descriptor_req> &bindings,
+bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::map<uint32_t, descriptor_req> &bindings,
const std::vector<uint32_t> &dynamic_offsets, std::string *error) const {
auto dyn_offset_index = 0;
for (auto binding_pair : bindings) {
@@ -469,7 +469,7 @@ bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::unordered_map<
}
// For given bindings, place any update buffers or images into the passed-in unordered_sets
-uint32_t cvdescriptorset::DescriptorSet::GetStorageUpdates(const std::unordered_map<uint32_t, descriptor_req> &bindings,
+uint32_t cvdescriptorset::DescriptorSet::GetStorageUpdates(const std::map<uint32_t, descriptor_req> &bindings,
std::unordered_set<VkBuffer> *buffer_set,
std::unordered_set<VkImageView> *image_set) const {
auto num_updates = 0;