MayaFlux 0.1.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 133 of file GraphicsSubsystem.cpp.

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