diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-05-24 12:35:57 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-05-31 08:49:43 -0600 |
| commit | ae2eb29829c370138f08131b2246f67a0cc0ddd1 (patch) | |
| tree | 59df4b2a08c8fcb79b99721dd27d4877b300cd32 /layers/descriptor_sets.cpp | |
| parent | 6eaa12d7fc3aa90e433d7f694238a72306453925 (diff) | |
| download | usermoji-ae2eb29829c370138f08131b2246f67a0cc0ddd1.tar.xz | |
layers: Remove unneeded else block
The "if" case returns so no need for this else block or the indentation
that it includes.
Diffstat (limited to 'layers/descriptor_sets.cpp')
| -rw-r--r-- | layers/descriptor_sets.cpp | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index c3f9e3b1..e6c8ab65 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -944,40 +944,38 @@ bool cvdescriptorset::DescriptorSet::ValidateWriteUpdate(const debug_report_data error_str << "DescriptorSet " << set_ << " does not have binding " << update->dstBinding << "."; *error_msg = error_str.str(); return false; - } else { - // We know that binding is valid, verify update and do update on each descriptor - auto start_idx = p_layout_->GetGlobalStartIndexFromBinding(update->dstBinding) + update->dstArrayElement; - auto type = p_layout_->GetTypeFromBinding(update->dstBinding); - if (type != update->descriptorType) { - std::stringstream error_str; - error_str << "Attempting write update to descriptor set " << set_ << " binding #" << update->dstBinding << " with type " - << string_VkDescriptorType(type) << " but update type is " << string_VkDescriptorType(update->descriptorType); - *error_msg = error_str.str(); - return false; - } - if ((start_idx + update->descriptorCount) > p_layout_->GetTotalDescriptorCount()) { - std::stringstream error_str; - error_str << "Attempting write update to descriptor set " << set_ << " binding #" << update->dstBinding << " with " - << p_layout_->GetTotalDescriptorCount() << " total descriptors but update of " << update->descriptorCount - << " descriptors starting at binding offset of " - << p_layout_->GetGlobalStartIndexFromBinding(update->dstBinding) - << " combined with update array element offset of " << update->dstArrayElement - << " oversteps the size of this descriptor set."; - *error_msg = error_str.str(); - return false; - } - // Verify consecutive bindings match (if needed) - if (!p_layout_->VerifyUpdateConsistency(update->dstBinding, update->dstArrayElement, update->descriptorCount, - "write update to", set_, error_msg)) - return false; - // Update is within bounds and consistent so last step is to validate update contents - if (!VerifyWriteUpdateContents(update, start_idx, error_msg)) { - std::stringstream error_str; - error_str << "Write update to descriptor in set " << set_ << " binding #" << update->dstBinding - << " failed with error message: " << error_msg->c_str(); - *error_msg = error_str.str(); - return false; - } + } + // We know that binding is valid, verify update and do update on each descriptor + auto start_idx = p_layout_->GetGlobalStartIndexFromBinding(update->dstBinding) + update->dstArrayElement; + auto type = p_layout_->GetTypeFromBinding(update->dstBinding); + if (type != update->descriptorType) { + std::stringstream error_str; + error_str << "Attempting write update to descriptor set " << set_ << " binding #" << update->dstBinding << " with type " + << string_VkDescriptorType(type) << " but update type is " << string_VkDescriptorType(update->descriptorType); + *error_msg = error_str.str(); + return false; + } + if ((start_idx + update->descriptorCount) > p_layout_->GetTotalDescriptorCount()) { + std::stringstream error_str; + error_str << "Attempting write update to descriptor set " << set_ << " binding #" << update->dstBinding << " with " + << p_layout_->GetTotalDescriptorCount() << " total descriptors but update of " << update->descriptorCount + << " descriptors starting at binding offset of " << p_layout_->GetGlobalStartIndexFromBinding(update->dstBinding) + << " combined with update array element offset of " << update->dstArrayElement + << " oversteps the size of this descriptor set."; + *error_msg = error_str.str(); + return false; + } + // Verify consecutive bindings match (if needed) + if (!p_layout_->VerifyUpdateConsistency(update->dstBinding, update->dstArrayElement, update->descriptorCount, "write update to", + set_, error_msg)) + return false; + // Update is within bounds and consistent so last step is to validate update contents + if (!VerifyWriteUpdateContents(update, start_idx, error_msg)) { + std::stringstream error_str; + error_str << "Write update to descriptor in set " << set_ << " binding #" << update->dstBinding + << " failed with error message: " << error_msg->c_str(); + *error_msg = error_str.str(); + return false; } // All checks passed, update is clean return true; |
