Skip to content
Permalink
Browse files

Add support for OpenXR hololens backend

  • Loading branch information...
Manishearth committed Aug 10, 2019
1 parent 9b4b022 commit acfe1ee0dd2ebe6bdfe04daf29c43f4888b08155

Some generated files are not rendered by default. Learn more.

@@ -156,10 +156,6 @@ impl XRMethods for XR {
comp: InCompartment,
) -> Rc<Promise> {
let promise = Promise::new_in_current_compartment(&self.global(), comp);
if mode != XRSessionMode::Immersive_vr {
promise.reject_error(Error::NotSupported);
return promise;
}

if self.pending_or_active_session() {
promise.reject_error(Error::InvalidState);
@@ -10,7 +10,9 @@ publish = false
libservo = { path = "../../../components/servo" }
log = "0.4"
servo-media = { git = "https://github.com/servo/media" }
webxr-api = { git = "https://github.com/servo/webxr" }

webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
webxr = { git = "https://github.com/servo/webxr" , optional = true}

[target.'cfg(not(target_os = "macos"))'.dependencies]
libc = "0.2"
@@ -44,5 +46,5 @@ no_static_freetype = ["libservo/no_static_freetype"]
no_wgl = ["libservo/no_wgl"]
oculusvr = ["libservo/oculusvr"]
webdriver = ["libservo/webdriver"]
uwp = ["libservo/uwp"]
uwp = ["libservo/uwp", "webxr", "webxr/openxr-api"]
webgl_backtrace = ["libservo/webgl_backtrace"]
@@ -189,8 +189,8 @@ pub fn init(
gl.finish();

let window_callbacks = Rc::new(ServoWindowCallbacks {
gl: gl.clone(),
host_callbacks: callbacks,
gl: gl.clone(),
coordinates: RefCell::new(init_opts.coordinates),
density: init_opts.density,
gl_context_pointer: init_opts.gl_context_pointer,
@@ -201,6 +201,7 @@ pub fn init(
vr_init: init_opts.vr_init,
xr_discovery: init_opts.xr_discovery,
waker,
gl: gl.clone(),
});

let servo = Servo::new(embedder_callbacks, window_callbacks.clone());
@@ -581,6 +582,8 @@ struct ServoEmbedderCallbacks {
waker: Box<dyn EventLoopWaker>,
xr_discovery: Option<Box<dyn webxr_api::Discovery>>,
vr_init: VRInitOptions,
#[allow(unused)]
gl: Rc<dyn gl::Gl>,
}

struct ServoWindowCallbacks {
@@ -611,6 +614,19 @@ impl EmbedderMethods for ServoEmbedderCallbacks {
}
}

#[cfg(feature = "uwp")]
fn register_webxr(&mut self, registry: &mut webxr_api::MainThreadRegistry) {
debug!("EmbedderMethods::register_xr");
assert!(
self.xr_discovery.is_none(),
"UWP builds should not be initialized with a WebXR Discovery object"
);
let gl = self.gl.clone();
let discovery = webxr::openxr::OpenXrDiscovery::new(gl);
registry.register(discovery);
}

#[cfg(not(feature = "uwp"))]
fn register_webxr(&mut self, registry: &mut webxr_api::MainThreadRegistry) {
debug!("EmbedderMethods::register_xr");
if let Some(discovery) = self.xr_discovery.take() {
@@ -0,0 +1,4 @@
/Generated Files
ServoApp.vcxproj.user
bin
obj
@@ -173,6 +173,9 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="C:\Users\manis\dev\dlls\openxr_loader.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</DeploymentContent>
</None>
<None Include="..\..\..\target\aarch64-pc-windows-msvc\debug\libcrypto.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</DeploymentContent>
</None>
@@ -26,9 +26,6 @@
[Non-immersive session supports local space when required]
expected: FAIL

[Non-immersive session supports viewer space by default]
expected: FAIL

[Non-immersive session rejects local space if not requested]
expected: FAIL

@@ -2,6 +2,3 @@
[Identity reference space provides correct poses for immersive sessions]
expected: FAIL

[Identity reference space provides correct poses for inline sessions]
expected: FAIL

@@ -1,4 +1,5 @@
[xrWebGLLayer_constructor.https.html]
expected: ERROR
[Ensure that XRWebGLLayer's constructor throws appropriate errors]
expected: FAIL
expected: TIMEOUT

0 comments on commit acfe1ee

Please sign in to comment.
You can’t perform that action at this time.