MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ update_descriptor_buffers()

void MayaFlux::Portal::Graphics::ShaderFoundry::update_descriptor_buffers ( std::span< const DescriptorBufferWrite >  writes)

Update several buffer descriptor slots in one Vulkan call.

Equivalent to calling update_descriptor_buffer once per entry, except every entry is submitted through a single vkUpdateDescriptorSets call instead of one call per entry. Entries may target different descriptor sets; order among them does not matter since each names a distinct (descriptor set, binding). An entry naming an unknown descriptor_set_id is skipped, matching update_descriptor_buffer's behaviour for the same case. A call with an empty span does nothing.

Parameters
writesSlots to update.

Definition at line 784 of file ShaderFoundry.cpp.

785{
786 if (writes.empty()) {
787 return;
788 }
789
790 std::vector<vk::DescriptorBufferInfo> buffer_infos;
791 buffer_infos.reserve(writes.size());
792 std::vector<vk::WriteDescriptorSet> descriptor_writes;
793 descriptor_writes.reserve(writes.size());
794
795 for (const auto& w : writes) {
796 auto it = m_descriptor_sets.find(w.descriptor_set_id);
797 if (it == m_descriptor_sets.end()) {
798 continue;
799 }
800
801 buffer_infos.emplace_back(w.buffer, w.offset, w.size);
802
803 vk::WriteDescriptorSet write;
804 write.dstSet = it->second.descriptor_set;
805 write.dstBinding = w.binding;
806 write.dstArrayElement = 0;
807 write.descriptorCount = 1;
808 write.descriptorType = w.type;
809 write.pBufferInfo = &buffer_infos.back();
810 descriptor_writes.push_back(write);
811 }
812
813 if (!descriptor_writes.empty()) {
814 get_device().updateDescriptorSets(
815 static_cast<uint32_t>(descriptor_writes.size()), descriptor_writes.data(), 0, nullptr);
816 }
817}
vk::Device get_device() const
Get logical device handle.
std::unordered_map< DescriptorSetID, DescriptorSetState > m_descriptor_sets

References get_device(), and m_descriptor_sets.

+ Here is the call graph for this function: