512{
513 if (!binding.node) {
515 "Binding has null node");
516 return;
517 }
518
519 float value {};
520
523 } else {
524 value = static_cast<float>(binding.node->get_last_output());
525 }
526 Nodes::NodeContext& ctx = binding.node->get_last_context();
527
528 switch (binding.binding_type) {
529
532 upload_to_gpu(&value,
sizeof(
float), binding.gpu_buffer,
nullptr);
533 break;
534 }
535
537 auto* gpu_vec = dynamic_cast<Nodes::GpuVectorData*>(&ctx);
538 if (!gpu_vec || !gpu_vec->has_gpu_data()) {
540 "Node context does not provide GpuVectorData");
541 return;
542 }
543
544 auto data = gpu_vec->gpu_data();
545
547 upload_to_gpu(data.data(), data.size_bytes(), binding.gpu_buffer,
nullptr);
548 break;
549 }
550
552 auto* gpu_mat = dynamic_cast<Nodes::GpuMatrixData*>(&ctx);
553 if (!gpu_mat || !gpu_mat->has_gpu_data()) {
555 "Node context does not provide GpuMatrixData");
556 return;
557 }
558
559 auto data = gpu_mat->gpu_data();
561 upload_to_gpu(data.data(), data.size_bytes(), binding.gpu_buffer,
nullptr);
562 break;
563 }
564
566 auto* gpu_struct = dynamic_cast<Nodes::GpuStructuredData*>(&ctx);
567 if (!gpu_struct || !gpu_struct->has_gpu_data()) {
569 "Node context does not provide GpuStructuredData");
570 return;
571 }
572
573 auto data = gpu_struct->gpu_data();
575 upload_to_gpu(data.data(), data.size_bytes(), binding.gpu_buffer,
nullptr);
576 break;
577 }
578 }
579}
#define MF_RT_ERROR(comp, ctx,...)
void ensure_buffer_capacity(DescriptorBinding &binding, size_t required_size)
Ensure descriptor buffer has sufficient capacity.
@ INTERNAL
Processor calls extract_single_sample() or processes node context.
@ MATRIX
2D grid from MatrixContext
@ VECTOR
Array from VectorContext.
@ SCALAR
Single value from node output.
@ STRUCTURED
Array of structs from StructuredContext.
double extract_single_sample(const std::shared_ptr< Nodes::Node > &node)
Extract a single sample from a node with proper snapshot management.
void upload_to_gpu(const void *data, size_t size, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging)
Upload raw data to GPU buffer (auto-detects host-visible vs device-local)
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.