From fd558f59041145754a9509323622ea7047a2286c Mon Sep 17 00:00:00 2001 From: Józef Kucia Date: Sun, 10 Sep 2017 11:24:08 +0200 Subject: layers: Use layout flags to test for push descriptor sets --- layers/core_validation.cpp | 1 - layers/descriptor_sets.cpp | 11 +++++++---- layers/descriptor_sets.h | 7 +++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 051717f8..b211e812 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5656,7 +5656,6 @@ static void PreCallRecordCmdPushDescriptorSetKHR(layer_data *device_data, VkComm const VkDescriptorSetLayout desc_set_layout = 0; auto const shared_ds_layout = std::make_shared(&layout_create_info, desc_set_layout); std::unique_ptr new_desc{new cvdescriptorset::DescriptorSet(0, 0, shared_ds_layout, device_data)}; - new_desc->SetPushDescriptor(); cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[set] = new_desc.get(); cb_state->lastBound[pipelineBindPoint].push_descriptors[set] = std::move(new_desc); delete [] bindings; diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index cf527cd4..c6f057df 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -31,7 +31,11 @@ // Construct DescriptorSetLayout instance from given create info cvdescriptorset::DescriptorSetLayout::DescriptorSetLayout(const VkDescriptorSetLayoutCreateInfo *p_create_info, const VkDescriptorSetLayout layout) - : layout_(layout), binding_count_(p_create_info->bindingCount), descriptor_count_(0), dynamic_descriptor_count_(0) { + : layout_(layout), + flags_(p_create_info->flags), + binding_count_(p_create_info->bindingCount), + descriptor_count_(0), + dynamic_descriptor_count_(0) { // Dyn array indicies are ordered by binding # and array index of any array within the binding // so we store up bindings w/ count in ordered map in order to create dyn array mappings below std::map binding_to_dyn_count; @@ -315,14 +319,13 @@ cvdescriptorset::AllocateDescriptorSetsData::AllocateDescriptorSetsData(uint32_t : required_descriptors_by_type{}, layout_nodes(count, nullptr) {} cvdescriptorset::DescriptorSet::DescriptorSet(const VkDescriptorSet set, const VkDescriptorPool pool, - const std::shared_ptr &layout, const layer_data *dev_data) + const std::shared_ptr &layout, const layer_data *dev_data) : some_update_(false), set_(set), pool_state_(nullptr), p_layout_(layout), device_data_(dev_data), - limits_(GetPhysDevProperties(dev_data)->properties.limits), - push_descriptor_(false) { + limits_(GetPhysDevProperties(dev_data)->properties.limits) { pool_state_ = GetDescriptorPoolState(dev_data, pool); // Foreach binding, create default descriptors of given type for (uint32_t i = 0; i < p_layout_->GetBindingCount(); ++i) { diff --git a/layers/descriptor_sets.h b/layers/descriptor_sets.h index bcd1f680..0a40b8e3 100644 --- a/layers/descriptor_sets.h +++ b/layers/descriptor_sets.h @@ -102,6 +102,7 @@ class DescriptorSetLayout { VkDescriptorSetLayout GetDescriptorSetLayout() const { return layout_; }; uint32_t GetTotalDescriptorCount() const { return descriptor_count_; }; uint32_t GetDynamicDescriptorCount() const { return dynamic_descriptor_count_; }; + VkDescriptorSetLayoutCreateFlags GetCreateFlags() const { return flags_; } // For a given binding, return the number of descriptors in that binding and all successive bindings uint32_t GetBindingCount() const { return binding_count_; }; // Fill passed-in set with bindings @@ -151,7 +152,7 @@ class DescriptorSetLayout { std::unordered_map binding_to_global_end_index_map_; // For a given binding map to associated index in the dynamic offset array std::unordered_map binding_to_dynamic_array_idx_map_; - // VkDescriptorSetLayoutCreateFlags flags_; + VkDescriptorSetLayoutCreateFlags flags_; uint32_t binding_count_; // # of bindings in this layout std::vector bindings_; uint32_t descriptor_count_; // total # descriptors in this layout @@ -383,8 +384,7 @@ class DescriptorSet : public BASE_NODE { }; // Return true if any part of set has ever been updated bool IsUpdated() const { return some_update_; }; - bool IsPushDescriptor() const { return push_descriptor_; }; - void SetPushDescriptor() { push_descriptor_ = true; }; + bool IsPushDescriptor() const { return p_layout_->GetCreateFlags() & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR; }; private: bool VerifyWriteUpdateContents(const VkWriteDescriptorSet *, const uint32_t, UNIQUE_VALIDATION_ERROR_CODE *, @@ -404,7 +404,6 @@ class DescriptorSet : public BASE_NODE { // Ptr to device data used for various data look-ups const core_validation::layer_data *device_data_; const VkPhysicalDeviceLimits limits_; - bool push_descriptor_; }; } #endif // CORE_VALIDATION_DESCRIPTOR_SETS_H_ -- cgit v1.2.3