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

[OpenXR] Add basic support for WebXR AR module #1507

Merged
merged 2 commits into from
Aug 29, 2024
Merged

[OpenXR] Add basic support for WebXR AR module #1507

merged 2 commits into from
Aug 29, 2024

Conversation

svillar
Copy link
Member

@svillar svillar commented Aug 6, 2024

Wolvic can now start and render WebXR's immersive-ar sessions for those devices supporting passthrough, either via non-opaque blend modes or passthrough compositor layers.

This requires a few changes in the communication protocol with the web engine:

  1. pass the available blend modes to the web engine so it can select the desired one depending on the requested WebXR session.
  2. use the selected blend mode from the web engine to render the immersive scene
  3. notify Wolvic about the type of WebXR session (AR/VR)

Change #3 is required for those devices that do support passthrough but not via AR blend modes. Examples of those are the Meta devices that implement passthrough via a passthrough compositor layer.

Note that WebXR's session type will prevail over the current passthrough status in standalone mode. There are 4 different scenarios (PT stands for passthrough):

  1. PT ON, VR session: PT will be disabled on entering and reenabled on exiting
  2. PT ON, AR session: PT will be activated all the time
  3. PT OFF, VR session: PT will be off all the time
  4. PT OFF, AR session: PT will be activated on entering and reenabled on exiting

This change requires
Igalia/wolvic-chromium#114 which implements the required bits on the Chromium backend.

Fixes #242

@svillar
Copy link
Member Author

svillar commented Aug 6, 2024

Note that this is increasing the version of the protocol used to talk to the Web Engine during WebXR sessions. This means that this change breaks WebXR support. We need to land the chromium backend change and also upload a new patch for Gecko to adapt it to work with this new protocol version.

app/src/main/cpp/BrowserWorld.cpp Show resolved Hide resolved
app/src/main/cpp/ExternalVR.cpp Outdated Show resolved Hide resolved
app/src/main/cpp/ExternalVR.cpp Outdated Show resolved Hide resolved
app/src/main/cpp/ExternalVR.cpp Outdated Show resolved Hide resolved
app/src/openxr/cpp/OpenXRHelpers.h Outdated Show resolved Hide resolved
Copy link
Member

@javifernandez javifernandez left a comment

Choose a reason for hiding this comment

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

This change looks good now.

@svillar
Copy link
Member Author

svillar commented Aug 27, 2024

This change requires Igalia/wolvic-gecko-patches#5, otherwise WebXR will break in the Gecko backend

The Assertions.h file was using a Throw() inline method defined in
OpenXRHelpers.h in several macros. There were several problems with
that:
1. The macros would only work if the file including Assertions.h was
also including OpenXRHelpers.h. That's wrong, Assertions.h should not
depend on that
2. Assertions.h should not have any dependency with OpenXR headers

This was unnoticed because files using those macros were already
including OpenXRHelpers.h. As soon as I tried to use it in non
OpenXR files it started to generate compiler errors.
Wolvic can now start and render WebXR's immersive-ar sessions
for those devices supporting passthrough, either via
non-opaque blend modes or passthrough compositor layers.

This requires a few changes in the communication protocol
with the web engine:
1. pass the available blend modes to the web engine so it
can select the desired one depending on the requested WebXR
session.
2. use the selected blend mode from the web engine to render
the immersive scene
3. notify Wolvic about the type of WebXR session (AR/VR)

Change #3 is required for those devices that do support
passthrough but not via AR blend modes. Examples of those
are the Meta devices that implement passthrough via a
passthrough compositor layer.

Note that WebXR's session type will prevail over the current
passthrough status in standalone mode. There are 4 different
scenarios (PT stands for passthrough):
1. PT ON, VR session: PT will be disabled on entering and
reenabled on exiting
2. PT ON, AR session: PT will be activated all the time
3. PT OFF, VR session: PT will be off all the time
4. PT OFF, AR session: PT will be activated on entering and
reenabled on exiting

This change requires
Igalia/wolvic-chromium#114 which
implements the required bits on the Chromium backend.
@svillar svillar merged commit 31b452a into main Aug 29, 2024
22 checks passed
@svillar svillar deleted the webxr_ar branch August 29, 2024 15:36
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.

Support for WebXR Augmented Reality Module
2 participants