Route render context lifecycle through platform services
This commit is contained in:
45
src/app.cpp
45
src/app.cpp
@@ -16,15 +16,7 @@
|
||||
#endif
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
void android_async_lock();
|
||||
void android_async_swap();
|
||||
void android_async_unlock();
|
||||
#elif _WIN32
|
||||
bool async_lock_try();
|
||||
void async_lock();
|
||||
void win32_async_swap();
|
||||
void async_unlock();
|
||||
#ifdef _WIN32
|
||||
void win32_renderdoc_frame_start();
|
||||
void win32_renderdoc_frame_end();
|
||||
#elif __LINUX__
|
||||
@@ -609,18 +601,7 @@ void App::init()
|
||||
|
||||
void App::async_start()
|
||||
{
|
||||
#if __OSX__
|
||||
[osx_view async_lock];
|
||||
#elif __IOS__
|
||||
[ios_view async_lock];
|
||||
#elif __ANDROID__
|
||||
android_async_lock();
|
||||
#elif _WIN32
|
||||
async_lock();
|
||||
glBindFramebuffer(framebuffer_target(), default_framebuffer_id());
|
||||
#elif __LINUX__ || __WEB__
|
||||
glfwMakeContextCurrent(glfw_window);
|
||||
#endif
|
||||
acquire_render_context();
|
||||
}
|
||||
|
||||
void App::async_redraw()
|
||||
@@ -631,30 +612,12 @@ void App::async_redraw()
|
||||
|
||||
void App::async_end()
|
||||
{
|
||||
#if __OSX__
|
||||
[osx_view async_unlock];
|
||||
#elif __IOS__
|
||||
[ios_view async_unlock];
|
||||
#elif __ANDROID__
|
||||
android_async_unlock();
|
||||
#elif _WIN32
|
||||
async_unlock();
|
||||
#endif
|
||||
release_render_context();
|
||||
}
|
||||
|
||||
void App::async_swap()
|
||||
{
|
||||
#if __OSX__
|
||||
[osx_view async_swap];
|
||||
#elif __IOS__
|
||||
[ios_view async_swap];
|
||||
#elif __ANDROID__
|
||||
android_async_swap();
|
||||
#elif _WIN32
|
||||
win32_async_swap();
|
||||
#elif __LINUX__ || __WEB__
|
||||
glfwSwapBuffers(glfw_window);
|
||||
#endif
|
||||
present_render_context();
|
||||
}
|
||||
|
||||
bool App::update_ui_observer(Node *n)
|
||||
|
||||
Reference in New Issue
Block a user