49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
#pragma once
|
|
#include "../architecture/global.h"
|
|
#include "../execution/Render_Executor.h"
|
|
#include "Task.h"
|
|
#include <cstdint>
|
|
namespace asio {
|
|
class io_context;
|
|
}
|
|
namespace renderive {
|
|
class Plot_Core;
|
|
struct Render_Scheduler_Private;
|
|
class LIB_DECL Render_Scheduler {
|
|
public:
|
|
Render_Scheduler();
|
|
~Render_Scheduler();
|
|
void start(Render_Runtime_Config config = {});
|
|
void shutdown();
|
|
void post(Task task);
|
|
void post_at(std::uint64_t steady_time_ns, Task task);
|
|
bool try_submit_render_task(Render_Executor_Task task);
|
|
[[nodiscard]] Render_Executor_Snapshot render_executor_snapshot() const;
|
|
[[nodiscard]] std::size_t render_worker_count() const;
|
|
void register_plot(Plot_Core* plot);
|
|
void remove_plot(Plot_Core* plot);
|
|
[[nodiscard]] bool is_scheduler_thread() const;
|
|
[[nodiscard]] bool is_running() const;
|
|
asio::io_context& io_context();
|
|
private:
|
|
void post_and_wait(Task task);
|
|
void register_plot_on_scheduler(Plot_Core* plot);
|
|
void remove_plot_on_scheduler(Plot_Core* plot);
|
|
void shutdown_on_scheduler();
|
|
void initialize_plot_on_scheduler(Plot_Core* plot);
|
|
std::unique_ptr<Render_Scheduler_Private> d;
|
|
};
|
|
class LIB_DECL Global {
|
|
public:
|
|
static Global* instance();
|
|
static void destroy();
|
|
Global();
|
|
Global(const Global&) = delete;
|
|
Global& operator=(const Global&) = delete;
|
|
Render_Scheduler& render_scheduler();
|
|
void start_render_scheduler(Render_Runtime_Config config = {});
|
|
private:
|
|
Render_Scheduler render_scheduler_value;
|
|
};
|
|
} // namespace renderive
|