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

◆ bind_push_constant() [1/4]

void MayaFlux::Buffers::FormaBindingsProcessor::bind_push_constant ( const std::string &  name,
std::function< float()>  reader,
uint32_t  offset,
Kakshya::GpuDataFormat  format 
)

Bind a type-erased reader to a push constant slot described by a GpuDataFormat.

The reader's value is converted to the format; integers saturate. The format must have a single component, since the reader produces one value.

Parameters
nameLogical binding name.
readerCallable returning the current value each tick.
offsetByte offset in the push constant struct.
formatLayout written at the offset.

Definition at line 46 of file FormaBindingsProcessor.cpp.

51{
52 if (!reader) {
54 "FormaBindingsProcessor::bind_push_constant: null reader for '{}'", name);
55 return;
56 }
57
60 "FormaBindingsProcessor::bind_push_constant: '{}' needs a single component format",
61 name);
62 return;
63 }
64
66 auto& b = m_bindings[name];
68 b.reader = std::move(reader);
69 b.typed_reader = nullptr;
70 b.pc = PushConstantTarget { .offset = offset, .size = Kakshya::gpu_data_format_bytes(format), .format = format };
71 b.desc.reset();
72}
#define MF_ERROR(comp, ctx,...)
uint64_t offset
Definition Composite.cpp:10
bool format
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.
size_t gpu_data_format_bytes(GpuDataFormat fmt) noexcept
Byte size of one element of a GpuDataFormat.
size_t gpu_data_format_components(GpuDataFormat fmt) noexcept
Number of scalar components in one element of a GpuDataFormat.

References b, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, format, MayaFlux::Kakshya::gpu_data_format_bytes(), MayaFlux::Kakshya::gpu_data_format_components(), m_bindings, MF_ERROR, name, MayaFlux::Buffers::FormaBindingsProcessor::PushConstantTarget::offset, offset, PUSH_CONSTANT, and release().

+ Here is the call graph for this function: