I am trying to write an OpenXR plugin for Unity based on Unity XR-SDK(Unity - Manual: Unity XR SDK) targeting android platform with GLES 3.1. So far I’ve got a basic rendering and 3Dof view tracking in place and working with Monado in-process runtime. I am however getting an odd flickering rendering effect, which seems like a black frame composition in every alternate frame (flickering_video:uoxr.mp4 - Google Drive and flickering_video_slomo:uoxr_slomo.mp4 - Google Drive).
Here’s my rendering loop with Unity plugin
xrWaitFrame
xrBeginFrame
// for each views (2 here for multi-pass stereo)
xrAcquireSwapchainImage
xrWaitSwapchainImage
Unity rendering - multithreaded
xrReleaseSwapchainImage x (number of views = 2)
xrEndFrame
Comparing to hello_xr from OpenXR-SDK-source the only difference seems to me is that I am acquiring both the swapchains (left and right views) before starting of rendering and releasing them before calling xrEndFrame. Whereas hello_xr does: acquire->render->release for each views sequentially.
Any ideas or insights are appreciated.
Bellow is the test apk if you want to try, please note you’ll need android broker and runtime to test the application.
[Unity apk] openxr_test_gles.apk - Google Drive
[Android broker] installable_runtime_broker-debug.apk - Google Drive
[Android runtime] openxr_android-inProcess-debug.apk - Google Drive