Skip to content

Commit

Permalink
fix android
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmarni-Dev committed Jan 15, 2024
1 parent b2efa80 commit cdeb7bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features
"static",
] }

[target.'cfg(target_os = "android")'.dependencies]
ndk-context = "0.1"
jni = "0.20"

[dev-dependencies]
bevy = "0.12"
color-eyre = "0.6.2"
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ pub fn end_frame(
environment_blend_mode: Res<XrEnvironmentBlendMode>,
// passthrough_layer: Option<Res<XrPassthroughLayer>>,
) {
#[cfg(target_os = "android")]
{
let ctx = ndk_context::android_context();
let vm = unsafe { jni::JavaVM::from_raw(ctx.vm().cast()) }.unwrap();
let env = vm.attach_current_thread_as_daemon();
}

{
let _span = info_span!("xr_release_image").entered();
swapchain.release_image().unwrap();
Expand Down

0 comments on commit cdeb7bd

Please sign in to comment.