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

◆ feed() [2/2]

void MayaFlux::Buffers::ShaderProcessor::feed ( const std::string &  name,
FeedSource  source,
uint32_t  offset,
size_t  size = sizeof(float) 
)

Supply a push constant from a callable at an explicit offset.

Parameters
nameLogical name, used for removal and error reporting. Need not match anything on the shader.
sourceCallable returning a double.
offsetByte offset in the push constant block.
sizeByte width written. Four narrows to float, eight keeps double. Other values are rejected.

The form hand-written shaders need, since their push constant block is described nowhere the processor can read.

Definition at line 255 of file ShaderProcessor.cpp.

256{
257 if (!source) {
259 "feed: null source for '{}'", name);
260 return;
261 }
262
263 if (size != sizeof(float) && size != sizeof(double)) {
265 "feed: '{}' requests {} bytes, only 4 or 8 are written", name, size);
266 return;
267 }
268
269 auto& entry = m_feeds[name];
270 entry.source = std::move(source);
271 entry.is_storage = false;
272 entry.offset = offset;
273 entry.size = size;
274 entry.descriptor_name.clear();
275 entry.buffer.reset();
276 entry.mismatch_logged = false;
277}
#define MF_ERROR(comp, ctx,...)
float offset
std::unordered_map< std::string, Feed > m_feeds
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_feeds, MF_ERROR, and offset.