MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / Free

Method Free

layers/state_tracker/descriptor_sets.cpp:89–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void vvl::DescriptorPool::Free(uint32_t count, const VkDescriptorSet* descriptor_sets) {
90 auto guard = WriteLock();
91 // Update available descriptor sets in pool
92 available_sets_ += count;
93 // we want to track frees because we're interested in suggesting re-use
94 freed_count += count;
95
96 // For each freed descriptor add its resources back into the pool as available and remove from pool and device data
97 for (uint32_t i = 0; i < count; ++i) {
98 if (descriptor_sets[i] != VK_NULL_HANDLE) {
99 auto iter = sets_.find(descriptor_sets[i]);
100 ASSERT_AND_CONTINUE(iter != sets_.end());
101 auto* set_state = iter->second;
102 const auto& layout = set_state->Layout();
103 uint32_t type_index = 0, descriptor_count = 0;
104 for (uint32_t j = 0; j < layout.GetBindingCount(); ++j) {
105 type_index = static_cast<uint32_t>(layout.GetTypeFromIndex(j));
106 descriptor_count = layout.GetDescriptorCountFromIndex(j);
107 available_counts_[type_index] += descriptor_count;
108 }
109 dev_data_.Destroy<vvl::DescriptorSet>(iter->first);
110 sets_.erase(iter);
111 }
112 }
113}
114
115void vvl::DescriptorPool::Reset() {
116 auto guard = WriteLock();

Calls 8

WriteLockClass · 0.85
LayoutMethod · 0.80
findMethod · 0.45
endMethod · 0.45
GetBindingCountMethod · 0.45
GetTypeFromIndexMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected