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 399 of file ShaderProcessor.cpp.

400{
401 if (m_descriptor_set_ids.empty()) {
402 return;
403 }
404
405 auto& foundry = Portal::Graphics::get_shader_foundry();
406 auto& descriptor_bindings = buffer->get_pipeline_context().descriptor_buffer_bindings;
407
408 std::set<std::pair<uint32_t, uint32_t>> updated_pairs;
409
410 for (const auto& binding : descriptor_bindings) {
411 auto ds_index = resolve_ds_index(binding.set);
412 if (!ds_index) {
414 "Descriptor set index {} out of range or reserved", binding.set);
415 continue;
416 }
417
418 foundry.update_descriptor_buffer(
419 m_descriptor_set_ids[*ds_index],
420 binding.binding,
421 binding.type,
422 binding.buffer_info.buffer,
423 binding.buffer_info.offset,
424 binding.buffer_info.range);
425
426 updated_pairs.emplace(binding.set, binding.binding);
427 }
428
429 for (const auto& [descriptor_name, buf] : m_bound_buffers) {
430 auto binding_it = m_config.bindings.find(descriptor_name);
431 if (binding_it == m_config.bindings.end()) {
432 continue;
433 }
434
435 const auto& binding = binding_it->second;
436 auto key = std::make_pair(binding.set, binding.binding);
437
438 if (updated_pairs.count(key)) {
439 continue;
440 }
441
442 auto ds_index = resolve_ds_index(binding.set);
443 if (!ds_index) {
445 "Invalid descriptor set index {} for binding '{}'",
446 binding.set, descriptor_name);
447 continue;
448 }
449
450 foundry.update_descriptor_buffer(
451 m_descriptor_set_ids[*ds_index],
452 binding.binding,
453 binding.type,
454 buf->get_buffer(),
455 0,
456 buf->get_size_bytes());
457 }
458}
#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: