MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Core::GraphicsSubsystem Class Reference

Backend agnostic graphics subsystem for visual processing. More...

#include <GraphicsSubsystem.hpp>

+ Inheritance diagram for MayaFlux::Core::GraphicsSubsystem:
+ Collaboration diagram for MayaFlux::Core::GraphicsSubsystem:

Public Member Functions

 GraphicsSubsystem (const GlobalGraphicsConfig &graphics_config)
 GraphicsSubsystem constructor.
 
 ~GraphicsSubsystem () override
 
void initialize (SubsystemProcessingHandle &handle) override
 Initialize with graphics configuration.
 
void register_callbacks () override
 Register callback hooks for this domain.
 
void start () override
 Start the subsystem's processing/event loops.
 
void stop () override
 Stop the subsystem's processing/event loops.
 
void pause () override
 Pause the subsystem's processing/event loops.
 
void resume () override
 Resume the subsystem's processing/event loops.
 
SubsystemTokens get_tokens () const override
 Get the processing token configuration this subsystem manages.
 
Vruta::FrameClockget_frame_clock ()
 Get frame clock.
 
const Vruta::FrameClockget_frame_clock () const
 
std::thread::id get_graphics_thread_id () const
 Get graphics thread ID.
 
bool is_graphics_thread () const
 Check if currently on graphics thread.
 
uint32_t get_target_fps () const
 Get target frame rate.
 
double get_measured_fps () const
 Get actual measured FPS.
 
void set_target_fps (uint32_t fps)
 Set target frame rate (can be changed at runtime)
 
void process ()
 Unified processing callback (alternative to separate methods)
 
void register_windows_for_processing ()
 Register markend windows from window manager for swapchain processing.
 
void render_all_windows ()
 Render all registered windows.
 
bool is_ready () const override
 Check if subsystem is ready for operation.
 
bool is_running () const override
 Check if subsystem is currently processing.
 
void shutdown () override
 Shutdown and cleanup subsystem resources.
 
SubsystemType get_type () const override
 Get the type of this subsystem.
 
SubsystemProcessingHandleget_processing_context_handle () override
 Get the processing context handle for this subsystem.
 
IGraphicsBackendget_backend ()
 Get underlying graphics backend for advanced usage Can be cast to VulkanBackend* or OpenGLBackend* for backend-specific operations.
 
const IGraphicsBackendget_backend () const
 
GlobalGraphicsConfig::GraphicsApi get_backend_type () const
 Get the type of the graphics backend.
 
- Public Member Functions inherited from MayaFlux::Core::ISubsystem
virtual ~ISubsystem ()=default
 

Private Member Functions

void initialize_graphics_portal ()
 Initialize Portal::Graphics subsystem.
 
void register_frame_processor ()
 Register custom frame processor with scheduler.
 
void graphics_thread_loop ()
 Graphics thread main loop.
 
void process_frame_coroutines_impl (const std::vector< std::shared_ptr< Vruta::Routine > > &tasks, uint64_t processing_units)
 Process all FRAME_ACCURATE coroutines for given frames.
 
void cleanup_closed_windows ()
 Cleanup resources for windows that have been closed.
 

Private Attributes

std::unique_ptr< IGraphicsBackendm_backend
 
std::shared_ptr< Vruta::FrameClockm_frame_clock
 
std::thread m_graphics_thread
 
std::thread::id m_graphics_thread_id
 
std::atomic< bool > m_running { false }
 
std::atomic< bool > m_paused { false }
 
std::vector< std::shared_ptr< Window > > m_registered_windows
 
bool m_is_ready {}
 
SubsystemTokens m_subsystem_tokens
 Processing token configuration.
 
SubsystemProcessingHandlem_handle
 Reference to processing handle.
 
GlobalGraphicsConfig m_graphics_config
 Graphics/windowing configuration.
 

Detailed Description

Backend agnostic graphics subsystem for visual processing.

Manages graphics thread, backend context, and frame-based processing. Parallel to AudioSubsystem but with self-driven timing model.

Key Architectural Differences from AudioSubsystem:

AudioSubsystem: RTAudio callback → process() → scheduler.tick(samples) Clock is externally driven by audio hardware

GraphicsSubsystem: Graphics thread loop → clock.tick() → process() → scheduler observes Clock is self-driven based on wall-clock time

The FrameClock manages its own timing and the subsystem's process methods are called from the graphics thread loop, not from an external callback.

Definition at line 35 of file GraphicsSubsystem.hpp.


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