diff options
| author | Józef Kucia <joseph.kucia@gmail.com> | 2017-09-10 11:24:08 +0200 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2017-09-13 12:27:13 -0600 |
| commit | fd558f59041145754a9509323622ea7047a2286c (patch) | |
| tree | c2f8d17b4ab95a5d43e7962ac8c4ebb14e5aa5a5 | |
| parent | 071d290969f0544120f079f2ad057e2b9580c3b1 (diff) | |
| download | usermoji-fd558f59041145754a9509323622ea7047a2286c.tar.xz | |
layers: Use layout flags to test for push descriptor sets
| -rw-r--r-- | layers/core_validation.cpp | 1 | ||||
| -rw-r--r-- | layers/descriptor_sets.cpp | 11 | ||||
| -rw-r--r-- | 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<cvdescriptorset::DescriptorSetLayout>(&layout_create_info, desc_set_layout); std::unique_ptr<cvdescriptorset::DescriptorSet> 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<uint32_t, uint32_t> 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<DescriptorSetLayout const> &layout, const layer_data *dev_data) + const std::shared_ptr<DescriptorSetLayout const> &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<uint32_t, uint32_t> binding_to_global_end_index_map_; // For a given binding map to associated index in the dynamic offset array std::unordered_map<uint32_t, uint32_t> binding_to_dynamic_array_idx_map_; - // VkDescriptorSetLayoutCreateFlags flags_; + VkDescriptorSetLayoutCreateFlags flags_; uint32_t binding_count_; // # of bindings in this layout std::vector<safe_VkDescriptorSetLayoutBinding> 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_ |
