MayaFlux 0.5.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 96 of file NodeBindingsProcessor.cpp.

97{
98 if (m_bindings.empty()) {
100 "No node bindings configured for NodeBindingsProcessor");
101 return;
102 }
103
104 auto& pc_data = get_push_constant_data();
105
106 for (auto& [name, binding] : m_bindings) {
107 size_t required_size = binding.push_constant_offset + binding.size;
108 if (pc_data.size() < required_size) {
109 pc_data.resize(required_size);
110 }
111
112 if (!binding.node) {
114 "Node binding '{}' has null node", name);
115 continue;
116 }
117
118 double value {};
119 ProcessingMode mode = binding.processing_mode.load(std::memory_order_acquire);
120
121 if (mode == ProcessingMode::INTERNAL) {
123 } else {
124 value = binding.node->get_last_output();
125 }
126
127 if (binding.size == sizeof(float)) {
128 auto float_val = static_cast<float>(value);
129 std::memcpy(
130 pc_data.data() + binding.push_constant_offset,
131 &float_val,
132 sizeof(float));
133 } else if (binding.size == sizeof(double)) {
134 std::memcpy(
135 pc_data.data() + binding.push_constant_offset,
136 &value,
137 sizeof(double));
138 }
139 }
140}
#define MF_RT_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
float value
@ 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, MF_WARN, and value.

Referenced by execute_shader().

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