implement multithreaded rendering with context switch, gl state save/restore, add progress bar ui node, implement stencil texture for brush, implement multithreaded canvas load/save/export pano. Missing multithread in windows.

This commit is contained in:
2017-10-20 09:16:12 +01:00
parent 32ede1be90
commit 283e4e2b5c
42 changed files with 610 additions and 65 deletions

View File

@@ -8,6 +8,12 @@
#include <Foundation/Foundation.h>
#endif
#ifdef __ANDROID__
void android_async_lock(struct engine* engine);
void android_async_swap(struct engine* engine);
void android_async_unlock(struct engine* engine);
#endif
using namespace ui;
App App::I; // singleton
@@ -113,6 +119,49 @@ void App::init()
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, width_range);
LOG("GL line range: %f - %f", width_range[0], width_range[1]);
LOG("Screen Size: %f %f", width, height);
GLint fb0;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fb0);
LOG("Default Framebuffer %d", fb0);
}
void App::async_start()
{
#if __OSX__
[osx_view async_lock];
#elif __IOS__
[ios_view async_lock];
#elif __ANDROID__
android_async_lock(and_engine);
#endif
}
void App::async_update()
{
#if __IOS__
[ios_view->glview bindDrawable];
#endif
redraw = true;
clear();
update(0);
#if __OSX__
[osx_view async_swap];
#elif __IOS__
[ios_view async_swap];
#elif __ANDROID__
android_async_swap(and_engine);
#endif
}
void App::async_end()
{
#if __OSX__
[osx_view async_unlock];
#elif __IOS__
[ios_view async_unlock];
#elif __ANDROID__
android_async_unlock(and_engine);
#endif
}
void App::update(float dt)
@@ -155,6 +204,11 @@ void App::update(float dt)
}
};
//glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
#if __IOS__
[ios_view->glview bindDrawable];
#else
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#endif
glEnable(GL_SCISSOR_TEST);
if (auto* main = layout[main_id])
main->watch(observer);