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

◆ write() [2/16]

void MayaFlux::Portal::Forma::Bridge::write ( const ElementRef &  ref,
const std::shared_ptr< Buffers::VKBuffer > &  target_buffer,
const std::string &  shader_path,
uint32_t  offset,
Kakshya::GpuDataFormat  format 
)

Route element value to a push constant slot described by a GpuDataFormat.

When the element's own value type is exactly this format, the value is written as it is, so a vec3 or mat4 state keeps every component. Otherwise the element's float value is converted to the format with integers saturating, which needs a single component format.

Parameters
formatLayout written at the offset.

Definition at line 127 of file Bridge.cpp.

133{
134 auto* rec = find_record(ref);
135 if (!rec) {
137 "Bridge::write: unknown element id {}", ref.second);
138 return;
139 }
140
141 if (!rec->bindings) {
142 rec->bindings = std::make_shared<Buffers::FormaBindingsProcessor>(shader_path);
143 m_buffer_manager.add_processor(rec->bindings, target_buffer,
145 }
146
147 auto binding_name = std::to_string(ref.second) + "_pc_" + std::to_string(offset);
148 if (rec->typed_reader && rec->typed_format == format) {
149 rec->bindings->bind_typed_push_constant(binding_name, rec->typed_reader, offset);
150 } else {
151 rec->bindings->bind_push_constant(binding_name, rec->reader, offset, format);
152 }
153 rec->binding_names.push_back(std::move(binding_name));
154}
#define MF_ERROR(comp, ctx,...)
uint64_t offset
Definition Composite.cpp:10
bool format
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.
Buffers::BufferManager & m_buffer_manager
Definition Bridge.hpp:694
ElementRecord * find_record(const ElementRef &ref)
Definition Bridge.cpp:406
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
@ Init
Engine/subsystem initialization.
@ Portal
High-level user-facing API layer.

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

+ Here is the call graph for this function: