Route render context lifecycle through platform services

This commit is contained in:
2026-06-03 04:50:42 +02:00
parent f3925f8423
commit 7a9b14a86f
10 changed files with 134 additions and 49 deletions

View File

@@ -1,6 +1,8 @@
#include "pch.h"
#include "platform_windows/windows_platform_services.h"
#include "renderer_gl/opengl_capabilities.h"
#include <deque>
extern HWND hWnd;
@@ -8,6 +10,9 @@ extern std::deque<std::packaged_task<void()>> main_tasklist;
extern std::mutex main_task_mutex;
void destroy_window();
void async_lock();
void async_unlock();
void win32_async_swap();
void win32_update_fps(int frames);
void win32_update_stylus(float dt);
@@ -178,6 +183,24 @@ public:
{
}
void acquire_render_context() override
{
async_lock();
glBindFramebuffer(
static_cast<GLenum>(pp::renderer::gl::framebuffer_target()),
static_cast<GLuint>(pp::renderer::gl::default_framebuffer_id()));
}
void release_render_context() override
{
async_unlock();
}
void present_render_context() override
{
win32_async_swap();
}
void update_platform_frame(float delta_time_seconds) override
{
win32_update_stylus(delta_time_seconds);