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

Bind scalar node output to descriptor.

Parameters
nameLogical binding name
nodeNode to read from
descriptor_nameName in shader config bindings
setDescriptor set index
typeUBO or SSBO

Definition at line 27 of file DescriptorBindingsProcessor.cpp.

33{
34 if (!node) {
36 "Cannot bind null node '{}'", name);
37 return;
38 }
39
40 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
42 "Descriptor '{}' not found in shader config", descriptor_name);
43 return;
44 }
45
46 const auto& binding_config = m_config.bindings[descriptor_name];
47
48 auto gpu_buffer = create_descriptor_buffer(sizeof(float), type);
49
50 m_bindings[name] = DescriptorBinding {
51 .node = node,
52 .descriptor_name = descriptor_name,
53 .set_index = set,
54 .binding_index = binding_config.binding,
55 .type = type,
56 .binding_type = BindingType::SCALAR,
57 .gpu_buffer = gpu_buffer,
58 .buffer_offset = 0,
59 .buffer_size = sizeof(float)
60 };
61
62 bind_buffer(descriptor_name, gpu_buffer);
63
65 "Bound scalar node '{}' to descriptor '{}'", name, descriptor_name);
66}
#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
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::ShaderProcessorConfig::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 SCALAR.

+ Here is the call graph for this function: