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

◆ flush_push_constant()

void MayaFlux::Buffers::FormaBindingsProcessor::flush_push_constant ( const std::string &  name,
float  value,
const PushConstantTarget &  pc,
const std::shared_ptr< VKBuffer > &  buffer 
)
private

Definition at line 240 of file FormaBindingsProcessor.cpp.

245{
246 auto& entries = buffer->get_pipeline_context().push_constant_bindings;
247
248 auto it = std::ranges::find_if(entries, [&](const auto& e) {
249 return e.offset == pc.offset;
250 });
251
252 if (it == entries.end()) {
253 entries.push_back(Portal::Graphics::PushConstantBindingInfo {
254 .offset = pc.offset,
255 .data = std::vector<uint8_t>(pc.size),
256 .name = name });
257 it = std::prev(entries.end());
258 }
259
260 if (pc.format) {
261 const bool packed = Kakshya::pack_gpu_value(*pc.format, value,
262 std::span<std::byte>(reinterpret_cast<std::byte*>(it->data.data()), it->data.size()));
263 if (!packed) {
265 "FormaBindingsProcessor: binding '{}' does not fit its push constant slot", name);
266 }
267 } else if (pc.size == sizeof(float)) {
268 std::memcpy(it->data.data(), &value, sizeof(float));
269 } else if (pc.size == sizeof(double)) {
270 auto promoted = static_cast<double>(value);
271 std::memcpy(it->data.data(), &promoted, sizeof(double));
272 }
273
275 "FormaBindingsProcessor: PC write offset={} value={}", pc.offset, value);
276}
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_DEBUG(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
glm::vec3 value
std::string name
Definition VKDevice.cpp:123
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
bool pack_gpu_value(GpuDataFormat dst, const T &value, std::span< std::byte > out) noexcept
Writes a typed value into out as one element of dst.

References buffer, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::FormaBindingsProcessor::PushConstantTarget::format, MF_RT_DEBUG, MF_RT_WARN, name, MayaFlux::Buffers::FormaBindingsProcessor::PushConstantTarget::offset, MayaFlux::Portal::Graphics::PushConstantBindingInfo::offset, MayaFlux::Kakshya::pack_gpu_value(), MayaFlux::Buffers::FormaBindingsProcessor::PushConstantTarget::size, and value.

Referenced by execute_shader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: