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 138 of file GraphicsSubsystem.cpp.

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