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

Commit 4a83242

Browse files
MortimerGorobluemarvin
authored andcommitted
Fix RegisterExternalContext() life cycle issues on WaveVR (#3691)
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
1 parent 7e8fa9e commit 4a83242

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

app/src/wavevr/cpp/native-lib.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ JNI_METHOD(void, activityResumed)
4545
int main(int argc, char *argv[]) {
4646
sQueue->AttachToThread();
4747
VRB_LOG("Call WVR_Init");
48+
sDevice = DeviceDelegateWaveVR::Create(BrowserWorld::Instance().GetRenderContext());
49+
BrowserWorld::Instance().RegisterDeviceDelegate(sDevice);
50+
while(!sJavaInitialized) {
51+
sQueue->ProcessRunnables();
52+
}
53+
4854
WVR_InitError eError = WVR_Init(WVR_AppType_VRContent);
4955
if (eError != WVR_InitError_None) {
5056
VRB_LOG("Unable to init VR runtime: %s", WVR_GetInitErrorString(eError));
@@ -70,15 +76,10 @@ int main(int argc, char *argv[]) {
7076
if (pError != WVR_RenderError_None) {
7177
VRB_LOG("Present init failed - Error[%d]", pError);
7278
}
73-
sDevice = DeviceDelegateWaveVR::Create(BrowserWorld::Instance().GetRenderContext());
74-
BrowserWorld::Instance().RegisterDeviceDelegate(sDevice);
7579
VRB_GL_CHECK(glEnable(GL_DEPTH_TEST));
7680
VRB_GL_CHECK(glEnable(GL_CULL_FACE));
7781
VRB_GL_CHECK(glEnable(GL_BLEND));
7882
// VRB_GL_CHECK(glDisable(GL_CULL_FACE));
79-
while(!sJavaInitialized) {
80-
sQueue->ProcessRunnables();
81-
}
8283
VRB_LOG("Java Initialized.");
8384
BrowserWorld::Instance().InitializeGL();
8485
BrowserWorld::Instance().Resume();

0 commit comments

Comments
 (0)