44 lines
910 B
C++
44 lines
910 B
C++
#pragma once
|
|
#include "../architecture/Frame_Scheduler.h"
|
|
#include <cstdint>
|
|
|
|
namespace renderive {
|
|
|
|
enum class Refresh_Trigger : std::uint8_t {
|
|
Started,
|
|
Input_Dirty,
|
|
Render_Finished,
|
|
Paint_Finished,
|
|
Frame_Returned,
|
|
Timer_Fired,
|
|
Manual_Request,
|
|
Paused
|
|
};
|
|
|
|
struct Refresh_Runtime_Snapshot {
|
|
bool enabled{};
|
|
bool destroying{};
|
|
bool dirty{};
|
|
bool render_job_active{};
|
|
bool middle_has_new_frame{};
|
|
bool paint_active{};
|
|
std::uint64_t now_ns{};
|
|
};
|
|
|
|
struct Refresh_Action {
|
|
bool try_render{};
|
|
bool request_paint{};
|
|
std::uint64_t render_deadline_ns{};
|
|
};
|
|
|
|
class Refresh_Strategy {
|
|
public:
|
|
virtual ~Refresh_Strategy() = default;
|
|
[[nodiscard]] virtual Refresh_Action on_trigger(
|
|
Refresh_Trigger trigger,
|
|
const Refresh_Runtime_Snapshot& runtime,
|
|
const Frame_Lifecycle_Record* frame) = 0;
|
|
};
|
|
|
|
} // namespace renderive
|