Skip to content

Commit

Permalink
adds option to force disable multi-view
Browse files Browse the repository at this point in the history
* Option to disable multi-view support
* Adds android emulator detection and force
  disable multi-view support (emu bugs)
  • Loading branch information
korejan committed Dec 14, 2024
1 parent c64cf22 commit 889404e
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 48 deletions.
82 changes: 41 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-client-android/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-android"
version = "0.57.0"
version = "0.58.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for android platorms"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-client-android/pico/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-pico"
version = "0.57.0"
version = "0.58.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for Pico 4/Neo 3, PUI >= v5.2.x"
Expand Down
25 changes: 25 additions & 0 deletions alvr/openxr-client/alxr-client-android/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,26 @@ fn is_device<'a>(pname: &str, jvm: &'a jni::JavaVM) -> bool {
false
}

#[allow(dead_code)]
fn is_android_emulator<'a>(jvm: &'a jni::JavaVM) -> bool {
let device_name = get_build_device(&jvm).to_lowercase();
device_name.starts_with("emulator64_")
}

#[allow(dead_code)]
fn print_device_info<'a>(jvm: &'a jni::JavaVM) {
let model_name = get_build_model(&jvm);
let device_name = get_build_device(&jvm);
let man_name = get_build_manufacturer(&jvm);
let build_id = get_build_property(&jvm, "ID");
log::info!(" Device Details");
log::info!("=================");
log::info!("model: {0}", model_name);
log::info!("device: {0}", device_name);
log::info!("manufacturer: {0}", man_name);
log::info!("build-id: {0}", build_id);
}

#[no_mangle]
fn android_main(android_app: AndroidApp) {
let log_level = if cfg!(debug_assertions) {
Expand Down Expand Up @@ -213,6 +233,8 @@ unsafe fn run(android_app: &AndroidApp) -> Result<(), Box<dyn std::error::Error>
let no_linearize_srgb = APP_CONFIG.no_linearize_srgb || is_device("Lynx", &vm);
log::info!("alxr-client: Disable shader gamma/sRGB linearization? {no_linearize_srgb}");

print_device_info(&vm);

let mut eye_tracking_type = APP_CONFIG.eye_tracking.unwrap_or(ALXREyeTrackingType::Auto);
// quest firmware version 71.0.0.178.498 has a crash bug in `xrSyncActions` when
// `XR_EXT_eye_gaze_interaction` extension is enabled.
Expand All @@ -227,6 +249,8 @@ unsafe fn run(android_app: &AndroidApp) -> Result<(), Box<dyn std::error::Error>
_ => {}
};

let no_multi_view_rendering = APP_CONFIG.no_multi_view_rendering || is_android_emulator(&vm);

let ctx = ALXRClientCtx {
graphicsApi: APP_CONFIG.graphics_api.unwrap_or(ALXRGraphicsApi::Auto),
decoderType: ALXRDecoderType::NVDEC, // Not used on android.
Expand Down Expand Up @@ -264,6 +288,7 @@ unsafe fn run(android_app: &AndroidApp) -> Result<(), Box<dyn std::error::Error>
.unwrap_or(ALXRPassthroughMode::None),
internalDataPath: std::ptr::null(),
noVisibilityMasks: APP_CONFIG.no_visibility_masks,
noMultiviewRendering: no_multi_view_rendering,
};
let mut sys_properties = ALXRSystemProperties::new();
if !alxr_init(&ctx, &mut sys_properties) {
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client"
version = "0.57.0"
version = "0.58.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
description = "An OpenXR based ALVR client for non-android platorms"
Expand Down
1 change: 1 addition & 0 deletions alvr/openxr-client/alxr-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ fn main() {
.unwrap_or(ALXRPassthroughMode::None),
internalDataPath: std::ptr::null(),
noVisibilityMasks: APP_CONFIG.no_visibility_masks,
noMultiviewRendering: APP_CONFIG.no_multi_view_rendering,
};
let mut sys_properties = ALXRSystemProperties::new();
if !alxr_init(&ctx, &mut sys_properties) {
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-client/uwp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-client-uwp"
version = "1.57.0"
version = "1.58.0"
authors = ["korejan <[email protected]>"]
edition = "2021"
build = ".build/main.rs"
Expand Down
2 changes: 1 addition & 1 deletion alvr/openxr-client/alxr-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alxr-common"
version = "0.57.0"
version = "0.58.0"
authors = ["korejan <[email protected]>"]
edition = "2021"

Expand Down
Loading

0 comments on commit 889404e

Please sign in to comment.