Skip to content

Commit

Permalink
Remove Android xr double render (#1297)
Browse files Browse the repository at this point in the history
This code has been in the Android XR implementation forever, and was
never understood. It did an explicit eglSwapBuffers to present to the
screen, which was needed in Babylon React Native as somehow the bgfx
rendering path was different between the two. Now, even in BRN this
results in double rendering. Maybe this is a result of one of the bgfx
updates. Since it seems to no longer be needed in any scenario, this PR
removes it. Unfortunately XR on Android in the BN Playground is broken
in a different way currently, so I have not been able to verify this
works correctly in that scenario. But previously this code was incorrect
in BN anyway, so I expect this is correct now in both BN and BRN.
  • Loading branch information
ryantrem authored Sep 27, 2023
1 parent 8a8871a commit 71a89f7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions Apps/Playground/Android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# jsEngine=JavaScriptCore
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ used by default if no engine is specified. To change the engine to JavaScriptCor
the file `Apps\Playground\Android\gradle.properties` and add the following line:

```
JSEngine=jsc
jsEngine=JavaScriptCore
```

Once the npm packages are installed, open the project located at
Expand Down
5 changes: 0 additions & 5 deletions Dependencies/xr/Source/ARCore/XR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,6 @@ namespace xr

// Draw the quad
glDrawArrays(GL_TRIANGLE_STRIP, 0, VERTEX_COUNT);

// Present to the screen
// NOTE: For a yet to be determined reason, bgfx is also doing an eglSwapBuffers when running in the regular Android Babylon Native Playground playground app.
// The "double" eglSwapBuffers causes rendering issues, so until we figure out this issue, comment out this line while testing in the regular playground app.
eglSwapBuffers(eglGetCurrentDisplay(), eglGetCurrentSurface(EGL_DRAW));
}
}

Expand Down

0 comments on commit 71a89f7

Please sign in to comment.