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

Bind matrix node (MatrixContext) to descriptor.

Definition at line 110 of file DescriptorBindingsProcessor.cpp.

116{
117 if (!node) {
119 "Cannot bind null node '{}'", name);
120 return;
121 }
122
123 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
125 "Descriptor '{}' not found in shader config", descriptor_name);
126 return;
127 }
128
129 const auto& binding_config = m_config.bindings[descriptor_name];
130
131 size_t initial_size = static_cast<long>(1024) * 1024 * sizeof(float);
132 auto gpu_buffer = create_descriptor_buffer(initial_size, type);
133
134 m_bindings[name] = DescriptorBinding {
135 .node = node,
136 .descriptor_name = descriptor_name,
137 .set_index = set,
138 .binding_index = binding_config.binding,
139 .type = type,
140 .binding_type = BindingType::MATRIX,
141 .gpu_buffer = gpu_buffer,
142 .buffer_offset = 0,
143 .buffer_size = initial_size
144 };
145
146 bind_buffer(descriptor_name, gpu_buffer);
147
149 "Bound matrix node '{}' to descriptor '{}'", name, descriptor_name);
150}
#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, MATRIX, MF_DEBUG, MF_ERROR, and MayaFlux::Buffers::DescriptorBindingsProcessor::DescriptorBinding::node.

+ Here is the call graph for this function: