MayaFlux 0.2.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 61 of file NodeBindingsProcessor.cpp.

62{
63 if (m_bindings.empty()) {
65 "No node bindings configured for NodeBindingsProcessor");
66 return;
67 }
68
69 auto& pc_data = get_push_constant_data();
70
71 for (auto& [name, binding] : m_bindings) {
72 size_t required_size = binding.push_constant_offset + binding.size;
73 if (pc_data.size() < required_size) {
74 pc_data.resize(required_size);
75 }
76
77 if (!binding.node) {
79 "Node binding '{}' has null node", name);
80 continue;
81 }
82
83 double value = Buffers::extract_single_sample(binding.node);
84
85 if (binding.size == sizeof(float)) {
86 auto float_val = static_cast<float>(value);
87 std::memcpy(
88 pc_data.data() + binding.push_constant_offset,
89 &float_val,
90 sizeof(float));
91 } else if (binding.size == sizeof(double)) {
92 std::memcpy(
93 pc_data.data() + binding.push_constant_offset,
94 &value,
95 sizeof(double));
96 }
97 }
98}
#define MF_RT_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
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.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::extract_single_sample(), MayaFlux::Buffers::ShaderProcessor::get_push_constant_data(), 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: