android readme and flags
This commit is contained in:
@@ -29,7 +29,7 @@ target_sdk_version = 32
|
|||||||
# label = "Bevy Example"
|
# label = "Bevy Example"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_openxr = { path = "../.." }
|
bevy_openxr = { path = "../..", default-features = false }
|
||||||
bevy = { git = "https://github.com/bevyengine/bevy.git" }
|
bevy = { git = "https://github.com/bevyengine/bevy.git" }
|
||||||
openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] }
|
openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,46 @@
|
|||||||
# Bevy OpenXR Android example
|
# 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
|
```sh
|
||||||
cargo apk run --release
|
cargo apk run --release
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 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
|
||||||
@@ -85,8 +85,16 @@ pub fn initialize_xr_graphics(
|
|||||||
|
|
||||||
let blend_mode = xr_instance.enumerate_environment_blend_modes(xr_system_id, VIEW_TYPE)?[0];
|
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);
|
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);
|
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::Vulkan>(xr_system_id)?;
|
let reqs = xr_instance.graphics_requirements::<xr::Vulkan>(xr_system_id)?;
|
||||||
if vk_target_version_xr < reqs.min_api_version_supported
|
if vk_target_version_xr < reqs.min_api_version_supported
|
||||||
|| vk_target_version_xr.major() > reqs.max_api_version_supported.major()
|
|| vk_target_version_xr.major() > reqs.max_api_version_supported.major()
|
||||||
|
|||||||
Reference in New Issue
Block a user