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

◆ bind_matrix_node()

void MayaFlux::Buffers::DescriptorBindingsProcessor::bind_matrix_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 matrix node (MatrixContext) to descriptor.

Definition at line 126 of file DescriptorBindingsProcessor.cpp.

133{
134 if (!node) {
136 "Cannot bind null node '{}'", name);
137 return;
138 }
139
140 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
142 "Descriptor '{}' not found in shader config", descriptor_name);
143 return;
144 }
145
146 const auto& binding_config = m_config.bindings[descriptor_name];
147
148 size_t initial_size = static_cast<long>(1024) * 1024 * sizeof(float);
149 auto gpu_buffer = create_descriptor_buffer(initial_size, role);
150
151 auto [it, inserted] = m_bindings.try_emplace(name);
152 auto& binding = it->second;
153
154 binding.node = node;
155 binding.descriptor_name = descriptor_name;
156 binding.set_index = set;
157 binding.binding_index = binding_config.binding;
158 binding.role = role;
159 binding.binding_type = BindingType::MATRIX;
160 binding.gpu_buffer = gpu_buffer;
161 binding.buffer_offset = 0;
162 binding.buffer_size = initial_size;
163 binding.processing_mode.store(mode, std::memory_order_release);
164
165 bind_buffer(descriptor_name, gpu_buffer);
166
168
170 "Bound matrix node '{}' to descriptor '{}' (mode: {})",
171 name, descriptor_name, mode == ProcessingMode::INTERNAL ? "INTERNAL" : "EXTERNAL");
172}
#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, MATRIX, MF_DEBUG, and MF_ERROR.

+ Here is the call graph for this function: