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

◆ write() [7/12]

void MayaFlux::Portal::Forma::Bridge::write ( uint32_t  id,
const std::shared_ptr< Buffers::VKBuffer > &  target_buffer,
const std::string &  shader_path,
const std::string &  descriptor_name,
uint32_t  binding_index,
uint32_t  set,
Portal::Graphics::DescriptorRole  role = Portal::Graphics::DescriptorRole::UNIFORM 
)

Route element value to a descriptor binding on target_buffer.

Creates a FormaBindingsProcessor if one does not yet exist for this element and attaches it to target_buffer. If a processor already exists from a prior write() call, target_buffer must be the same buffer — a second attachment is not made.

Parameters
idElement id.
target_bufferBuffer whose pipeline context receives the descriptor update.
shader_pathShader path used to construct FormaBindingsProcessor if needed.
descriptor_nameDescriptor name in the shader config.
binding_indexVulkan binding index.
setDescriptor set index.
roleUNIFORM or STORAGE.

Definition at line 120 of file Bridge.cpp.

128{
129 auto it = m_records.find(id);
130 if (it == m_records.end()) {
132 "Bridge::write: unknown element id {}", id);
133 return;
134 }
135
136 auto& rec = it->second;
137 if (!rec.bindings) {
138 rec.bindings = std::make_shared<Buffers::FormaBindingsProcessor>(shader_path);
139 m_buffer_manager.add_processor(rec.bindings, target_buffer,
141 }
142
143 rec.bindings->bind_descriptor(
144 descriptor_name + "_" + std::to_string(id),
145 rec.reader,
146 descriptor_name,
147 binding_index, set, role);
148}
#define MF_ERROR(comp, ctx,...)
void add_processor(const std::shared_ptr< BufferProcessor > &processor, const std::shared_ptr< Buffer > &buffer, ProcessingToken token=ProcessingToken::AUDIO_BACKEND)
Adds a processor to a buffer.
std::unordered_map< uint32_t, ElementRecord > m_records
Definition Bridge.hpp:527
Buffers::BufferManager & m_buffer_manager
Definition Bridge.hpp:523
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
@ Init
Engine/subsystem initialization.
@ Portal
High-level user-facing API layer.

References MayaFlux::Buffers::BufferManager::add_processor(), MayaFlux::Buffers::GRAPHICS_BACKEND, MayaFlux::Journal::Init, m_buffer_manager, m_records, MF_ERROR, and MayaFlux::Journal::Portal.

+ Here is the call graph for this function: