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

◆ update_push_constants_from_nodes()

void MayaFlux::Buffers::NodeBindingsProcessor::update_push_constants_from_nodes ( )
private

Definition at line 92 of file NodeBindingsProcessor.cpp.

93{
94 if (m_bindings.empty()) {
96 "No node bindings configured for NodeBindingsProcessor");
97 return;
98 }
99
100 auto& pc_data = get_push_constant_data();
101
102 for (auto& [name, binding] : m_bindings) {
103 size_t required_size = binding.push_constant_offset + binding.size;
104 if (pc_data.size() < required_size) {
105 pc_data.resize(required_size);
106 }
107
108 if (!binding.node) {
110 "Node binding '{}' has null node", name);
111 continue;
112 }
113
114 double value {};
115 ProcessingMode mode = binding.processing_mode.load(std::memory_order_acquire);
116
117 if (mode == ProcessingMode::INTERNAL) {
118 value = Buffers::extract_single_sample(binding.node);
119 } else {
120 value = binding.node->get_last_output();
121 }
122
123 if (binding.size == sizeof(float)) {
124 auto float_val = static_cast<float>(value);
125 std::memcpy(
126 pc_data.data() + binding.push_constant_offset,
127 &float_val,
128 sizeof(float));
129 } else if (binding.size == sizeof(double)) {
130 std::memcpy(
131 pc_data.data() + binding.push_constant_offset,
132 &value,
133 sizeof(double));
134 }
135 }
136}
#define MF_RT_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
@ INTERNAL
Processor calls extract_single_sample() - owns the processing.
std::unordered_map< std::string, NodeBinding > m_bindings
const std::vector< uint8_t > & get_push_constant_data() const
Get current push constant data.
double extract_single_sample(const std::shared_ptr< Nodes::Node > &node)
Extract a single sample from a node with proper snapshot management.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::vector< double > mode(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Mode per window via tolerance-bucketed frequency count.
Definition Analysis.cpp:559

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::extract_single_sample(), MayaFlux::Buffers::ShaderProcessor::get_push_constant_data(), INTERNAL, m_bindings, MF_RT_ERROR, and MF_WARN.

Referenced by execute_shader().

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