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

◆ bind_scalar_node()

void MayaFlux::Buffers::DescriptorBindingsProcessor::bind_scalar_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::UNIFORM,
ProcessingMode  mode = ProcessingMode::INTERNAL 
)

Bind scalar node output to descriptor.

Parameters
nameLogical binding name
nodeNode to read from
descriptor_nameName in shader config bindings
setDescriptor set index
roleUBO or SSBO
modeProcessing mode (default: INTERNAL)

Definition at line 31 of file DescriptorBindingsProcessor.cpp.

38{
39 if (!node) {
41 "Cannot bind null node '{}'", name);
42 return;
43 }
44
45 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
47 "Descriptor '{}' not found in shader config", descriptor_name);
48 return;
49 }
50
51 const auto& binding_config = m_config.bindings[descriptor_name];
52
53 auto gpu_buffer = create_descriptor_buffer(sizeof(float), role);
54
55 auto [it, inserted] = m_bindings.try_emplace(name);
56 auto& binding = it->second;
57
58 binding.node = node;
59 binding.descriptor_name = descriptor_name;
60 binding.set_index = set;
61 binding.binding_index = binding_config.binding;
62 binding.role = role;
63 binding.binding_type = BindingType::SCALAR;
64 binding.gpu_buffer = gpu_buffer;
65 binding.buffer_offset = 0;
66 binding.buffer_size = sizeof(float);
67 binding.processing_mode.store(mode, std::memory_order_release);
68
69 bind_buffer(descriptor_name, gpu_buffer);
70
72
74 "Bound scalar node '{}' to descriptor '{}' (mode: {})",
75 name, descriptor_name, mode == ProcessingMode::INTERNAL ? "INTERNAL" : "EXTERNAL");
76}
#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 SCALAR.

+ Here is the call graph for this function: