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

◆ bind_push_constant() [4/4]

template<typename T >
void MayaFlux::Buffers::FormaBindingsProcessor::bind_push_constant ( const std::string &  name,
std::shared_ptr< Portal::Forma::MappedState< T > >  state,
std::function< float(T)>  project,
uint32_t  offset,
size_t  size = sizeof(float) 
)
inline

Bind a MappedState<T> to a push constant slot on an external ShaderProcessor.

Parameters
nameLogical binding name for introspection and unbind.
stateMappedState whose value is read each graphics tick.
projectProjection from T to float. Called every tick. the value at offset. Any subclass is valid.
offsetByte offset in the target's push constant struct.
sizeByte width of the written value. Defaults to sizeof(float).
Template Parameters
TMappedState value type.

Definition at line 163 of file FormaBindingsProcessor.hpp.

169 {
170 if (!state) {
172 "FormaBindingsProcessor::bind_push_constant: null state for '{}'", name);
173 return;
174 }
175
176 release(name);
177 auto& b = m_bindings[name];
179 b.reader = [s = std::move(state), p = std::move(project)]() {
180 return p(s->value);
181 };
182 b.pc = PushConstantTarget { .offset = offset, .size = size };
183 b.desc.reset();
184 }
#define MF_ERROR(comp, ctx,...)
uint64_t offset
Definition Composite.cpp:10
bool size
size_t b
std::string name
Definition VKDevice.cpp:123
std::unordered_map< std::string, Binding > m_bindings
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References b, MF_ERROR, name, MayaFlux::Buffers::FormaBindingsProcessor::PushConstantTarget::offset, offset, and size.