From 4acc074114d9e8355e4ddb80e8799f32f7a1c7c3 Mon Sep 17 00:00:00 2001 From: Alexi Chepura Date: Tue, 17 Oct 2023 15:34:46 +0300 Subject: [PATCH 1/5] quest, not finished --- README.md | 8 +++- examples/android/Cargo.toml | 89 +++++++++++++++++++++++++++++++++++++ src/graphics/vulkan.rs | 5 +++ src/lib.rs | 7 +++ 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 examples/android/Cargo.toml diff --git a/README.md b/README.md index a0c7eb27..d392e30d 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,10 @@ An in-progress crate for adding openxr support to Bevy without forking. ![image](https://github.com/awtterpip/bevy_openxr/assets/50841145/aa01fde4-7915-49b9-b486-ff61ce6d57a9) -To see it in action run the example in `examples` with `cargo run --example xr` +To see it in action run the example in `examples` with `cargo run --example xr`. + +## Quest +Running on quest can be done with https://github.com/rust-mobile/cargo-apk and requires disabling default features. +```sh +cargo apk run --example xr --release --no-default-features +``` diff --git a/examples/android/Cargo.toml b/examples/android/Cargo.toml new file mode 100644 index 00000000..31752d8b --- /dev/null +++ b/examples/android/Cargo.toml @@ -0,0 +1,89 @@ +# [package] +name = "bevy_openxr_android" +version = "0.1.0" +edition = "2021" +description = "Example for building an Android OpenXR app with Bevy" +publish = false +license = "MIT OR Apache-2.0" + +# [lib] +# name = "bevy_mobile_example" +# crate-type = ["staticlib", "cdylib"] + +# [dependencies] +# bevy = { path = "../../" } + +# [package.metadata.android] +# package = "org.bevyengine.example" +# apk_name = "bevyexample" +# assets = "../../assets" +# resources = "../../assets/android-res" +# # This strips debug symbols from the shared libraries, drastically reducing APK size. If you need them, remove the option. +# strip = "strip" +# build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"] + +[package.metadata.android] +package = "com.github.alexichepura.bevyopenxr" +build_targets = ["aarch64-linux-android"] +runtime_libs = "examples/libs" +apk_name = "bevyopenxr" +assets = "assets" +res = "assets/android-res" +icon = "@mipmap/ic_launcher" +label = "Bevy Openxr" + +[package.metadata.android.sdk] +target_sdk_version = 32 + +# [package.metadata.android.application] +# icon = "@mipmap/ic_launcher" +# label = "Bevy Example" + +[dependencies] +anyhow = "1.0.75" +# ash = "0.37.3" +# ash = { version = "0.37", default-features = false, features = ["loaded"] } +bevy = { git = "https://github.com/bevyengine/bevy.git" } +openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] } +mint = "0.5.9" + +wgpu = "0.17.1" +wgpu-core = { version = "0.17.1", features = ["vulkan"] } +wgpu-hal = "0.17.2" + +[dev-dependencies] +color-eyre = "0.6.2" + +[profile.release] +lto = "fat" +codegen-units = 1 +panic = "abort" +#debug = true + +[package.metadata.android] +build_targets = ["aarch64-linux-android"] +runtime_libs = "examples/libs" +package = "com.github.alexichepura.bevyopenxr" +apk_name = "bevyopenxr" +assets = "assets" +res = "assets/android-res" +icon = "@mipmap/ic_launcher" +label = "Bevy Openxr" + +[package.metadata.android.application.activity] +theme = "@android:style/Theme.Black.NoTitleBar.Fullscreen" +config_changes = "density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode" +launch_mode = "singleTask" +orientation = "landscape" +resizeable_activity = false + +[[package.metadata.android.application.activity.intent_filter]] +actions = ["android.intent.action.MAIN"] +categories = [ + "com.oculus.intent.category.VR", + "android.intent.category.LAUNCHER", +] + +[package.metadata.android.signing.release] +path = "./hotham_examples.keystore" +keystore_password = "chomsky-vigilant-spa" diff --git a/src/graphics/vulkan.rs b/src/graphics/vulkan.rs index 61d1b52b..a6c525b7 100644 --- a/src/graphics/vulkan.rs +++ b/src/graphics/vulkan.rs @@ -42,6 +42,9 @@ pub fn initialize_xr_graphics( let xr_entry = super::xr_entry(); + #[cfg(target_os = "android")] + xr_entry.initialize_android_loader().unwrap(); + let available_extensions = xr_entry.enumerate_extensions()?; assert!(available_extensions.khr_vulkan_enable2); info!("available xr exts: {:#?}", available_extensions); @@ -102,6 +105,8 @@ pub fn initialize_xr_graphics( let device_extensions = vec![ ash::extensions::khr::Swapchain::name(), ash::extensions::khr::DrawIndirectCount::name(), + #[cfg(target_os = "android")] + ash::extensions::khr::TimelineSemaphore::name(), ]; info!( "creating vulkan instance with these extensions: {:#?}", diff --git a/src/lib.rs b/src/lib.rs index e5ed7487..ba3c9523 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -201,10 +201,17 @@ impl PluginGroup for DefaultXrPlugins { .add_before::(OpenXrPlugin) .add_after::(OpenXrInput::new(XrControllerType::OculusTouch)) .set(WindowPlugin { + #[cfg(not(target_os = "android"))] primary_window: Some(Window { present_mode: PresentMode::AutoNoVsync, ..default() }), + #[cfg(target_os = "android")] + primary_window: None, + #[cfg(target_os = "android")] + exit_condition: bevy::window::ExitCondition::DontExit, + #[cfg(target_os = "android")] + close_when_requested: true, ..default() }) } From 3bacc37e74f35ff81879819d577e939e1dd13be6 Mon Sep 17 00:00:00 2001 From: Alexi Chepura Date: Wed, 18 Oct 2023 12:25:32 +0300 Subject: [PATCH 2/5] android example lib --- README.md | 2 +- examples/android/Cargo.toml | 37 +++------------- examples/android/src/lib.rs | 85 +++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 31 deletions(-) create mode 100644 examples/android/src/lib.rs diff --git a/README.md b/README.md index d392e30d..a2dda6db 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ An in-progress crate for adding openxr support to Bevy without forking. To see it in action run the example in `examples` with `cargo run --example xr`. ## Quest -Running on quest can be done with https://github.com/rust-mobile/cargo-apk and requires disabling default features. +Running on Meta Quest can be done with https://github.com/rust-mobile/cargo-apk and requires disabling default features. ```sh cargo apk run --example xr --release --no-default-features ``` diff --git a/examples/android/Cargo.toml b/examples/android/Cargo.toml index 31752d8b..1f5163db 100644 --- a/examples/android/Cargo.toml +++ b/examples/android/Cargo.toml @@ -1,4 +1,4 @@ -# [package] +[package] name = "bevy_openxr_android" version = "0.1.0" edition = "2021" @@ -6,31 +6,20 @@ description = "Example for building an Android OpenXR app with Bevy" publish = false license = "MIT OR Apache-2.0" -# [lib] -# name = "bevy_mobile_example" -# crate-type = ["staticlib", "cdylib"] - -# [dependencies] -# bevy = { path = "../../" } - -# [package.metadata.android] -# package = "org.bevyengine.example" -# apk_name = "bevyexample" -# assets = "../../assets" -# resources = "../../assets/android-res" -# # This strips debug symbols from the shared libraries, drastically reducing APK size. If you need them, remove the option. -# strip = "strip" -# build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"] +[lib] +name = "bevy_openxr_android" +crate-type = ["staticlib", "cdylib"] [package.metadata.android] -package = "com.github.alexichepura.bevyopenxr" +package = "org.bevyengine.example_openxr_android" build_targets = ["aarch64-linux-android"] runtime_libs = "examples/libs" apk_name = "bevyopenxr" assets = "assets" res = "assets/android-res" icon = "@mipmap/ic_launcher" -label = "Bevy Openxr" +label = "Bevy Openxr Android" +strip = "strip" [package.metadata.android.sdk] target_sdk_version = 32 @@ -42,7 +31,6 @@ target_sdk_version = 32 [dependencies] anyhow = "1.0.75" # ash = "0.37.3" -# ash = { version = "0.37", default-features = false, features = ["loaded"] } bevy = { git = "https://github.com/bevyengine/bevy.git" } openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] } mint = "0.5.9" @@ -58,17 +46,6 @@ color-eyre = "0.6.2" lto = "fat" codegen-units = 1 panic = "abort" -#debug = true - -[package.metadata.android] -build_targets = ["aarch64-linux-android"] -runtime_libs = "examples/libs" -package = "com.github.alexichepura.bevyopenxr" -apk_name = "bevyopenxr" -assets = "assets" -res = "assets/android-res" -icon = "@mipmap/ic_launcher" -label = "Bevy Openxr" [package.metadata.android.application.activity] theme = "@android:style/Theme.Black.NoTitleBar.Fullscreen" diff --git a/examples/android/src/lib.rs b/examples/android/src/lib.rs new file mode 100644 index 00000000..32483a3e --- /dev/null +++ b/examples/android/src/lib.rs @@ -0,0 +1,85 @@ +use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; +use bevy::prelude::*; +use bevy::transform::components::Transform; +use bevy_openxr::xr_input::debug_gizmos::OpenXrDebugRenderer; +use bevy_openxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig}; +use bevy_openxr::xr_input::trackers::{ + OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker, +}; +use bevy_openxr::DefaultXrPlugins; + +#[bevy_main] +fn main() { + color_eyre::install().unwrap(); + + App::new() + .add_plugins(DefaultXrPlugins) + .add_plugins(OpenXrDebugRenderer) + .add_plugins(LogDiagnosticsPlugin::default()) + .add_plugins(FrameTimeDiagnosticsPlugin) + .add_systems(Startup, setup) + .add_systems(Update, proto_locomotion) + .add_systems(Startup, spawn_controllers_example) + .insert_resource(PrototypeLocomotionConfig::default()) + .run(); +} + +/// set up a simple 3D scene +fn setup( + mut commands: Commands, + mut meshes: ResMut>, + mut materials: ResMut>, +) { + // plane + commands.spawn(PbrBundle { + mesh: meshes.add(shape::Plane::from_size(5.0).into()), + material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), + ..default() + }); + // cube + commands.spawn(PbrBundle { + mesh: meshes.add(Mesh::from(shape::Cube { size: 0.1 })), + material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), + transform: Transform::from_xyz(0.0, 0.5, 0.0), + ..default() + }); + // cube + commands.spawn(PbrBundle { + mesh: meshes.add(Mesh::from(shape::Cube { size: 0.1 })), + material: materials.add(Color::rgb(0.8, 0.0, 0.0).into()), + transform: Transform::from_xyz(0.0, 0.5, 1.0), + ..default() + }); + // light + commands.spawn(PointLightBundle { + point_light: PointLight { + intensity: 1500.0, + shadows_enabled: true, + ..default() + }, + transform: Transform::from_xyz(4.0, 8.0, 4.0), + ..default() + }); + // camera + // commands.spawn((Camera3dBundle { + // transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), + // ..default() + // },)); +} + +fn spawn_controllers_example(mut commands: Commands) { + //left hand + commands.spawn(( + OpenXRLeftController, + OpenXRController, + OpenXRTracker, + SpatialBundle::default(), + )); + //right hand + commands.spawn(( + OpenXRRightController, + OpenXRController, + OpenXRTracker, + SpatialBundle::default(), + )); +} From 28c847244a17f8a5b6849e9db958928e1ce4354b Mon Sep 17 00:00:00 2001 From: Alexi Chepura Date: Wed, 18 Oct 2023 13:13:20 +0300 Subject: [PATCH 3/5] android example lib, almost done --- README.md | 6 ----- examples/android/.gitignore | 3 +++ examples/android/Cargo.toml | 27 +++++++++++----------- examples/android/README.md | 6 +++++ examples/android/hotham_examples.keystore | Bin 0 -> 2726 bytes examples/android/src/lib.rs | 2 -- 6 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 examples/android/.gitignore create mode 100644 examples/android/README.md create mode 100644 examples/android/hotham_examples.keystore diff --git a/README.md b/README.md index a2dda6db..73e18560 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,3 @@ An in-progress crate for adding openxr support to Bevy without forking. ![image](https://github.com/awtterpip/bevy_openxr/assets/50841145/aa01fde4-7915-49b9-b486-ff61ce6d57a9) To see it in action run the example in `examples` with `cargo run --example xr`. - -## Quest -Running on Meta Quest can be done with https://github.com/rust-mobile/cargo-apk and requires disabling default features. -```sh -cargo apk run --example xr --release --no-default-features -``` diff --git a/examples/android/.gitignore b/examples/android/.gitignore new file mode 100644 index 00000000..d74eb915 --- /dev/null +++ b/examples/android/.gitignore @@ -0,0 +1,3 @@ +/target +/Cargo.lock +/runtime_libs diff --git a/examples/android/Cargo.toml b/examples/android/Cargo.toml index 1f5163db..ef9e36ce 100644 --- a/examples/android/Cargo.toml +++ b/examples/android/Cargo.toml @@ -13,10 +13,10 @@ crate-type = ["staticlib", "cdylib"] [package.metadata.android] package = "org.bevyengine.example_openxr_android" build_targets = ["aarch64-linux-android"] -runtime_libs = "examples/libs" +runtime_libs = "runtime_libs" apk_name = "bevyopenxr" -assets = "assets" -res = "assets/android-res" +# assets = "assets" +# res = "assets/android-res" icon = "@mipmap/ic_launcher" label = "Bevy Openxr Android" strip = "strip" @@ -29,18 +29,9 @@ target_sdk_version = 32 # label = "Bevy Example" [dependencies] -anyhow = "1.0.75" -# ash = "0.37.3" +bevy_openxr = { path = "../.." } bevy = { git = "https://github.com/bevyengine/bevy.git" } openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] } -mint = "0.5.9" - -wgpu = "0.17.1" -wgpu-core = { version = "0.17.1", features = ["vulkan"] } -wgpu-hal = "0.17.2" - -[dev-dependencies] -color-eyre = "0.6.2" [profile.release] lto = "fat" @@ -61,6 +52,16 @@ categories = [ "android.intent.category.LAUNCHER", ] +# !! IMPORTANT !! +# +# When creating your own apps, make sure to generate your own keystore, rather than using our example one! +# You can use `keytool` like so: +# keytool -genkey -v -keystore my-release-key.keystore -keyalg RSA -keysize 2048 -validity 10000 +# +# For more information on key signing and why it's so important, check out this article: +# https://developer.android.com/studio/publish/app-signing +# +# !! IMPORTANT !! [package.metadata.android.signing.release] path = "./hotham_examples.keystore" keystore_password = "chomsky-vigilant-spa" diff --git a/examples/android/README.md b/examples/android/README.md new file mode 100644 index 00000000..9ef2fd1a --- /dev/null +++ b/examples/android/README.md @@ -0,0 +1,6 @@ +# Bevy OpenXR Android example + +Running on Meta Quest can be done with https://github.com/rust-mobile/cargo-apk and requires disabling default features. +```sh +cargo apk run --release +``` \ No newline at end of file diff --git a/examples/android/hotham_examples.keystore b/examples/android/hotham_examples.keystore new file mode 100644 index 0000000000000000000000000000000000000000..62623c4d30c143b63d33e39fb5b742e403ab5dbe GIT binary patch literal 2726 zcma);X*d*&7RSw)F&QTNPWG{;A&gy8Ov@xo)~sPLC`ooPWZo%DO~^7agb}iDiO3Ae z*q2wb=M~vPmJ#u~&%ICYb3fht;XLO#|NlAvkH6<2aL_y;fEj^)FgNfn5tDuCW)eGgM+82s7YPHqX z-axl;h)26#Q-b?aD?$&p>B5iAbzYn1SUApC6W7--Q9pfm(STDgEA3f;K6XcG`e3hW zHQ065D-J$@86hC5<=xxjLT&r6oL@+SRdOYfNU(lXP$8fWS+FbF zA;4$-n{|-QPh#5=<)wffu>3j=`B;mN>wvGQYZS9sHI@9I4x+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$=|)d?j6~m=o-xQ0h4p)n$^@tQ+`bb)6;q|O zRru4}uZNlQv9WMe&t=I|G-(g+x)8y|nUT%Q?J%A#wc)#6bqF*<6#@JGy8!`UCXfUd zzA&{#$jFMr>l Date: Wed, 18 Oct 2023 13:43:23 +0300 Subject: [PATCH 4/5] android readme and flags --- examples/android/Cargo.toml | 2 +- examples/android/README.md | 44 +++++++++++++++++++++++++++++++++++-- src/graphics/vulkan.rs | 8 +++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/examples/android/Cargo.toml b/examples/android/Cargo.toml index ef9e36ce..80e43ad8 100644 --- a/examples/android/Cargo.toml +++ b/examples/android/Cargo.toml @@ -29,7 +29,7 @@ target_sdk_version = 32 # label = "Bevy Example" [dependencies] -bevy_openxr = { path = "../.." } +bevy_openxr = { path = "../..", default-features = false } bevy = { git = "https://github.com/bevyengine/bevy.git" } openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] } diff --git a/examples/android/README.md b/examples/android/README.md index 9ef2fd1a..801a9ad3 100644 --- a/examples/android/README.md +++ b/examples/android/README.md @@ -1,6 +1,46 @@ # Bevy OpenXR Android example -Running on Meta Quest can be done with https://github.com/rust-mobile/cargo-apk and requires disabling default features. +## Setup +Get libopenxr_loader.so from the Oculus OpenXR Mobile SDK and add it to `examples/android/runtime_libs/arm64-v8a` +https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/ +`examples/android/runtime_libs/arm64-v8a/libopenxr_loader.so` + +Running on Meta Quest can be done with https://github.com/rust-mobile/cargo-apk. ```sh cargo apk run --release -``` \ No newline at end of file +``` + +## Notes + +### Relase mode +More optimisations enabled in Cargo.toml for the release mode. +This gives more performance but longer build time. +```toml +[profile.release] +lto = "fat" +codegen-units = 1 +panic = "abort" +``` + +### Cargo apk +If you see error like `Error: String `` is not a PID`, try to install cargo apk with a fix in branch. +```sh +cargo install --git https://github.com/rust-mobile/cargo-apk --branch=adb-logcat-uid +``` + +### Temporary JNIEnv log +This message is logged every frame. It's not yet fixed. +```sh +I JniUtils-inl: Creating temporary JNIEnv. This is a heavy operation and should be infrequent. To optimize, use JNI AttachCurrentThread on calling threa +``` + +### Android keystore +Release mode requires keystore. See Cargo.toml `package.metadata.android.signing.release`. + +When creating your own apps, make sure to generate your own keystore, rather than using our example one! +You can use `keytool` like so: +```sh +keytool -genkey -v -keystore my-release-key.keystore -keyalg RSA -keysize 2048 -validity 10000 +``` +For more information on key signing and why it's so important, check out this article: +https://developer.android.com/studio/publish/app-signing \ No newline at end of file diff --git a/src/graphics/vulkan.rs b/src/graphics/vulkan.rs index a6c525b7..115b5831 100644 --- a/src/graphics/vulkan.rs +++ b/src/graphics/vulkan.rs @@ -85,8 +85,16 @@ pub fn initialize_xr_graphics( let blend_mode = xr_instance.enumerate_environment_blend_modes(xr_system_id, VIEW_TYPE)?[0]; + #[cfg(not(target_os = "android"))] let vk_target_version = vk::make_api_version(0, 1, 2, 0); + #[cfg(not(target_os = "android"))] let vk_target_version_xr = xr::Version::new(1, 2, 0); + + #[cfg(target_os = "android")] + let vk_target_version = vk::make_api_version(0, 1, 1, 0); + #[cfg(target_os = "android")] + let vk_target_version_xr = xr::Version::new(1, 1, 0); + let reqs = xr_instance.graphics_requirements::(xr_system_id)?; if vk_target_version_xr < reqs.min_api_version_supported || vk_target_version_xr.major() > reqs.max_api_version_supported.major() From d77d196d0c4d07d349f52a435f867f3d07c8ab92 Mon Sep 17 00:00:00 2001 From: Alexi Chepura Date: Wed, 18 Oct 2023 13:54:55 +0300 Subject: [PATCH 5/5] cleanup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73e18560..a0c7eb27 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ An in-progress crate for adding openxr support to Bevy without forking. ![image](https://github.com/awtterpip/bevy_openxr/assets/50841145/aa01fde4-7915-49b9-b486-ff61ce6d57a9) -To see it in action run the example in `examples` with `cargo run --example xr`. +To see it in action run the example in `examples` with `cargo run --example xr`