add general async swap

This commit is contained in:
2019-07-10 23:33:46 +02:00
parent f5d885a3f4
commit 80b9a4d281
3 changed files with 22 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ void android_async_unlock(struct engine* engine);
#elif _WIN32
bool async_lock_try();
void async_lock();
void async_swap();
void win32_async_swap();
void async_unlock();
void destroy_window();
#endif
@@ -521,6 +521,19 @@ void App::async_end()
#endif
}
void App::async_swap()
{
#if __OSX__
[osx_view async_swap];
#elif __IOS__
[ios_view async_swap];
#elif __ANDROID__
android_async_swap(and_engine);
#elif _WIN32
win32_async_swap();
#endif
}
bool App::update_ui_observer(Node *n)
{
if (n && n->m_display)
@@ -1039,7 +1052,7 @@ void App::render_thread_main()
// execute the tasks
if (!working_list.empty())
{
async_lock();
async_start();
while (!working_list.empty())
{
//LOG("render task %d", count);
@@ -1047,7 +1060,7 @@ void App::render_thread_main()
working_list.front()();
working_list.pop_front();
}
async_unlock();
async_end();
}
}
}