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

◆ bind_vector_node()

void MayaFlux::Buffers::DescriptorBindingsProcessor::bind_vector_node ( const std::string &  name,
const std::shared_ptr< Nodes::Node > &  node,
const std::string &  descriptor_name,
uint32_t  set,
Portal::Graphics::DescriptorRole  role = Portal::Graphics::DescriptorRole::STORAGE,
ProcessingMode  mode = ProcessingMode::INTERNAL 
)

Bind vector node (VectorContext) to descriptor.

Parameters
nameLogical binding name
nodeNode that creates VectorContext
descriptor_nameName in shader config bindings
setDescriptor set index
roleTypically STORAGE for arrays
modeProcessing mode (default: INTERNAL)

Definition at line 78 of file DescriptorBindingsProcessor.cpp.

85{
86 if (!node) {
88 "Cannot bind null node '{}'", name);
89 return;
90 }
91
92 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
94 "Descriptor '{}' not found in shader config", descriptor_name);
95 return;
96 }
97
98 const auto& binding_config = m_config.bindings[descriptor_name];
99
100 size_t initial_size = 4096 * sizeof(float);
101 auto gpu_buffer = create_descriptor_buffer(initial_size, role);
102
103 auto [it, inserted] = m_bindings.try_emplace(name);
104 auto& binding = it->second;
105
106 binding.node = node;
107 binding.descriptor_name = descriptor_name;
108 binding.set_index = set;
109 binding.binding_index = binding_config.binding;
110 binding.role = role;
111 binding.binding_type = BindingType::VECTOR;
112 binding.gpu_buffer = gpu_buffer;
113 binding.buffer_offset = 0;
114 binding.buffer_size = initial_size;
115 binding.processing_mode.store(mode, std::memory_order_release);
116
117 bind_buffer(descriptor_name, gpu_buffer);
118
120
122 "Bound vector node '{}' to descriptor '{}' (mode: {})",
123 name, descriptor_name, mode == ProcessingMode::INTERNAL ? "INTERNAL" : "EXTERNAL");
124}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
@ INTERNAL
Processor calls extract_single_sample() or processes node context.
std::unordered_map< std::string, DescriptorBinding > m_bindings
std::shared_ptr< VKBuffer > create_descriptor_buffer(size_t size, Portal::Graphics::DescriptorRole role)
Create GPU buffer for a descriptor binding.
void bind_buffer(const std::string &descriptor_name, const std::shared_ptr< VKBuffer > &buffer)
Bind a VKBuffer to a named shader descriptor.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::unordered_map< std::string, ShaderBinding > bindings

References MayaFlux::Buffers::ShaderProcessor::bind_buffer(), MayaFlux::Buffers::ShaderConfig::bindings, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, create_descriptor_buffer(), INTERNAL, m_bindings, MayaFlux::Buffers::ShaderProcessor::m_config, MayaFlux::Buffers::ShaderProcessor::m_needs_descriptor_rebuild, MF_DEBUG, MF_ERROR, and VECTOR.

+ Here is the call graph for this function: