From 2567a3589fadccfabd4e75d0772eb5c79c497324 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 9 Aug 2017 09:10:37 -0600 Subject: [PATCH] layers:Fix consecutive binding updates Fixes #1992 When we're wrapping a descriptor update for consecutive bindings, fix code so that index into update array consistently increases. --- layers/descriptor_sets.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 3f159b2..693b3ae 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -604,12 +604,13 @@ void cvdescriptorset::DescriptorSet::PerformWriteUpdate(const VkWriteDescriptorS auto descriptors_remaining = update->descriptorCount; auto binding_being_updated = update->dstBinding; auto offset = update->dstArrayElement; + uint32_t update_index = 0; while (descriptors_remaining) { uint32_t update_count = std::min(descriptors_remaining, GetDescriptorCountFromBinding(binding_being_updated)); auto global_idx = p_layout_->GetGlobalStartIndexFromBinding(binding_being_updated) + offset; // Loop over the updates for a single binding at a time - for (uint32_t di = 0; di < update_count; ++di) { - descriptors_[global_idx + di]->WriteUpdate(update, di); + for (uint32_t di = 0; di < update_count; ++di, ++update_index) { + descriptors_[global_idx + di]->WriteUpdate(update, update_index); } // Roll over to next binding in case of consecutive update descriptors_remaining -= update_count; -- 2.7.4