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

◆ bind_push_constant() [2/2]

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 128 of file FormaBindingsProcessor.hpp.

134 {
135 if (!state) {
137 "FormaBindingsProcessor::bind_push_constant: null state for '{}'", name);
138 return;
139 }
140
141 auto& b = m_bindings[name];
143 b.reader = [s = std::move(state), p = std::move(project)]() {
144 return p(s->value);
145 };
146 b.pc = PushConstantTarget { .offset = offset, .size = size };
147 b.desc.reset();
148 }
#define MF_ERROR(comp, ctx,...)
size_t b
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, and MayaFlux::Buffers::FormaBindingsProcessor::PushConstantTarget::offset.