progress commit: openxr + pipewire + refactor

This commit is contained in:
galister
2024-01-27 18:05:13 +01:00
parent 51160f97fe
commit 8ad1dadcd4
15 changed files with 1911 additions and 607 deletions

View File

@@ -7,7 +7,11 @@ mod overlays;
mod shaders;
mod state;
use crate::backend::openvr::openvr_run;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
use env_logger::Env;
fn main() {
@@ -18,5 +22,40 @@ fn main() {
env!("CARGO_PKG_VERSION")
);
openvr_run();
let running = Arc::new(AtomicBool::new(true));
let _ = ctrlc::set_handler({
let running = running.clone();
move || {
running.store(false, Ordering::Relaxed);
}
});
#[cfg(all(feature = "openxr", feature = "openvr"))]
auto_run(running);
#[cfg(all(feature = "openvr", not(feature = "openxr")))]
crate::backend::openvr::openvr_run(running);
#[cfg(all(feature = "openxr", not(feature = "openvr")))]
crate::backend::openxr::openxr_run(running);
#[cfg(not(any(feature = "openxr", feature = "openvr")))]
compile_error!("You must enable at least one backend feature (openxr or openvr)");
}
#[cfg(all(feature = "openxr", feature = "openvr"))]
fn auto_run(running: Arc<AtomicBool>) {
use crate::backend::openvr::openvr_run;
use crate::backend::openxr::openxr_run;
use backend::common::BackendError;
let Err(BackendError::NotSupported) = openxr_run(running.clone()) else {
return;
};
let Err(BackendError::NotSupported) = openvr_run(running) else {
return;
};
log::error!("No supported backends found");
}