Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix RegisterExternalContext() life cycle issues on WaveVR (#3691)
Browse files Browse the repository at this point in the history
Fixes #3688

It turns out that WVR_RenderInit() is a blocking call that waits for the activity to be active/resumed to complete the internal work. The function is slow to react so Gecko is initializes earlier and fails all the attempts to detect VR runtimes, because the external shmem is null. We need to process InitializeJava earlier instead of waiting for the slow WVR_RenderInit to complete
  • Loading branch information
MortimerGoro authored and bluemarvin committed Jul 16, 2020
1 parent 7e8fa9e commit 4a83242
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/src/wavevr/cpp/native-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ JNI_METHOD(void, activityResumed)
int main(int argc, char *argv[]) {
sQueue->AttachToThread();
VRB_LOG("Call WVR_Init");
sDevice = DeviceDelegateWaveVR::Create(BrowserWorld::Instance().GetRenderContext());
BrowserWorld::Instance().RegisterDeviceDelegate(sDevice);
while(!sJavaInitialized) {
sQueue->ProcessRunnables();
}

WVR_InitError eError = WVR_Init(WVR_AppType_VRContent);
if (eError != WVR_InitError_None) {
VRB_LOG("Unable to init VR runtime: %s", WVR_GetInitErrorString(eError));
Expand All @@ -70,15 +76,10 @@ int main(int argc, char *argv[]) {
if (pError != WVR_RenderError_None) {
VRB_LOG("Present init failed - Error[%d]", pError);
}
sDevice = DeviceDelegateWaveVR::Create(BrowserWorld::Instance().GetRenderContext());
BrowserWorld::Instance().RegisterDeviceDelegate(sDevice);
VRB_GL_CHECK(glEnable(GL_DEPTH_TEST));
VRB_GL_CHECK(glEnable(GL_CULL_FACE));
VRB_GL_CHECK(glEnable(GL_BLEND));
// VRB_GL_CHECK(glDisable(GL_CULL_FACE));
while(!sJavaInitialized) {
sQueue->ProcessRunnables();
}
VRB_LOG("Java Initialized.");
BrowserWorld::Instance().InitializeGL();
BrowserWorld::Instance().Resume();
Expand Down

0 comments on commit 4a83242

Please sign in to comment.