diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2017-03-10 09:14:00 -0700 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-03-13 08:53:38 -0600 |
| commit | 3e2cbb2ca47416711ed1c0b82a3d3e71927bf526 (patch) | |
| tree | 6952bde19d74803c9ab97cf634de18d571378859 | |
| parent | b8ccfc4270a34e192b567ab47258d611abb1d542 (diff) | |
| download | usermoji-3e2cbb2ca47416711ed1c0b82a3d3e71927bf526.tar.xz | |
layers: Add GetNextValidBinding function to CV
Change-Id: Ifaa7aea1c7569ffaf5d417a1cd5caadaa38c96b0
| -rw-r--r-- | layers/descriptor_sets.cpp | 14 | ||||
| -rw-r--r-- | layers/descriptor_sets.h | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 469eb4d2..b697e01a 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -193,6 +193,14 @@ VkSampler const *cvdescriptorset::DescriptorSetLayout::GetImmutableSamplerPtrFro } return nullptr; } +// Move to next valid binding having a non-zero binding count +uint32_t cvdescriptorset::DescriptorSetLayout::GetNextValidBinding(const uint32_t binding) const { + uint32_t new_binding = binding; + do { + new_binding++; + } while (GetDescriptorCountFromBinding(new_binding) == 0); + return new_binding; +} // For given index, return ptr to ImmutableSampler array VkSampler const *cvdescriptorset::DescriptorSetLayout::GetImmutableSamplerPtrFromIndex(const uint32_t index) const { assert(index < bindings_.size()); @@ -1162,11 +1170,7 @@ void cvdescriptorset::PerformUpdateDescriptorSetsWithTemplateKHR(layer_data *dev if (dst_array_element >= binding_count) { dst_array_element = 0; - // Move to next binding having a non-zero binding count - do { - binding_being_updated++; - binding_count = layout_obj->GetDescriptorCountFromBinding(binding_being_updated); - } while (binding_count == 0); + binding_being_updated = layout_obj->GetNextValidBinding(binding_being_updated); } write_entry.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; diff --git a/layers/descriptor_sets.h b/layers/descriptor_sets.h index 9d9a15df..c842aed2 100644 --- a/layers/descriptor_sets.h +++ b/layers/descriptor_sets.h @@ -137,6 +137,8 @@ class DescriptorSetLayout { // These calls should be guarded by a call to "HasBinding(binding)" to verify that the given binding exists uint32_t GetGlobalStartIndexFromBinding(const uint32_t) const; uint32_t GetGlobalEndIndexFromBinding(const uint32_t) const; + // Helper function to get the next valid binding for a descriptor + uint32_t GetNextValidBinding(const uint32_t) const; // For a particular binding starting at offset and having update_count descriptors // updated, verify that for any binding boundaries crossed, the update is consistent bool VerifyUpdateConsistency(uint32_t, uint32_t, uint32_t, const char *, const VkDescriptorSet, std::string *) const; |
