move the ui/shaders reload into the ui thread, add rtt region copy, add box/rect conversion
This commit is contained in:
30
src/app.cpp
30
src/app.cpp
@@ -577,7 +577,6 @@ void App::draw(float dt)
|
||||
void App::update(float dt)
|
||||
{
|
||||
static std::mutex mutex;
|
||||
static float reload_timer = 0.f;
|
||||
|
||||
// avoid multiple threads to update the scene
|
||||
//std::lock_guard<std::mutex> lock(mutex);
|
||||
@@ -585,17 +584,6 @@ void App::update(float dt)
|
||||
if (!(redraw || animate))
|
||||
return;
|
||||
|
||||
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
|
||||
reload_timer += dt;
|
||||
if (reload_timer > 1.0)
|
||||
{
|
||||
reload_timer = 0;
|
||||
if (ShaderManager::reload())
|
||||
stroke->update_controls();
|
||||
layout.reload();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (auto* main = layout[main_id])
|
||||
main->update(width, height, zoom);
|
||||
|
||||
@@ -843,6 +831,7 @@ void App::ui_thread_main()
|
||||
auto t_start = std::chrono::high_resolution_clock::now();
|
||||
float t_frame = 0;
|
||||
float t_fps_counter = 0;
|
||||
float t_reloader = 0;
|
||||
int rendered_frames = 0;
|
||||
while (ui_running)
|
||||
{
|
||||
@@ -891,6 +880,23 @@ void App::ui_thread_main()
|
||||
rendered_frames = 0;
|
||||
}
|
||||
|
||||
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
|
||||
t_reloader += dt;
|
||||
if (t_reloader > 1.0)
|
||||
{
|
||||
t_reloader = 0;
|
||||
if (ShaderManager::reload())
|
||||
{
|
||||
stroke->update_controls();
|
||||
redraw = true;
|
||||
}
|
||||
if (layout.reload())
|
||||
{
|
||||
redraw = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
tick(dt);
|
||||
|
||||
if (redraw)
|
||||
|
||||
Reference in New Issue
Block a user