From: Józef Kucia Date: Fri, 13 Oct 2017 20:31:34 +0000 (+0200) Subject: layers: Remove validation error for copying nonupdated descriptors X-Git-Tag: submit/tizen/20181227.054638~719 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd2684625b6b127c03f3d47574e8882b46deab06;p=platform%2Fupstream%2FVulkan-Tools.git layers: Remove validation error for copying nonupdated descriptors The spec doesn't say much about descriptors copy update valid usage, but it doesn't seem to require that descriptors are updated before copying. --- diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 5c8981e5..52eff4cb 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -700,16 +700,6 @@ bool cvdescriptorset::DescriptorSet::ValidateCopyUpdate(const debug_report_data set_, error_msg))) { return false; } - // First make sure source descriptors are updated - for (uint32_t i = 0; i < update->descriptorCount; ++i) { - if (!src_set->descriptors_[src_start_idx + i]->updated) { - std::stringstream error_str; - error_str << "Attempting copy update from descriptorSet " << src_set << " binding #" << update->srcBinding - << " but descriptor at array offset " << update->srcArrayElement + i << " has not been updated"; - *error_msg = error_str.str(); - return false; - } - } // Update parameters all look good and descriptor updated so verify update contents if (!VerifyCopyUpdateContents(update, src_set, src_type, src_start_idx, error_code, error_msg)) return false; @@ -722,9 +712,15 @@ void cvdescriptorset::DescriptorSet::PerformCopyUpdate(const VkCopyDescriptorSet auto dst_start_idx = p_layout_->GetGlobalStartIndexFromBinding(update->dstBinding) + update->dstArrayElement; // Update parameters all look good so perform update for (uint32_t di = 0; di < update->descriptorCount; ++di) { - descriptors_[dst_start_idx + di]->CopyUpdate(src_set->descriptors_[src_start_idx + di].get()); + auto src = src_set->descriptors_[src_start_idx + di].get(); + auto dst = descriptors_[dst_start_idx + di].get(); + if (src->updated) { + dst->CopyUpdate(src); + some_update_ = true; + } else { + dst->updated = false; + } } - if (update->descriptorCount) some_update_ = true; InvalidateBoundCmdBuffers(); } @@ -1559,8 +1555,10 @@ bool cvdescriptorset::DescriptorSet::VerifyCopyUpdateContents(const VkCopyDescri switch (src_set->descriptors_[index]->descriptor_class) { case PlainSampler: { for (uint32_t di = 0; di < update->descriptorCount; ++di) { - if (!src_set->descriptors_[index + di]->IsImmutableSampler()) { - auto update_sampler = static_cast(src_set->descriptors_[index + di].get())->GetSampler(); + const auto src_desc = src_set->descriptors_[index + di].get(); + if (!src_desc->updated) continue; + if (!src_desc->IsImmutableSampler()) { + auto update_sampler = static_cast(src_desc)->GetSampler(); if (!ValidateSampler(update_sampler, device_data_)) { *error_code = VALIDATION_ERROR_15c0028a; std::stringstream error_str; @@ -1576,7 +1574,9 @@ bool cvdescriptorset::DescriptorSet::VerifyCopyUpdateContents(const VkCopyDescri } case ImageSampler: { for (uint32_t di = 0; di < update->descriptorCount; ++di) { - auto img_samp_desc = static_cast(src_set->descriptors_[index + di].get()); + const auto src_desc = src_set->descriptors_[index + di].get(); + if (!src_desc->updated) continue; + auto img_samp_desc = static_cast(src_desc); // First validate sampler if (!img_samp_desc->IsImmutableSampler()) { auto update_sampler = img_samp_desc->GetSampler(); @@ -1604,7 +1604,9 @@ bool cvdescriptorset::DescriptorSet::VerifyCopyUpdateContents(const VkCopyDescri } case Image: { for (uint32_t di = 0; di < update->descriptorCount; ++di) { - auto img_desc = static_cast(src_set->descriptors_[index + di].get()); + const auto src_desc = src_set->descriptors_[index + di].get(); + if (!src_desc->updated) continue; + auto img_desc = static_cast(src_desc); auto image_view = img_desc->GetImageView(); auto image_layout = img_desc->GetImageLayout(); if (!ValidateImageUpdate(image_view, image_layout, type, device_data_, error_code, error_msg)) { @@ -1618,7 +1620,9 @@ bool cvdescriptorset::DescriptorSet::VerifyCopyUpdateContents(const VkCopyDescri } case TexelBuffer: { for (uint32_t di = 0; di < update->descriptorCount; ++di) { - auto buffer_view = static_cast(src_set->descriptors_[index + di].get())->GetBufferView(); + const auto src_desc = src_set->descriptors_[index + di].get(); + if (!src_desc->updated) continue; + auto buffer_view = static_cast(src_desc)->GetBufferView(); auto bv_state = GetBufferViewState(device_data_, buffer_view); if (!bv_state) { *error_code = VALIDATION_ERROR_15c00286; @@ -1639,7 +1643,9 @@ bool cvdescriptorset::DescriptorSet::VerifyCopyUpdateContents(const VkCopyDescri } case GeneralBuffer: { for (uint32_t di = 0; di < update->descriptorCount; ++di) { - auto buffer = static_cast(src_set->descriptors_[index + di].get())->GetBuffer(); + const auto src_desc = src_set->descriptors_[index + di].get(); + if (!src_desc->updated) continue; + auto buffer = static_cast(src_desc)->GetBuffer(); if (!ValidateBufferUsage(GetBufferState(device_data_, buffer), type, error_code, error_msg)) { std::stringstream error_str; error_str << "Attempted copy update to buffer descriptor failed due to: " << error_msg->c_str();