diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-10-12 15:09:16 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-10-13 19:13:33 -0600 |
| commit | 37e3152c4e7d83661b0febe907509807423b12e2 (patch) | |
| tree | 5890dd8ffaa319ddbbbb0aeeb55c7466bc227ad3 | |
| parent | 10e7d9c4d77b108f3a2ac563b3388c7af7a1e341 (diff) | |
| download | usermoji-37e3152c4e7d83661b0febe907509807423b12e2.tar.xz | |
layers:Bind descriptor pool to cmd buffer
Add pool state to DescriptorSet instead of just the pool.
Then, at bind time, create a dual binding between the cmd buffer
and the pool. This correcly puts pool in-use when cmd buffer is
submitted, as well as flagging cmd buffer as INVALID if/when the
pool is destroyed.
| -rw-r--r-- | layers/descriptor_sets.cpp | 9 | ||||
| -rw-r--r-- | layers/descriptor_sets.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 5f927497..1dcf8463 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -267,7 +267,8 @@ cvdescriptorset::AllocateDescriptorSetsData::AllocateDescriptorSetsData(uint32_t cvdescriptorset::DescriptorSet::DescriptorSet(const VkDescriptorSet set, const VkDescriptorPool pool, const DescriptorSetLayout *layout, const core_validation::layer_data *dev_data) - : some_update_(false), set_(set), pool_(pool), p_layout_(layout), device_data_(dev_data) { + : some_update_(false), set_(set), pool_state_(nullptr), p_layout_(layout), device_data_(dev_data) { + pool_state_ = getDescriptorPoolState(dev_data, pool); // Foreach binding, create default descriptors of given type for (uint32_t i = 0; i < p_layout_->GetBindingCount(); ++i) { auto type = p_layout_->GetTypeFromIndex(i); @@ -646,9 +647,11 @@ void cvdescriptorset::DescriptorSet::PerformCopyUpdate(const VkCopyDescriptorSet void cvdescriptorset::DescriptorSet::BindCommandBuffer(GLOBAL_CB_NODE *cb_node, const std::unordered_set<uint32_t> &bindings) { // bind cb to this descriptor set cb_bindings.insert(cb_node); - // Add bindings for descriptor set and individual objects in the set + // Add bindings for descriptor set, the set's pool, and individual objects in the set cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(set_), VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT}); - cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(pool_), VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT}); + pool_state_->cb_bindings.insert(cb_node); + cb_node->object_bindings.insert( + {reinterpret_cast<uint64_t &>(pool_state_->pool), VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT}); // For the active slots, use set# to look up descriptorSet from boundDescriptorSets, and bind all of that descriptor set's // resources for (auto binding : bindings) { diff --git a/layers/descriptor_sets.h b/layers/descriptor_sets.h index bc58082b..8316bbb0 100644 --- a/layers/descriptor_sets.h +++ b/layers/descriptor_sets.h @@ -374,7 +374,7 @@ class DescriptorSet : public BASE_NODE { void InvalidateBoundCmdBuffers(); bool some_update_; // has any part of the set ever been updated? VkDescriptorSet set_; - VkDescriptorPool pool_; + DESCRIPTOR_POOL_STATE *pool_state_; const DescriptorSetLayout *p_layout_; std::vector<std::unique_ptr<Descriptor>> descriptors_; // Ptr to device data used for various data look-ups |
