MayaFlux 0.2.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,
vk::DescriptorType  type = vk::DescriptorType::eStorageBuffer 
)

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
typeTypically eStorageBuffer for structured arrays

Definition at line 298 of file DescriptorBindingsProcessor.cpp.

304{
305 if (!node) {
307 "Cannot bind null node '{}'", name);
308 return;
309 }
310
311 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
313 "Descriptor '{}' not found in shader config", descriptor_name);
314 return;
315 }
316
317 const auto& binding_config = m_config.bindings[descriptor_name];
318
319 size_t initial_size = static_cast<long>(1024) * 64;
320 auto gpu_buffer = create_descriptor_buffer(initial_size, type);
321
322 m_bindings[name] = DescriptorBinding {
323 .node = node,
324 .descriptor_name = descriptor_name,
325 .set_index = set,
326 .binding_index = binding_config.binding,
327 .type = type,
328 .binding_type = BindingType::STRUCTURED,
329 .gpu_buffer = gpu_buffer,
330 .buffer_offset = 0,
331 .buffer_size = initial_size
332 };
333
334 bind_buffer(descriptor_name, gpu_buffer);
335
337 "Bound structured node '{}' to descriptor '{}'", name, descriptor_name);
338}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::shared_ptr< VKBuffer > create_descriptor_buffer(size_t size, vk::DescriptorType type)
Create GPU buffer for a descriptor binding.
std::unordered_map< std::string, DescriptorBinding > m_bindings
@ 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, MF_DEBUG, MF_ERROR, MayaFlux::Buffers::DescriptorBindingsProcessor::DescriptorBinding::node, and STRUCTURED.

+ Here is the call graph for this function: