MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Vruta::graphics_promise Struct Reference

Coroutine promise type for graphics processing tasks with frame-accurate timing. More...

#include <Promise.hpp>

+ Inheritance diagram for MayaFlux::Vruta::graphics_promise:
+ Collaboration diagram for MayaFlux::Vruta::graphics_promise:

Public Member Functions

GraphicsRoutine get_return_object ()
 Creates the GraphicsRoutine object returned to the caller.
 
- Public Member Functions inherited from MayaFlux::Vruta::routine_promise< GraphicsRoutine >
GraphicsRoutine get_return_object ()
 
std::suspend_never initial_suspend ()
 Determines whether the coroutine suspends immediately upon creation.
 
std::suspend_always final_suspend () noexcept
 Determines whether the coroutine suspends before destruction.
 
void return_void ()
 Handles the coroutine's void return.
 
void unhandled_exception ()
 Handles exceptions thrown from within the coroutine.
 
void set_state (const std::string &key, T value)
 Stores a value in the state dictionary.
 
T * get_state (const std::string &key)
 Retrieves a value from the state dictionary.
 
void domain_mismatch_error (const std::string &awaiter_name, const std::string &suggestion)
 

Public Attributes

ProcessingToken processing_token { ProcessingToken::FRAME_ACCURATE }
 Processing token indicating frame-accurate scheduling.
 
bool sync_to_clock = true
 Whether this routine should synchronize with FrameClock.
 
uint64_t next_frame = 0
 The frame position when this coroutine should next execute.
 
DelayContext active_delay_context = DelayContext::NONE
 The active delay context for this coroutine.
 
uint64_t delay_amount = 0
 The amount of delay units for incremental delays.
 
- Public Attributes inherited from MayaFlux::Vruta::routine_promise< GraphicsRoutine >
const ProcessingToken processing_token
 Token indicating how this coroutine should be processed.
 
bool auto_resume
 Flag indicating whether the coroutine should be automatically resumed.
 
bool should_terminate
 Flag indicating whether the coroutine should be terminated.
 
std::unordered_map< std::string, std::any > state
 Dictionary for storing arbitrary state data.
 
const bool sync_to_clock
 Flag indicating whether the coroutine should synchronize with the audio clock.
 
uint64_t delay_amount
 Amount of delay requested by the coroutine.
 

Detailed Description

Coroutine promise type for graphics processing tasks with frame-accurate timing.

graphics_promise is the frame-domain equivalent of audio_promise. It manages the state and lifecycle of GraphicsRoutine coroutines, providing frame-accurate timing and scheduling for visual processing tasks.

Key Architectural Notes:

  • Frame timing is managed by FrameClock (self-driven wall-clock based)
  • Unlike audio_promise (driven by RTAudio callbacks), graphics_promise observes the FrameClock which ticks independently in the graphics thread loop
  • The promise doesn't care HOW timing advances, only that it receives tick updates
  • Mirrors audio_promise architecture but for the visual/frame domain

Timing Flow:

  1. Graphics thread loop: m_frame_clock->tick() (self-driven)
  2. GraphicsSubsystem::process() called
  3. Scheduler::process_frame_coroutines_impl() checks routines
  4. If current_frame >= next_frame, routine->try_resume(current_frame)
  5. Routine updates next_frame based on FrameDelay amount

Definition at line 259 of file Promise.hpp.


The documentation for this struct was generated from the following files: