Renderer: Implement new render scheduling (#10936)

Implements a new render scheduling method, where we triple buffer when necessary.

Enabled by default, improves FPS on underpowered devices.

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
This commit is contained in:
Vaxry 2025-07-08 12:41:10 +02:00 committed by GitHub
parent 9856563f89
commit 8f948827a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 209 additions and 84 deletions

View file

@ -0,0 +1,35 @@
#pragma once
#include "Monitor.hpp"
#include <chrono>
class CEGLSync;
class CMonitorFrameScheduler {
public:
using hrc = std::chrono::high_resolution_clock;
CMonitorFrameScheduler(PHLMONITOR m);
CMonitorFrameScheduler(const CMonitorFrameScheduler&) = delete;
CMonitorFrameScheduler(CMonitorFrameScheduler&&) = delete;
CMonitorFrameScheduler& operator=(const CMonitorFrameScheduler&) = delete;
CMonitorFrameScheduler& operator=(CMonitorFrameScheduler&&) = delete;
void onSyncFired();
void onPresented();
void onFrame();
private:
bool canRender();
void onFinishRender();
bool m_renderAtFrame = true;
bool m_pendingThird = false;
hrc::time_point m_lastRenderBegun;
PHLMONITORREF m_monitor;
UP<CEGLSync> m_sync;
};