Route render capture hooks through platform services

This commit is contained in:
2026-06-03 04:54:29 +02:00
parent 7a9b14a86f
commit beb7f717f1
10 changed files with 76 additions and 18 deletions

View File

@@ -16,10 +16,7 @@
#endif
#include "settings.h"
#ifdef _WIN32
void win32_renderdoc_frame_start();
void win32_renderdoc_frame_end();
#elif __LINUX__
#ifdef __LINUX__
std::string linux_home_path();
int mkpath(const std::string& dir, mode_t mode = DEFFILEMODE);
#elif __WEB__
@@ -818,16 +815,12 @@ std::string App::res_to_string(int res)
void App::renderdoc_frame_start()
{
#if __WIN__
win32_renderdoc_frame_start();
#endif
begin_render_capture_frame();
}
void App::renderdoc_frame_end()
{
#if __WIN__
win32_renderdoc_frame_end();
#endif
end_render_capture_frame();
}
void App::rec_clear()

View File

@@ -195,6 +195,8 @@ public:
void acquire_render_context();
void release_render_context();
void present_render_context();
void begin_render_capture_frame();
void end_render_capture_frame();
void update_platform_frame(float delta_time_seconds);
void report_rendered_frames(int frames);
void save_prepared_file(

View File

@@ -244,6 +244,16 @@ void App::present_render_context()
active_platform_services().present_render_context();
}
void App::begin_render_capture_frame()
{
active_platform_services().begin_render_capture_frame();
}
void App::end_render_capture_frame()
{
active_platform_services().end_render_capture_frame();
}
void App::update_platform_frame(float delta_time_seconds)
{
active_platform_services().update_platform_frame(delta_time_seconds);

View File

@@ -23,6 +23,8 @@ public:
virtual void acquire_render_context() = 0;
virtual void release_render_context() = 0;
virtual void present_render_context() = 0;
virtual void begin_render_capture_frame() = 0;
virtual void end_render_capture_frame() = 0;
virtual void update_platform_frame(float delta_time_seconds) = 0;
virtual void report_rendered_frames(int frames) = 0;
virtual void display_file(std::string_view path) = 0;

View File

@@ -144,6 +144,14 @@ public:
#endif
}
void begin_render_capture_frame() override
{
}
void end_render_capture_frame() override
{
}
void update_platform_frame(float delta_time_seconds) override
{
(void)delta_time_seconds;

View File

@@ -13,6 +13,8 @@ void destroy_window();
void async_lock();
void async_unlock();
void win32_async_swap();
void win32_renderdoc_frame_start();
void win32_renderdoc_frame_end();
void win32_update_fps(int frames);
void win32_update_stylus(float dt);
@@ -201,6 +203,16 @@ public:
win32_async_swap();
}
void begin_render_capture_frame() override
{
win32_renderdoc_frame_start();
}
void end_render_capture_frame() override
{
win32_renderdoc_frame_end();
}
void update_platform_frame(float delta_time_seconds) override
{
win32_update_stylus(delta_time_seconds);