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

◆ bind_structured_node()

void MayaFlux::Buffers::DescriptorBindingsProcessor::bind_structured_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 structured node (arrays of POD structs) to descriptor.

Parameters
nameLogical binding name
nodeNode that creates context with GpuStructuredData
descriptor_nameName in shader config bindings
setDescriptor set index
roleTypically STORAGE for structured arrays

Definition at line 174 of file DescriptorBindingsProcessor.cpp.

181{
182 if (!node) {
184 "Cannot bind null node '{}'", name);
185 return;
186 }
187
188 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
190 "Descriptor '{}' not found in shader config", descriptor_name);
191 return;
192 }
193
194 const auto& binding_config = m_config.bindings[descriptor_name];
195
196 size_t initial_size = static_cast<long>(1024) * 64;
197 auto gpu_buffer = create_descriptor_buffer(initial_size, role);
198
199 auto [it, inserted] = m_bindings.try_emplace(name);
200 auto& binding = it->second;
201
202 binding.node = node;
203 binding.descriptor_name = descriptor_name;
204 binding.set_index = set;
205 binding.binding_index = binding_config.binding;
206 binding.role = role;
207 binding.binding_type = BindingType::STRUCTURED;
208 binding.gpu_buffer = gpu_buffer;
209 binding.buffer_offset = 0;
210 binding.buffer_size = initial_size;
211 binding.processing_mode.store(mode, std::memory_order_release);
212
213 bind_buffer(descriptor_name, gpu_buffer);
214
216
218 "Bound structured node '{}' to descriptor '{}'", name, descriptor_name);
219}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
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.
@ STRUCTURED
Array of structs from StructuredContext.
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(), m_bindings, MayaFlux::Buffers::ShaderProcessor::m_config, MayaFlux::Buffers::ShaderProcessor::m_needs_descriptor_rebuild, MF_DEBUG, MF_ERROR, and STRUCTURED.

+ Here is the call graph for this function: