I tried the android sample on Quest 3 and only got a black screen and this error:
10-19 21:19:54.030 26338 26362 I RustStdoutStderr: Encountered a panic in system `bevy_openxr::xr_begin_frame`!
10-19 21:19:54.031 26338 26362 I RustStdoutStderr: Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
10-19 21:19:54.032 26338 26363 E RustPanic: called `Result::unwrap()` on an `Err` value: ERROR_SESSION_NOT_RUNNING
After replacing all unwraps in xr_begin_frame with expect, I saw that frame_waiter.wait() is causing the panic. I quickly wrapped it in some if/else and skipped the xr_begin_frame method in case that function returns an error.
Afterward, the application starts without a problem. I added a log to see how many times that error occurs, and it only seems to happen once at startup. I lack insight to know exactly what that means.
Please see this patch for changes on how I made it work on Quest 3. Du to my lack of knowledge about OpenXR on Android, I decided against a PR to discuss this issue first.
Patch
```patch
Index: src/lib.rs
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs (revision 879c40f0f820a2db54aac9c53f224135b8075e2c)
+++ b/src/lib.rs (date 1697736781863)
@@ -259,7 +259,20 @@
}
{
let _span = info_span!("xr_wait_frame").entered();
- *frame_state.lock().unwrap() = frame_waiter.lock().unwrap().wait().unwrap();
+ let result = frame_waiter
+ .lock()
+ .expect("Error trying to lock frame waiter.")
+ .wait();
+
+ if let Ok(new_frame_state) = result {
+ *frame_state
+ .lock()
+ .expect("Error trying to lock frame state for predicted display time.") =
+ new_frame_state;
+ } else {
+ warn!("Error trying to wait for frame.");
+ return;
+ }
}
{
let _span = info_span!("xr_begin_frame").entered();
```
I tried the android sample on Quest 3 and only got a black screen and this error:
After replacing all
unwraps
in xr_begin_frame withexpect
, I saw that frame_waiter.wait() is causing the panic. I quickly wrapped it in some if/else and skipped thexr_begin_frame
method in case that function returns an error.Afterward, the application starts without a problem. I added a log to see how many times that error occurs, and it only seems to happen once at startup. I lack insight to know exactly what that means.
Please see this patch for changes on how I made it work on Quest 3. Du to my lack of knowledge about OpenXR on Android, I decided against a PR to discuss this issue first.
Patch
```patch Index: src/lib.rs IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs (revision 879c40f0f820a2db54aac9c53f224135b8075e2c) +++ b/src/lib.rs (date 1697736781863) @@ -259,7 +259,20 @@ } { let _span = info_span!("xr_wait_frame").entered(); - *frame_state.lock().unwrap() = frame_waiter.lock().unwrap().wait().unwrap(); + let result = frame_waiter + .lock() + .expect("Error trying to lock frame waiter.") + .wait(); + + if let Ok(new_frame_state) = result { + *frame_state + .lock() + .expect("Error trying to lock frame state for predicted display time.") = + new_frame_state; + } else { + warn!("Error trying to wait for frame."); + return; + } } { let _span = info_span!("xr_begin_frame").entered(); ```