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

◆ update_descriptors()

void MayaFlux::Buffers::ShaderProcessor::update_descriptors ( const std::shared_ptr< VKBuffer > &  buffer)
protectedvirtual

Definition at line 667 of file ShaderProcessor.cpp.

668{
669 if (m_descriptor_set_ids.empty()) {
670 return;
671 }
672
673 auto& foundry = Portal::Graphics::get_shader_foundry();
674 auto& descriptor_bindings = buffer->get_pipeline_context().descriptor_buffer_bindings;
675
676 std::set<std::pair<uint32_t, uint32_t>> updated_pairs;
677
678 for (const auto& binding : descriptor_bindings) {
679 auto ds_index = resolve_ds_index(binding.set);
680 if (!ds_index) {
682 "Descriptor set index {} out of range or reserved", binding.set);
683 continue;
684 }
685
686 foundry.update_descriptor_buffer(
687 m_descriptor_set_ids[*ds_index],
688 binding.binding,
689 binding.type,
690 binding.buffer_info.buffer,
691 binding.buffer_info.offset,
692 binding.buffer_info.range);
693
694 updated_pairs.emplace(binding.set, binding.binding);
695 }
696
697 for (const auto& [descriptor_name, buf] : m_bound_buffers) {
698 auto binding_it = m_config.bindings.find(descriptor_name);
699 if (binding_it == m_config.bindings.end()) {
700 continue;
701 }
702
703 const auto& binding = binding_it->second;
704 auto key = std::make_pair(binding.set, binding.binding);
705
706 if (updated_pairs.count(key)) {
707 continue;
708 }
709
710 auto ds_index = resolve_ds_index(binding.set);
711 if (!ds_index) {
713 "Invalid descriptor set index {} for binding '{}'",
714 binding.set, descriptor_name);
715 continue;
716 }
717
718 foundry.update_descriptor_buffer(
719 m_descriptor_set_ids[*ds_index],
720 binding.binding,
721 binding.type,
722 buf->get_buffer(),
723 0,
724 buf->get_size_bytes());
725 }
726}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
std::optional< uint32_t > resolve_ds_index(uint32_t set) const
Resolve logical descriptor set index to actual index.
std::unordered_map< std::string, std::shared_ptr< VKBuffer > > m_bound_buffers
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
std::unordered_map< std::string, ShaderBinding > bindings

References MayaFlux::Buffers::ShaderConfig::bindings, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Portal::Graphics::get_shader_foundry(), m_bound_buffers, m_config, m_descriptor_set_ids, MF_ERROR, MF_RT_ERROR, and resolve_ds_index().

Referenced by MayaFlux::Buffers::ComputeProcessor::initialize_descriptors(), MayaFlux::Buffers::RenderProcessor::initialize_descriptors(), and processing_function().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: