Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customization of OpenXR application name, version, required layers. #197

Merged
merged 7 commits into from
May 2, 2022

Conversation

jmgao
Copy link
Contributor

@jmgao jmgao commented Apr 24, 2022

Make it so that applications can configure a bunch of OpenXR stuff by adding an EngineBuilder and XrContextBuilder to plumb things down to.

While we're at it, fix the android build, and make the ndk/ndk-glue versioning less restrictive so that top of tree openxr works.

@jmgao jmgao force-pushed the openxr branch 2 times, most recently from b02852f to 18bda61 Compare April 24, 2022 00:39
@kanerogers kanerogers self-requested a review April 24, 2022 09:23
Copy link
Collaborator

@kanerogers kanerogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fantastic as always @jmgao 👍🏻

Have left a couple of notes in the PR!

hotham/src/resources/xr_context.rs Outdated Show resolved Hide resolved
hotham/src/engine.rs Show resolved Hide resolved
hotham/src/engine.rs Show resolved Hide resolved
@@ -19,7 +19,7 @@ rand = "0.8.0"
approx = "0.5"

[target.'cfg(target_os = "android")'.dependencies]
ndk-glue = "=0.6.0"
ndk-glue = "0.6"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's historical reasons for this, unfortunately.

We MUST keep our ndk-glue in lockstep with the rest of the ndk-glue ecosystem. Several upstream packages, such as openxr and cpal will break if the ndk-glue version gets out of sync.

I'd prefer to leave this as is for now, and approach this by switching to ndk-context as documented here:

rust-mobile/ndk#211

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't cargo's semver resolution solve this? My understanding is that compatible versions of libraries (i.e. 0.6.x) are required to resolve to one specific version. The problem that this is intended to fix is that openxr no longer depends on ndk-glue, but depends on ndk-context instead, but an application using hotham can't force the version of ndk-glue to 0.6.2, which is the version that starts using ndk-context.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: semver resolution, no. I thought the same thing but was unpleasantly surprised when things blew up my face on a fresh build when something in the ndk-glue ecosystem had been updated. To be clear, we could still get bitten by other dependencies but this is still a start.

re: openxr and ndk-context can you expand on that a bit further?

Copy link
Contributor Author

@jmgao jmgao Apr 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we update to the next version of openxr (or in my case, if you use [patches.crates-io] to move to a top of tree version to get access to XR_FB_display_refresh_rate), things will break, because openxr is removed its dependency on ndk-glue and added one on ndk-context instead.

In version 0.6.2, ndk-glue moves its global state into ndk-context and properly initializes ndk-context, so if a sufficiently new version of ndk-glue is used for initialization, crates that depend on ndk-context will also work. However, we're forcing the version to exactly 0.6.0, so the result is that hotham applications will have use the old ndk-glue that doesn't initialize ndk-context, and a new version of openxr will use an uninitialized ndk-context and immediately crash.

(BTW, we're not in lockstep with the rest of the ndk-glue ecosystem: cpal uses 0.6, and openxr used 0.6, and effectively will be >0.6.2)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agree @jmgao - moving to ndk-context is the way to go. I'd just like to approach that in a separate PR. 😄

Copy link
Collaborator

@kanerogers kanerogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the changes to ndk-glue for this PR - we'll handle that separately in #201

Copy link
Collaborator

@kanerogers kanerogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! 😀

@kanerogers kanerogers merged commit 047bdd3 into leetvr:main May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants