From bd6cca98c4f7c6b0022daade891388774aa2cf81 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Tue, 14 Mar 2017 11:22:50 -0600 Subject: layers:Connect VK_EXT_validation_flags Add support for VK_EXT_validation_flags in core_validation. The only enum currently supported is VK_VALIDATION_CHECK_ALL_EXT which disables all existing flags in validation. Note that most checks are still not guarded by flags so that option will only disable the checks that are guarded by flags. In testing this I found a bug with AllocateDescriptorSets() where common state was not updated with the flag enabled so this includes a fix for that issue as well. --- layers/descriptor_sets.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'layers/descriptor_sets.cpp') diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index ada51a02..92d0ce08 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -1608,11 +1608,29 @@ bool cvdescriptorset::DescriptorSet::VerifyCopyUpdateContents(const VkCopyDescri // All checks passed so update contents are good return true; } +// Update the common AllocateDescriptorSetsData +void cvdescriptorset::UpdateAllocateDescriptorSetsData(const layer_data *dev_data, const VkDescriptorSetAllocateInfo *p_alloc_info, + AllocateDescriptorSetsData *ds_data) { + for (uint32_t i = 0; i < p_alloc_info->descriptorSetCount; i++) { + auto layout = GetDescriptorSetLayout(dev_data, p_alloc_info->pSetLayouts[i]); + if (layout) { + ds_data->layout_nodes[i] = layout; + // Count total descriptors required per type + for (uint32_t j = 0; j < layout->GetBindingCount(); ++j) { + const auto &binding_layout = layout->GetDescriptorSetLayoutBindingPtrFromIndex(j); + uint32_t typeIndex = static_cast(binding_layout->descriptorType); + ds_data->required_descriptors_by_type[typeIndex] += binding_layout->descriptorCount; + } + } + // Any unknown layouts will be flagged as errors during ValidateAllocateDescriptorSets() call + } +}; // Verify that the state at allocate time is correct, but don't actually allocate the sets yet -bool cvdescriptorset::ValidateAllocateDescriptorSets(const debug_report_data *report_data, - const VkDescriptorSetAllocateInfo *p_alloc_info, const layer_data *dev_data, - AllocateDescriptorSetsData *ds_data) { +bool cvdescriptorset::ValidateAllocateDescriptorSets(const core_validation::layer_data *dev_data, + const VkDescriptorSetAllocateInfo *p_alloc_info, + const AllocateDescriptorSetsData *ds_data) { bool skip_call = false; + auto report_data = core_validation::GetReportData(dev_data); for (uint32_t i = 0; i < p_alloc_info->descriptorSetCount; i++) { auto layout = GetDescriptorSetLayout(dev_data, p_alloc_info->pSetLayouts[i]); @@ -1622,14 +1640,6 @@ bool cvdescriptorset::ValidateAllocateDescriptorSets(const debug_report_data *re reinterpret_cast(p_alloc_info->pSetLayouts[i]), __LINE__, DRAWSTATE_INVALID_LAYOUT, "DS", "Unable to find set layout node for layout 0x%" PRIxLEAST64 " specified in vkAllocateDescriptorSets() call", reinterpret_cast(p_alloc_info->pSetLayouts[i])); - } else { - ds_data->layout_nodes[i] = layout; - // Count total descriptors required per type - for (uint32_t j = 0; j < layout->GetBindingCount(); ++j) { - const auto &binding_layout = layout->GetDescriptorSetLayoutBindingPtrFromIndex(j); - uint32_t typeIndex = static_cast(binding_layout->descriptorType); - ds_data->required_descriptors_by_type[typeIndex] += binding_layout->descriptorCount; - } } } auto pool_state = GetDescriptorPoolState(dev_data, p_alloc_info->descriptorPool); -- cgit v1.2.3