MayaFlux 1.0.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),
bool  early = true 
)

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 or a GpuValue.
offsetByte offset in the push constant block.
sizeByte width written for a double. Four narrows to float, eight keeps double. Other values are rejected. A GpuValue writes its own width and ignores this.
earlyTrue writes at the top of processing_function. False writes after the final on_before_execute of a compute dispatch, which is the only way a value survives a processor that rewrites its whole push constant block there. Other dispatch kinds ignore false.

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

Definition at line 265 of file ShaderProcessor.cpp.

266{
267 if (!source) {
269 "feed: null source for '{}'", name);
270 return;
271 }
272
273 if (size != sizeof(float) && size != sizeof(double)) {
275 "feed: '{}' requests {} bytes, only 4 or 8 are written", name, size);
276 return;
277 }
278
279 auto& entry = m_feeds[name];
280 entry.source = std::move(source);
281 entry.is_storage = false;
282 entry.offset = offset;
283 entry.size = size;
284 entry.format.reset();
285 entry.descriptor_name.clear();
286 entry.buffer.reset();
287 entry.mismatch_logged = false;
288 entry.early = early;
289}
#define MF_ERROR(comp, ctx,...)
uint64_t offset
Definition Composite.cpp:10
bool size
std::string name
Definition VKDevice.cpp:123
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, name, offset, and size.