MayaFlux 0.5.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 126 of file ShaderProcessor.cpp.

127{
128 if (!buffer) {
130 "Cannot bind null buffer to descriptor '{}'", descriptor_name);
131 return;
132 }
133
134 ensure_initialized(buffer);
135
136 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
137 auto user_binding_count = static_cast<uint32_t>(
138 std::ranges::count_if(m_config.bindings, [](const auto& pair) {
139 return pair.second.set == 1;
140 }));
141
142 ShaderBinding default_binding;
143 default_binding.set = 1;
144 default_binding.binding = user_binding_count;
145 default_binding.type = vk::DescriptorType::eStorageBuffer;
146 m_config.bindings[descriptor_name] = default_binding;
147
149 "Created default binding for '{}': set={}, binding={}",
150 descriptor_name, default_binding.set, default_binding.binding);
151 }
152
153 m_bound_buffers[descriptor_name] = buffer;
155
157 "Bound buffer to descriptor '{}' (size: {} bytes)",
158 descriptor_name, buffer->get_size_bytes());
159}
#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:448
@ 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::FormaBindingsProcessor::bind_descriptor(), 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(), MayaFlux::Buffers::SDFFieldProcessor::on_attach(), MayaFlux::Buffers::SDFMeshProcessor::on_attach(), MayaFlux::Buffers::UVFieldProcessor::on_attach(), MayaFlux::Buffers::VolumeSurfaceProcessor::on_attach(), and pump_feeds().

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