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

◆ process()

void MayaFlux::Buffers::BufferProcessingChain::process ( const std::shared_ptr< Buffer > &  buffer)

Applies the transformation pipeline to a buffer with intelligent execution.

Parameters
bufferBuffer to transform

Applies each processor in the buffer's sequence using an optimized execution strategy. The chain leverages processor capabilities for maximum performance:

  • Backend Optimization: Uses processor-recommended backends when beneficial
  • Parallel Execution: Executes compatible processors in parallel when possible
  • Resource Management: Optimally allocates CPU, GPU, and memory resources
  • Error Handling: Provides robust error recovery and fallback mechanisms

This does not include the final processor, which must be applied separately with process_final() to ensure proper pipeline completion.

Definition at line 175 of file BufferProcessingChain.cpp.

176{
177 bool expected = false;
178 if (!m_is_processing.compare_exchange_strong(expected, true,
179 std::memory_order_acquire, std::memory_order_relaxed)) {
180 return;
181 }
182
183 if (m_pending_count.load(std::memory_order_relaxed) > 0) {
185 }
186
187 auto it = m_buffer_processors.find(buffer);
188 if (it == m_buffer_processors.end() || it->second.empty()) {
189 m_is_processing.store(false, std::memory_order_release);
190 return;
191 }
192
193 for (auto& processor : it->second) {
194 bool should_process = true;
195
197 auto processor_token = processor->get_processing_token();
198 should_process = are_tokens_compatible(m_token_filter_mask, processor_token);
199 }
200
201 if (should_process) {
202 processor->process(buffer);
203 }
204 }
205
208 }
209
210 m_is_processing.store(false, std::memory_order_release);
211}
std::shared_ptr< NetworkGeometryBuffer > buffer
ProcessingToken m_token_filter_mask
Preferred processing token for this chain.
std::unordered_map< std::shared_ptr< Buffer >, std::vector< std::shared_ptr< BufferProcessor > > > m_buffer_processors
Map of buffers to their processor sequences.
void cleanup_rejected_processors(const std::shared_ptr< Buffer > &buffer)
Validates the processing token against the chain's preferred token.
void process_pending_processor_operations()
Process pending processor operations.
TokenEnforcementStrategy m_enforcement_strategy
Token enforcement strategy for this chain.
bool are_tokens_compatible(ProcessingToken preferred, ProcessingToken current)
Determines if two processing tokens are compatible for joint execution.
@ OVERRIDE_SKIP
Allows token overrides but skips processing for incompatible operations.
@ OVERRIDE_REJECT
Allows token overrides but rejects incompatible processors from chains.

References MayaFlux::Buffers::are_tokens_compatible(), buffer, cleanup_rejected_processors(), m_buffer_processors, m_enforcement_strategy, m_is_processing, m_pending_count, m_token_filter_mask, MayaFlux::Buffers::OVERRIDE_REJECT, MayaFlux::Buffers::OVERRIDE_SKIP, and process_pending_processor_operations().

Referenced by process_complete().

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