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

◆ bind_buffer()

void MayaFlux::Buffers::ShaderProcessor::bind_buffer ( const std::string &  descriptor_name,
const std::shared_ptr< VKBuffer > &  buffer 
)

Bind a VKBuffer to a named shader descriptor.

Parameters
descriptor_nameLogical name (e.g., "input", "output")
bufferVKBuffer to bind

Registers the buffer for descriptor set binding. The descriptor_name must match a key in config.bindings.

Definition at line 114 of file ShaderProcessor.cpp.

115{
116 if (!buffer) {
118 "Cannot bind null buffer to descriptor '{}'", descriptor_name);
119 return;
120 }
121
122 ensure_initialized(buffer);
123
124 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
125 auto user_binding_count = static_cast<uint32_t>(
126 std::ranges::count_if(m_config.bindings, [](const auto& pair) {
127 return pair.second.set == 1;
128 }));
129
130 ShaderBinding default_binding;
131 default_binding.set = 1;
132 default_binding.binding = user_binding_count;
133 default_binding.type = vk::DescriptorType::eStorageBuffer;
134 m_config.bindings[descriptor_name] = default_binding;
135
137 "Created default binding for '{}': set={}, binding={}",
138 descriptor_name, default_binding.set, default_binding.binding);
139 }
140
141 m_bound_buffers[descriptor_name] = buffer;
143
145 "Bound buffer to descriptor '{}' (size: {} bytes)",
146 descriptor_name, buffer->get_size_bytes());
147}
#define MF_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
std::unordered_map< std::string, std::shared_ptr< VKBuffer > > m_bound_buffers
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
Definition VKBuffer.cpp:462
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::unordered_map< std::string, ShaderBinding > bindings

References MayaFlux::Buffers::ShaderConfig::bindings, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::VKBufferProcessor::ensure_initialized(), m_config, and MF_ERROR.

Referenced by auto_bind_buffer(), MayaFlux::Buffers::DescriptorBindingsProcessor::bind_audio_buffer(), MayaFlux::Buffers::DescriptorBindingsProcessor::bind_host_vk_buffer(), MayaFlux::Buffers::DescriptorBindingsProcessor::bind_matrix_node(), MayaFlux::Buffers::DescriptorBindingsProcessor::bind_network(), MayaFlux::Buffers::DescriptorBindingsProcessor::bind_scalar_node(), MayaFlux::Buffers::DescriptorBindingsProcessor::bind_structured_node(), MayaFlux::Buffers::DescriptorBindingsProcessor::bind_vector_node(), and MayaFlux::Buffers::UVFieldProcessor::on_attach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: