MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / update

Method update

framework/core/descriptor_set.cpp:149–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void DescriptorSet::update(const std::vector<uint32_t> &bindings_to_update)
150{
151 std::vector<VkWriteDescriptorSet> write_operations;
152 std::vector<size_t> write_operation_hashes;
153
154 // If the 'bindings_to_update' vector is empty, we want to write to all the bindings
155 // (but skipping all to-update bindings that haven't been written yet)
156 if (bindings_to_update.empty())
157 {
158 for (size_t i = 0; i < write_descriptor_sets.size(); i++)
159 {
160 const auto &write_operation = write_descriptor_sets[i];
161
162 size_t write_operation_hash = 0;
163 hash_param(write_operation_hash, write_operation);
164
165 auto update_pair_it = updated_bindings.find(write_operation.dstBinding);
166 if (update_pair_it == updated_bindings.end() || update_pair_it->second != write_operation_hash)
167 {
168 write_operations.push_back(write_operation);
169 write_operation_hashes.push_back(write_operation_hash);
170 }
171 }
172 }
173 else
174 {
175 // Otherwise we want to update the binding indices present in the 'bindings_to_update' vector.
176 // (again, skipping those to update but not updated yet)
177 for (size_t i = 0; i < write_descriptor_sets.size(); i++)
178 {
179 const auto &write_operation = write_descriptor_sets[i];
180
181 if (std::ranges::find(bindings_to_update, write_operation.dstBinding) != bindings_to_update.end())
182 {
183 size_t write_operation_hash = 0;
184 hash_param(write_operation_hash, write_operation);
185
186 auto update_pair_it = updated_bindings.find(write_operation.dstBinding);
187 if (update_pair_it == updated_bindings.end() || update_pair_it->second != write_operation_hash)
188 {
189 write_operations.push_back(write_operation);
190 write_operation_hashes.push_back(write_operation_hash);
191 }
192 }
193 }
194 }
195
196 // Perform the Vulkan call to update the DescriptorSet by executing the write operations
197 if (!write_operations.empty())
198 {
199 vkUpdateDescriptorSets(device.get_handle(),
200 to_u32(write_operations.size()),
201 write_operations.data(),
202 0,
203 nullptr);
204 }
205
206 // Store the bindings from the write operations that were executed by vkUpdateDescriptorSets (and their hash)

Callers

nothing calls this directly

Calls 6

hash_paramFunction · 0.85
to_u32Function · 0.85
emptyMethod · 0.80
sizeMethod · 0.80
endMethod · 0.80
get_handleMethod · 0.45

Tested by

no test coverage detected