fix glsl float interpolation, fix layers on ui reload, add vr thread for Quest
This commit is contained in:
@@ -365,6 +365,29 @@ bool android_set_clipboard(const std::string& s)
|
||||
return success;
|
||||
}
|
||||
|
||||
bool vr_running = false;
|
||||
static void engine_vr_loop()
|
||||
{
|
||||
LOG("start hmd render thread");
|
||||
vr_running = true;
|
||||
App::I->ui_sync();
|
||||
while (vr_running)
|
||||
{
|
||||
#ifdef __QUEST__
|
||||
App::I->render_task([] {
|
||||
App::I->vr_draw_ui();
|
||||
oculus_draw(0);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
LOG("hmd renderer terminated");
|
||||
}
|
||||
|
||||
static void engine_start_vr()
|
||||
{
|
||||
std::thread(engine_vr_loop).detach();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize an EGL context for the current display.
|
||||
*/
|
||||
@@ -547,6 +570,8 @@ static int engine_init_display(struct engine* engine) {
|
||||
g_context = context;
|
||||
|
||||
#ifdef __QUEST__
|
||||
App::I->render_thread_id = std::this_thread::get_id();
|
||||
LOG("QUEST init VR");
|
||||
oculus_init_vr(display, context, engine->app->window);
|
||||
#elif __FOCUS__
|
||||
wave_init_vr(display, context, engine->app->window);
|
||||
@@ -667,11 +692,22 @@ static int engine_init_display(struct engine* engine) {
|
||||
App::I->width = 1024;
|
||||
App::I->height = 1024;
|
||||
App::I->redraw = true;
|
||||
App::I->init();
|
||||
App::I->resize(1024, 1024);
|
||||
App::I->vr_active = true;
|
||||
App::I->has_vr = true;
|
||||
App::I->vr_only = true;
|
||||
|
||||
// give control to the render thread
|
||||
LOG("release egl context");
|
||||
eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
LOG("start render threads");
|
||||
App::I->render_thread_start();
|
||||
LOG("start ui thread");
|
||||
App::I->ui_thread_start();
|
||||
|
||||
App::I->ui_sync();
|
||||
LOG("start vr thread");
|
||||
engine_start_vr();
|
||||
#else
|
||||
float density = get_display_density();
|
||||
LOG("density %f", density);
|
||||
|
||||
Reference in New Issue
Block a user