MayaFlux 1.0.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 131 of file ShaderProcessor.cpp.

132{
133 if (!buffer) {
135 "Cannot bind null buffer to descriptor '{}'", descriptor_name);
136 return;
137 }
138
140
141 if (m_config.bindings.find(descriptor_name) == m_config.bindings.end()) {
142 uint32_t binding_index = 0;
143 while (std::ranges::any_of(m_config.bindings, [binding_index](const auto& pair) {
144 return pair.second.set == 1 && pair.second.binding == binding_index;
145 })) {
146 ++binding_index;
147 }
148
149 ShaderBinding default_binding;
150 default_binding.set = 1;
151 default_binding.binding = binding_index;
152 default_binding.type = vk::DescriptorType::eStorageBuffer;
153 m_config.bindings[descriptor_name] = default_binding;
154
156 "Created default binding for '{}': set={}, binding={}",
157 descriptor_name, default_binding.set, default_binding.binding);
158 }
159
160 m_bound_buffers[descriptor_name] = buffer;
162
164 "Bound buffer to descriptor '{}' (size: {} bytes)",
165 descriptor_name, buffer->get_size_bytes());
166}
#define MF_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
std::unordered_map< std::string, std::shared_ptr< VKBuffer > > m_bound_buffers
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
Definition VKBuffer.cpp:514
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::unordered_map< std::string, ShaderBinding > bindings

References buffer, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, 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::VertexFieldProcessor::on_attach(), MayaFlux::Buffers::VolumeSurfaceProcessor::on_attach(), and pump_feeds().

+ Here is the caller graph for this function: