aboutsummaryrefslogtreecommitdiff
path: root/layers/descriptor_sets.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2017-03-14 11:22:50 -0600
committerTobin Ehlis <tobine@google.com>2017-03-15 06:57:27 -0600
commitbd6cca98c4f7c6b0022daade891388774aa2cf81 (patch)
treee836d1935e255959a1359acbff52930ff37a7f85 /layers/descriptor_sets.cpp
parent95447595e162090cbd2cfbf48021f459c293e3ed (diff)
downloadusermoji-bd6cca98c4f7c6b0022daade891388774aa2cf81.tar.xz
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.
Diffstat (limited to 'layers/descriptor_sets.cpp')
-rw-r--r--layers/descriptor_sets.cpp32
1 files changed, 21 insertions, 11 deletions
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<uint32_t>(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<const uint64_t &>(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<const uint64_t &>(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<uint32_t>(binding_layout->descriptorType);
- ds_data->required_descriptors_by_type[typeIndex] += binding_layout->descriptorCount;
- }
}
}
auto pool_state = GetDescriptorPoolState(dev_data, p_alloc_info->descriptorPool);