MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
GraphicsBackend.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace MayaFlux::Core {
6
7class Window;
8
9class MAYAFLUX_API IGraphicsBackend {
10public:
11 virtual ~IGraphicsBackend() = default;
12
13 /**
14 * @brief Initialize the graphics backend with global configuration
15 * @param config Global graphics configuration
16 * @return True if initialization was successful, false otherwise
17 */
18 virtual bool initialize(const GlobalGraphicsConfig& config) = 0;
19
20 /**
21 * @brief Cleanup the graphics backend and release all resources
22 */
23 virtual void cleanup() = 0;
24
25 /**
26 * @brief Get the type of the graphics backend
27 * @return GraphicsApi enum value representing the backend type
28 */
30
31 /**
32 * @brief Register a window with the graphics backend for rendering
33 * @param window Shared pointer to the window to register
34 * @return True if registration was successful, false otherwise
35 */
36 virtual bool register_window(std::shared_ptr<Window> window) = 0;
37
38 /**
39 * @brief Unregister a window from the graphics backend
40 * @param window Shared pointer to the window to unregister
41 */
42 virtual void unregister_window(std::shared_ptr<Window> window) = 0;
43
44 /**
45 * @brief Check if a window is registered with the graphics backend
46 * @param window Shared pointer to the window to check
47 * @return True if the window is registered, false otherwise
48 */
49 [[nodiscard]]
50 virtual bool is_window_registered(std::shared_ptr<Window> window)
51 = 0;
52
53 /**
54 * @brief Begin rendering frame for the specified window
55 * @param window Shared pointer to the window to begin frame for
56 */
57 virtual void begin_frame(std::shared_ptr<Window> window) = 0;
58
59 /**
60 * @brief Render the contents of the specified window
61 * @param window Shared pointer to the window to render
62 */
63 virtual void render_window(std::shared_ptr<Window> window) = 0;
64
65 /**
66 * @brief Render all registered windows (batch optimization)
67 * Default: calls render_window() for each registered window
68 */
69 virtual void render_all_windows() = 0;
70
71 /**
72 * @brief End rendering frame for the specified window
73 * @param window Shared pointer to the window to end frame for
74 */
75 virtual void end_frame(std::shared_ptr<Window> window) = 0;
76
77 /**
78 * @brief Wait until the graphics backend is idle
79 */
80 virtual void wait_idle() = 0;
81
82 /**
83 * @brief Handle window resize event for the specified window
84 */
85 virtual void handle_window_resize() = 0;
86
87 /**
88 * @brief Get context pointer specific to the graphics backend (e.g., OpenGL context, Vulkan instance, etc.)
89 */
90 virtual void* get_native_context() = 0;
91 [[nodiscard]] virtual const void* get_native_context() const = 0;
92};
93
94}
virtual void render_all_windows()=0
Render all registered windows (batch optimization) Default: calls render_window() for each registered...
virtual bool is_window_registered(std::shared_ptr< Window > window)=0
Check if a window is registered with the graphics backend.
virtual void handle_window_resize()=0
Handle window resize event for the specified window.
virtual const void * get_native_context() const =0
virtual GlobalGraphicsConfig::GraphicsApi get_backend_type()=0
Get the type of the graphics backend.
virtual void unregister_window(std::shared_ptr< Window > window)=0
Unregister a window from the graphics backend.
virtual ~IGraphicsBackend()=default
virtual void render_window(std::shared_ptr< Window > window)=0
Render the contents of the specified window.
virtual bool register_window(std::shared_ptr< Window > window)=0
Register a window with the graphics backend for rendering.
virtual void cleanup()=0
Cleanup the graphics backend and release all resources.
virtual void * get_native_context()=0
Get context pointer specific to the graphics backend (e.g., OpenGL context, Vulkan instance,...
virtual void end_frame(std::shared_ptr< Window > window)=0
End rendering frame for the specified window.
virtual bool initialize(const GlobalGraphicsConfig &config)=0
Initialize the graphics backend with global configuration.
virtual void wait_idle()=0
Wait until the graphics backend is idle.
virtual void begin_frame(std::shared_ptr< Window > window)=0
Begin rendering frame for the specified window.