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

◆ process_frame_coroutines_impl()

void MayaFlux::Core::GraphicsSubsystem::process_frame_coroutines_impl ( const std::vector< std::shared_ptr< Vruta::Routine > > &  tasks,
uint64_t  processing_units 
)
private

Process all FRAME_ACCURATE coroutines for given frames.

Parameters
tasksVector of routines to process
processing_unitsNumber of frames to process

Advances the frame clock and processes all FRAME_ACCURATE tasks that are ready to execute for each frame. This is called from the graphics thread loop after ticking the frame clock.

Definition at line 136 of file GraphicsSubsystem.cpp.

139{
140 if (tasks.empty()) {
141 return;
142 }
143
144 uint64_t current_frame = m_frame_clock->current_position();
145
146 if (processing_units == 0) {
147 processing_units = 1;
148 }
149
150 for (uint64_t i = 0; i < processing_units; ++i) {
151 uint64_t frame_to_process = current_frame + i;
152
153 for (auto& routine : tasks) {
154 if (!routine || !routine->is_active()) {
155 continue;
156 }
157
158 if (routine->requires_clock_sync()) {
159 if (frame_to_process >= routine->next_execution()) {
160 routine->try_resume(frame_to_process);
161 }
162 } else {
163 routine->try_resume(frame_to_process);
164 }
165 }
166 }
167}
std::shared_ptr< Vruta::FrameClock > m_frame_clock

References m_frame_clock.

Referenced by register_frame_processor().

+ Here is the caller graph for this function: