Commit df9b8348 authored by Brandon Jones's avatar Brandon Jones Committed by Commit Bot

Remove requirement that inline XRWebGLLayers use XR compatible contexts

This was a recent change made to the WebXR spec.

Bug: 976070
Change-Id: Ibdf4e4d7648d14540280594d7079696223a8dc62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1728479Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683014}
parent dafbe9b4
...@@ -57,10 +57,11 @@ XRWebGLLayer* XRWebGLLayer::Create( ...@@ -57,10 +57,11 @@ XRWebGLLayer* XRWebGLLayer::Create(
return nullptr; return nullptr;
} }
if (!webgl_context->IsXRCompatible()) { if (session->immersive() && !webgl_context->IsXRCompatible()) {
exception_state.ThrowDOMException( exception_state.ThrowDOMException(
DOMExceptionCode::kInvalidStateError, DOMExceptionCode::kInvalidStateError,
"This context is not marked as XR compatible."); "WebGL context must be marked as XR compatible in order to "
"use with an immersive XRSession");
return nullptr; return nullptr;
} }
......
...@@ -16,7 +16,17 @@ xr_promise_test("Ensure that XRWebGLLayer's constructor throws appropriate error ...@@ -16,7 +16,17 @@ xr_promise_test("Ensure that XRWebGLLayer's constructor throws appropriate error
}; };
let gl = webglCanvas.getContext('webgl', glAttributes); let gl = webglCanvas.getContext('webgl', glAttributes);
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE) return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
.then((controller) => { .then(() => {
return navigator.xr.requestSession('inline')
.then((session) => {
try {
let webglLayerIncompatible = new XRWebGLLayer(session, gl);
} catch (err) {
assert_unreached("Inline XRWebGLLayers should not fail when created with a context that is not XRCompatible");
}
});
})
.then(() => {
return new Promise((resolve) => { return new Promise((resolve) => {
navigator.xr.test.simulateUserActivation(() => { navigator.xr.test.simulateUserActivation(() => {
navigator.xr.requestSession('immersive-vr') navigator.xr.requestSession('immersive-vr')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment