Skip to content

Commit

Permalink
Remove Pico workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp committed May 17, 2023
1 parent f846016 commit 161f16d
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions alvr/client_openxr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,21 +905,7 @@ pub fn entry_point() {

#[allow(unused)]
fn xr_runtime_now(xr_instance: &xr::Instance, platform: Platform) -> Option<Duration> {
let time_nanos = {
#[cfg(target_os = "android")]
if platform == Platform::Pico {
let mut ts_now = libc::timespec {
tv_sec: 0,
tv_nsec: 0,
};
unsafe { libc::clock_gettime(libc::CLOCK_MONOTONIC, &mut ts_now) };
ts_now.tv_sec * 1_000_000_000 + ts_now.tv_nsec
} else {
xr_instance.now().ok()?.as_nanos()
}
#[cfg(not(target_os = "android"))]
xr_instance.now().ok()?.as_nanos()
};
let time_nanos = xr_instance.now().ok()?.as_nanos();

(time_nanos > 0).then(|| Duration::from_nanos(time_nanos as _))
}
Expand All @@ -929,14 +915,7 @@ fn xr_runtime_now(xr_instance: &xr::Instance, platform: Platform) -> Option<Dura
fn android_main(app: android_activity::AndroidApp) {
use android_activity::{InputStatus, MainEvent, PollEvent};

let rendering_thread = thread::spawn(|| {
// workaround for the Pico runtime
let context = ndk_context::android_context();
let vm = unsafe { jni::JavaVM::from_raw(context.vm().cast()) }.unwrap();
let _env = vm.attach_current_thread().unwrap();

entry_point();
});
let rendering_thread = thread::spawn(entry_point);

let mut should_quit = false;
while !should_quit {
Expand Down

0 comments on commit 161f16d

Please sign in to comment.