awtterpip / bevy_oxr

Apache License 2.0
253 stars 39 forks source link

Quest 2 support #16

Closed alexichepura closed 1 year ago

alexichepura commented 1 year ago

Hello here, I've got bevy_openxr running on quest 2 (v57).

But ~20FPS with multiple messages "JniUtils-inl: Creating temporary JNIEnv. This is a heavy operation and should be infrequent…". Can't fix it out for few days.

 (Update --release used, like cargo apk run --release --example xr)

Other issue I faced. Maybe helpful for others.

  1. how can example work without #[bevy_main]? had to add it
  2. had to add this in vulkan.rs 

    #[cfg(target_os = "android")]
 
    xr_entry.initialize_android_loader().unwrap();
  3. had to change vulkan versions to 1.1 from 1.2 in vulkan.rs
  4. had crashes "Unable to load get_semaphore_counter_value". Found fix here https://github.com/kcking/bevy/blob/xr/crates/bevy_openxr/src/presentation.rs#L67instance_extensions.retain(|ext| ext != &vk::KhrGetPhysicalDeviceProperties2Fn::name());
alexichepura commented 1 year ago

Somehow I overlooked android branch. https://github.com/awtterpip/bevy_openxr/tree/android Setting primary window to None was crucial to get FPS up. That was last part.

primary_window: None,
exit_condition: ExitCondition::DontExit,

Now xr example on quest 2 ~70FPS !!! lto = "fat" also helps a little.