MayaFlux 1.0.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 766 of file ShaderProcessor.cpp.

767{
768 if (m_descriptor_set_ids.empty()) {
769 return;
770 }
771
772 auto& foundry = Portal::Graphics::get_shader_foundry();
773 auto& descriptor_bindings = buffer->get_pipeline_context().descriptor_buffer_bindings;
774
775 std::set<std::pair<uint32_t, uint32_t>> updated_pairs;
776
777 for (const auto& binding : descriptor_bindings) {
778 auto ds_index = resolve_ds_index(binding.set);
779 if (!ds_index) {
781 "Descriptor set index {} out of range or reserved", binding.set);
782 continue;
783 }
784
785 foundry.update_descriptor_buffer(
786 m_descriptor_set_ids[*ds_index],
787 binding.binding,
788 binding.type,
789 binding.buffer_info.buffer,
790 binding.buffer_info.offset,
791 binding.buffer_info.range);
792
793 updated_pairs.emplace(binding.set, binding.binding);
794 }
795
796 for (const auto& [descriptor_name, buf] : m_bound_buffers) {
797 auto binding_it = m_config.bindings.find(descriptor_name);
798 if (binding_it == m_config.bindings.end()) {
799 continue;
800 }
801
802 const auto& binding = binding_it->second;
803 auto key = std::make_pair(binding.set, binding.binding);
804
805 if (updated_pairs.count(key)) {
806 continue;
807 }
808
809 auto ds_index = resolve_ds_index(binding.set);
810 if (!ds_index) {
812 "Invalid descriptor set index {} for binding '{}'",
813 binding.set, descriptor_name);
814 continue;
815 }
816
817 foundry.update_descriptor_buffer(
818 m_descriptor_set_ids[*ds_index],
819 binding.binding,
820 binding.type,
821 buf->get_buffer(),
822 0,
823 buf->get_size_bytes());
824 }
825}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
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, buffer, 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(), and processing_function().

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